diff src/protocols/silc/chat.c @ 9554:8b2451878e26

[gaim-migrate @ 10387] " This patch adds chat user status icons (voice / halfop / op / founder) to chats There's a screenshot here, showing ops, voices and ignored ops and voices http://nosnilmot.com/gaim/chatusers.png This required some changes in how the core stores the list of users in chats to be able to store the status too, which are detailed below. I also fixed up some memory leaks as I came across them (string values returned by gtk_tree_model_get() not being g_free()'d) and a minor bug in signals-test.c Conversation API: Changed: gaim_conv_chat_add_user() (added flags parameter) gaim_conv_chat_add_users() now (added GList of flags parameter) gaim_conv_chat_get_users() now returns a GList of GaimChatBuddy's gaim_conv_chat_set_users() now expects a GList of GaimChatBuddy's Added: gaim_conv_chat_set_user_flags() gaim_conv_chat_get_user_flags() gaim_conv_chat_find_user() gaim_conv_chat_cb_new() gaim_conv_chat_cb_find() gaim_conv_chat_cb_destroy() gaim_conv_chat_cb_get_name() Conversation UI ops: added: chat_update_user() Signals: Changed: chat-buddy-joining & chat-buddy-joined now include the user's flags Added: chat-buddy-flags for when user's flags change Added: gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT (required for the new chat-buddy-flags signal) Protocol Plugins: All updated to work with above changes (obviously) User flags support added to IRC, Jabber and SILC New Files: pixmaps/status/default/ voice.svg halfop.svg op.svg founder.svg " --Stu Tomlinson committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 17 Jul 2004 18:11:12 +0000
parents 578986136bac
children 4a8bf81b82ae
line wrap: on
line diff
--- a/src/protocols/silc/chat.c	Sat Jul 17 17:08:24 2004 +0000
+++ b/src/protocols/silc/chat.c	Sat Jul 17 18:11:12 2004 +0000
@@ -941,7 +941,7 @@
 	SilcUInt32 retry = SILC_PTR_TO_32(channel->context);
 	SilcHashTableList htl;
 	SilcChannelUser chu;
-	GList *users = NULL;
+	GList *users = NULL, *flags = NULL;
 	char tmp[256];
 
 	if (!clients && retry < 1) {
@@ -963,25 +963,17 @@
 	/* Add all users to channel */
 	silc_hash_table_list(channel->user_list, &htl);
 	while (silc_hash_table_get(&htl, NULL, (void *)&chu)) {
+		GaimConvChatBuddyFlags f = GAIM_CBFLAGS_NONE;
 		if (!chu->client->nickname)
 			continue;
 		chu->context = SILC_32_TO_PTR(sg->channel_ids);
 
-#if 0   /* XXX don't append mode char to nick because Gaim doesn't
-	   give a way to change it afterwards when mode changes. */
-		tmp2 = silc_client_chumode_char(chu->mode);
-		if (tmp2)
-			g_snprintf(tmp, sizeof(tmp), "%s%s", tmp2,
-				   chu->client->nickname);
-		else
-			g_snprintf(tmp, sizeof(tmp), "%s",
-				   chu->client->nickname);
-		silc_free(tmp2);
-
-		users = g_list_append(users, g_strdup(tmp));
-#else
+		if (chu->mode & SILC_CHANNEL_UMODE_CHANFO)
+			f |= GAIM_CBFLAGS_FOUNDER;
+		if (chu->mode & SILC_CHANNEL_UMODE_CHANOP)
+			f |= GAIM_CBFLAGS_OP;
 		users = g_list_append(users, g_strdup(chu->client->nickname));
-#endif
+		flags = g_list_append(flags, GINT_TO_POINTER(f));
 
 		if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) {
 			if (chu->client == conn->local_entry)
@@ -1000,8 +992,9 @@
 	}
 	silc_hash_table_list_reset(&htl);
 
-	gaim_conv_chat_add_users(GAIM_CONV_CHAT(convo), users);
+	gaim_conv_chat_add_users(GAIM_CONV_CHAT(convo), users, flags);
 	g_list_free(users);
+	g_list_free(flags);
 
 	/* Set topic */
 	if (channel->topic)