repo: ngircd
action: commit
revision: 
path_from: 
revision_from: 4da04640e6429e6cc61ca9dd4c7293b520d4b3bc:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit 4da04640e6429e6cc61ca9dd4c7293b520d4b3bc
Author: LucentW 
Date:   Fri May 8 16:02:57 2015 +0200

    Keep track of who placed bans/invites/excepts

    Implements #203.
    WARNING: it does not track the time of placement of invites, since the
    time_t is already used as a flag for single use invites!

diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c
index e74cd6eb1dfcc4358668a1c5ec18ec040471d697..
index ..a7c97d51bcfc01c047e1e3eb4522c99486561ca3 100644
--- a/src/ngircd/channel.c
+++ b/src/ngircd/channel.c
@@ -1098,29 +1098,29 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const ch


 GLOBAL bool
-Channel_AddBan(CHANNEL *c, const char *mask )
+Channel_AddBan(CHANNEL *c, const char *mask, const char *who )
 {
 	struct list_head *h = Channel_GetListBans(c);
 	LogDebug("Adding \"%s\" to \"%s\" ban list", mask, Channel_Name(c));
-	return Lists_Add(h, mask, false, NULL);
+	return Lists_Add(h, mask, time(NULL), who);
 }


 GLOBAL bool
-Channel_AddExcept(CHANNEL *c, const char *mask )
+Channel_AddExcept(CHANNEL *c, const char *mask, const char *who )
 {
 	struct list_head *h = Channel_GetListExcepts(c);
 	LogDebug("Adding \"%s\" to \"%s\" exception list", mask, Channel_Name(c));
-	return Lists_Add(h, mask, false, NULL);
+	return Lists_Add(h, mask, time(NULL), who);
 }


 GLOBAL bool
-Channel_AddInvite(CHANNEL *c, const char *mask, bool onlyonce)
+Channel_AddInvite(CHANNEL *c, const char *mask, bool onlyonce, const char *who )
 {
 	struct list_head *h = Channel_GetListInvites(c);
 	LogDebug("Adding \"%s\" to \"%s\" invite list", mask, Channel_Name(c));
-	return Lists_Add(h, mask, onlyonce, NULL);
+	return Lists_Add(h, mask, onlyonce, who);
 }


@@ -1137,7 +1137,9 @@ ShowChannelList(struct list_head *head, CLIENT *Client, CHANNEL *Channel,
 	while (e) {
 		if (!IRC_WriteStrClient(Client, msg, Client_ID(Client),
 					Channel_Name(Channel),
-					Lists_GetMask(e)))
+					Lists_GetMask(e),
+					Lists_GetReason(e),
+					Lists_GetValidity(e)))
 			return DISCONNECTED;
 		e = Lists_GetNext(e);
 	}
diff --git a/src/ngircd/channel.h b/src/ngircd/channel.h
index 1bc77760942bbebbc2ed55d84d27dcc4f2d99651..
index ..0e96703d5bdcdf027c6ba9f2ba9b5404561c096c 100644
--- a/src/ngircd/channel.h
+++ b/src/ngircd/channel.h
@@ -127,10 +127,10 @@ GLOBAL char *Channel_TopicWho PARAMS(( CHANNEL *Chan ));
 GLOBAL unsigned int Channel_CreationTime PARAMS(( CHANNEL *Chan ));
 #endif

-GLOBAL bool Channel_AddBan PARAMS((CHANNEL *c, const char *Mask));
-GLOBAL bool Channel_AddExcept PARAMS((CHANNEL *c, const char *Mask));
+GLOBAL bool Channel_AddBan PARAMS((CHANNEL *c, const char *Mask, const char *who));
+GLOBAL bool Channel_AddExcept PARAMS((CHANNEL *c, const char *Mask, const char *who));
 GLOBAL bool Channel_AddInvite PARAMS((CHANNEL *c, const char *Mask,
-				      bool OnlyOnce));
+				      bool OnlyOnce, const char *who));

 GLOBAL bool Channel_ShowBans PARAMS((CLIENT *client, CHANNEL *c));
 GLOBAL bool Channel_ShowExcepts PARAMS((CLIENT *client, CHANNEL *c));
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index ec7d53c488a788be68eba3033100047ce77ea008..
index ..2f9225067a4aa503146c142c811ac224243052ed 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -1017,15 +1017,15 @@ Add_To_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,

 	switch (what) {
 		case 'I':
-			if (!Channel_AddInvite(Channel, mask, false))
+			if (!Channel_AddInvite(Channel, mask, false, Client_ID(Client)))
 				return CONNECTED;
 			break;
 		case 'b':
-			if (!Channel_AddBan(Channel, mask))
+			if (!Channel_AddBan(Channel, mask, Client_ID(Client)))
 				return CONNECTED;
 			break;
 		case 'e':
-			if (!Channel_AddExcept(Channel, mask))
+			if (!Channel_AddExcept(Channel, mask, Client_ID(Client)))
 				return CONNECTED;
 			break;
 	}
diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h
index a5bc2c7ae8a90daea955bc2cceedcd0867387fb9..
index ..1f18215db70e5b0085984012365d01403e4f18b8 100644
--- a/src/ngircd/messages.h
+++ b/src/ngircd/messages.h
@@ -77,9 +77,9 @@
 #define RPL_TOPICSETBY_MSG		"333 %s %s %s %u"
 #define RPL_WHOISBOT_MSG		"335 %s %s :is an IRC Bot"
 #define RPL_INVITING_MSG		"341 %s %s %s%s"
-#define RPL_INVITELIST_MSG		"346 %s %s %s"
+#define RPL_INVITELIST_MSG		"346 %s %s %s %s %d"
 #define RPL_ENDOFINVITELIST_MSG		"347 %s %s :End of channel invite list"
-#define RPL_EXCEPTLIST_MSG		"348 %s %s %s"
+#define RPL_EXCEPTLIST_MSG		"348 %s %s %s %s %d"
 #define RPL_ENDOFEXCEPTLIST_MSG		"349 %s %s :End of channel exception list"
 #define RPL_VERSION_MSG			"351 %s %s-%s.%s %s :%s"
 #define RPL_WHOREPLY_MSG		"352 %s %s %s %s %s %s %s :%d %s"
@@ -87,7 +87,7 @@
 #define RPL_LINKS_MSG			"364 %s %s %s :%d %s"
 #define RPL_ENDOFLINKS_MSG		"365 %s %s :End of LINKS list"
 #define RPL_ENDOFNAMES_MSG		"366 %s %s :End of NAMES list"
-#define RPL_BANLIST_MSG			"367 %s %s %s"
+#define RPL_BANLIST_MSG			"367 %s %s %s %s %d"
 #define RPL_ENDOFBANLIST_MSG		"368 %s %s :End of channel ban list"
 #define RPL_ENDOFWHOWAS_MSG		"369 %s %s :End of WHOWAS list"
 #define RPL_INFO_MSG    		"371 %s :%s"

-----END OF PAGE-----