Commit Diff


commit - 2fc61ce8a6a6c2ac8652b8cea33d57acd50681c2
commit + d28d838cb9a8488208c10ea73b25532e1aef8e06
blob - e74cd6eb1dfcc4358668a1c5ec18ec040471d697
blob + 02eb235754217588b7767d9d2a13e49a9f0a6201
--- src/ngircd/channel.c
+++ src/ngircd/channel.c
@@ -1098,29 +1098,29 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client
 
 
 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, false);
 }
 
 
 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, false);
 }
 
 
 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, time(NULL), who, onlyonce);
 }
 
 
@@ -1137,7 +1137,9 @@ ShowChannelList(struct list_head *head, CLIENT *Client
 	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);
 	}
blob - 1bc77760942bbebbc2ed55d84d27dcc4f2d99651
blob + 0e96703d5bdcdf027c6ba9f2ba9b5404561c096c
--- src/ngircd/channel.h
+++ 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));
blob - 9ffa8b147471b18b8ee2a97d4914c162e21e6f44
blob + 0bd9397f215c625db75ca6e121786e6824d8682c
--- src/ngircd/class.c
+++ src/ngircd/class.c
@@ -105,7 +105,7 @@ Class_AddMask(const int Class, const char *Pattern, ti
 
 	Lists_MakeMask(Pattern, mask, sizeof(mask));
 	return Lists_Add(&My_Classes[Class], mask,
-			 ValidUntil, Reason);
+			 ValidUntil, Reason, false);
 }
 
 GLOBAL void
blob - ec7d53c488a788be68eba3033100047ce77ea008
blob + 2f9225067a4aa503146c142c811ac224243052ed
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
@@ -1017,15 +1017,15 @@ Add_To_List(char what, CLIENT *Prefix, CLIENT *Client,
 
 	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;
 	}
blob - 2e5c680aaa52ddde65b6a0ade839e90e96770cdb
blob + a309ee9f068fcba162c9f393a8b1d46633c3604c
--- src/ngircd/irc-op.c
+++ src/ngircd/irc-op.c
@@ -200,7 +200,7 @@ IRC_INVITE(CLIENT *Client, REQUEST *Req)
 		if (remember) {
 			/* We must remember this invite */
 			if (!Channel_AddInvite(chan, Client_MaskCloaked(target),
-						true))
+						true, Client_ID(from)))
 				return CONNECTED;
 		}
 	}
blob - 247344e508a6e3daf3fc164d1e47ddbdc0e98152
blob + a091addb26860ed703c40ddc25eb5c0c65f1d582
--- src/ngircd/lists.c
+++ src/ngircd/lists.c
@@ -32,7 +32,8 @@ struct list_elem {
 	struct list_elem *next;	/** pointer to next list element */
 	char mask[MASK_LEN];	/** IRC mask */
 	char *reason;		/** Optional "reason" text */
-	time_t valid_until;	/** 0: unlimited; 1: once; t(>1): until t */
+	time_t valid_until;	/** 0: unlimited; t(>0): until t */
+	bool onlyonce;
 };
 
 /**
@@ -65,7 +66,7 @@ Lists_GetReason(const struct list_elem *e)
  * Get "validity" value stored in list element.
  *
  * @param list_elem List element.
- * @return Validity: 0=unlimited, 1=once, >1 until this time stamp.
+ * @return Validity: 0=unlimited, >0 until this time stamp.
  */
 GLOBAL time_t
 Lists_GetValidity(const struct list_elem *e)
@@ -75,6 +76,19 @@ Lists_GetValidity(const struct list_elem *e)
 }
 
 /**
+ * Get "onlyonce" value stored in list element.
+ *
+ * @param list_elem List element.
+ * @return True if the element was stored for single use, false otherwise.
+ */
+GLOBAL bool
+Lists_GetOnlyOnce(const struct list_elem *e)
+{
+	assert(e != NULL);
+	return e->onlyonce;
+}
+
+/**
  * Get first list element of a list.
  *
  * @param h List head.
@@ -111,7 +125,7 @@ Lists_GetNext(const struct list_elem *e)
  */
 bool
 Lists_Add(struct list_head *h, const char *Mask, time_t ValidUntil,
-	  const char *Reason)
+	  const char *Reason, bool OnlyOnce)
 {
 	struct list_elem *e, *newelem;
 
@@ -148,6 +162,7 @@ Lists_Add(struct list_head *h, const char *Mask, time_
 	else
 		newelem->reason = NULL;
 	newelem->valid_until = ValidUntil;
+	newelem->onlyonce = OnlyOnce;
 	newelem->next = e;
 	h->first = newelem;
 
@@ -329,7 +344,7 @@ Lists_CheckReason(struct list_head *h, CLIENT *Client,
 		if (MatchCaseInsensitive(e->mask, Client_MaskCloaked(Client))) {
 			if (len && e->reason)
 				strlcpy(reason, e->reason, len);
-			if (e->valid_until == 1) {
+			if (e->onlyonce) {
 				/* Entry is valid only once, delete it */
 				LogDebug("Deleted \"%s\" from list (used).",
 					 e->mask);
@@ -363,7 +378,7 @@ Lists_Expire(struct list_head *h, const char *ListName
 
 	while (e) {
 		next = e->next;
-		if (e->valid_until > 1 && e->valid_until < now) {
+		if (e->valid_until > 0 && e->valid_until < now) {
 			/* Entry is expired, delete it */
 			if (e->reason)
 				Log(LOG_INFO,
blob - db0f11a9603691f9eb64f5fcf90b638c007a0876
blob + 070e4233efcaac596641bfb78626bfedb20c22ea
--- src/ngircd/lists.h
+++ src/ngircd/lists.h
@@ -36,7 +36,8 @@ GLOBAL struct list_elem *Lists_CheckDupeMask PARAMS((c
 					const char *mask));
 
 GLOBAL bool Lists_Add PARAMS((struct list_head *h, const char *Mask,
-			      time_t ValidUntil, const char *Reason));
+			      time_t ValidUntil, const char *Reason,
+			      bool OnlyOnce));
 GLOBAL void Lists_Del PARAMS((struct list_head *head, const char *Mask));
 GLOBAL unsigned long Lists_Count PARAMS((struct list_head *h));
 
@@ -46,6 +47,7 @@ GLOBAL void Lists_MakeMask PARAMS((const char *Pattern
 GLOBAL const char *Lists_GetMask PARAMS((const struct list_elem *e));
 GLOBAL const char *Lists_GetReason PARAMS((const struct list_elem *e));
 GLOBAL time_t Lists_GetValidity PARAMS((const struct list_elem *e));
+GLOBAL bool Lists_GetOnlyOnce PARAMS((const struct list_elem *e));
 
 GLOBAL void Lists_Expire PARAMS((struct list_head *h, const char *ListName));
 
blob - 8eba60ee6f13a119157e2e748789e50734ab8a37
blob + 8a7215b42172464a3f77204225292760fb47af5c
--- src/ngircd/messages.h
+++ src/ngircd/messages.h
@@ -78,9 +78,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"
@@ -88,7 +88,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"