Commits

B.Greenham  committed 1dfc91d

Looks like irc_dictionary things cannot support more than one key with the same value. Therefore, a rework of +J and OACCEPT's metadata are required to make them work properly with multiple users.

  • Participants
  • Parent commits b1cc9aa

Comments (0)

Files changed (6)

File extensions/m_oaccept.c

 mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
 	struct Metadata *md;
+	struct DictionaryIter iter;
 	struct Client *target_p;
+	char *text = rb_strdup("");
 
 	if(!(target_p = find_client(parv[1])))
 	{
 		return;
 	}
 
+	rb_sprintf(text, "O%s", source_p->id);
+
 	/* Don't allow someone to pointlessly fill up someone's metadata
 	 * with identical OACCEPT entries. */
-	if((md = user_metadata_find(target_p, "OACCEPT")))
-		if(!strcmp(source_p->id, md->value))
+	DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
+	{
+		if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text))
 		{
 			sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
 			return;
 		}
+	}
 
-	user_metadata_add(target_p, "OACCEPT", source_p->id, 1);
+	user_metadata_add(target_p, text, "OACCEPT", 1);
 
 	sendto_wallops_flags(UMODE_WALLOP, &me,
 			     "OACCEPT called for %s by %s!%s@%s",

File extensions/m_okick.c

 	char *name;
 	char *p = NULL;
 	char *user;
+	char *text = rb_strdup("");
 	static char buf[BUFSIZE];
 
 	if(*parv[2] == '\0')
 		      ":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
 	remove_user_from_channel(msptr);
 
+	rb_sprintf(text, "K%s", who->id);
+
 	/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
-	if(MyClient(target_p) && chptr->mode.mode & MODE_NOREJOIN)
-		channel_metadata_time_add(chptr, "KICKNOREJOIN", rb_current_time(), target_p->id);
+	if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)
+		channel_metadata_time_add(chptr, text, rb_current_time(), "KICKNOREJOIN");
 	return 0;
 }

File modules/core/m_kick.c

 	char *comment;
 	const char *name;
 	char *p = NULL;
+	char *text = rb_strdup("");
 	const char *user;
 	static char buf[BUFSIZE];
 	int is_override = 0;
 			      use_id(source_p), chptr->chname, use_id(who), comment);
 		remove_user_from_channel(msptr);
 
+		rb_sprintf(text, "K%s", who->id);
+
 		/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
 		if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)
-			channel_metadata_time_add(chptr, "KICKNOREJOIN", rb_current_time(), who->id);
+			channel_metadata_time_add(chptr, text, rb_current_time(), "KICKNOREJOIN");
 	}
 	else if (MyClient(source_p))
 		sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,

File modules/core/m_message.c

 	struct Metadata *md;
 	struct DictionaryIter iter;
 	int oaccept = 0;
+	char *text3 = rb_strdup("");
 
 	if(MyClient(source_p))
 	{
 		{
 			if (IsOper(source_p))
 			{
+				rb_sprintf(text3, "O%s", source_p->id);
 				DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
 				{
-					if(!strcmp(md->value, source_p->id))
+					if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text3))
 					{
 						oaccept = 1;
 						break;

File src/channel.c

 	char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
 	char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
 	char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
+	char *text = rb_strdup("");
 	int use_althost = 0;
 	int i = 0;
 	hook_data_channel moduledata;
 	if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN)
 		return (ERR_BANNEDFROMCHAN);
 
+	rb_sprintf(text, "K%s", source_p->id);
+
 	DICTIONARY_FOREACH(md, &iter, chptr->metadata)
 	{
-		if(!strcmp(md->name, "KICKNOREJOIN") && !strcmp(md->value, source_p->id) && (md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))
+		if(!strcmp(md->value, "KICKNOREJOIN") && !strcmp(md->name, text) && (md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))
 			return ERR_KICKNOREJOIN;
 		/* cleanup any stale KICKNOREJOIN metadata we find while we're at it */
-		if(!strcmp(md->name, "KICKNOREJOIN") && !(md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))  
+		if(!strcmp(md->value, "KICKNOREJOIN") && !(md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))  
 			channel_metadata_delete(chptr, md->name, 0);
 	}
 

File src/chmode.c

 		{
 			DICTIONARY_FOREACH(md, &iter, chptr->metadata)
 			{
-				if(!strcmp(md->name, "KICKNOREJOIN"))  
+				if(!strcmp(md->value, "KICKNOREJOIN"))  
 					channel_metadata_delete(chptr, md->name, 0);
 			}
 		}