comparison 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
comparison
equal deleted inserted replaced
9553:8a64666476e6 9554:8b2451878e26
939 SilcChannelEntry channel = context; 939 SilcChannelEntry channel = context;
940 GaimConversation *convo; 940 GaimConversation *convo;
941 SilcUInt32 retry = SILC_PTR_TO_32(channel->context); 941 SilcUInt32 retry = SILC_PTR_TO_32(channel->context);
942 SilcHashTableList htl; 942 SilcHashTableList htl;
943 SilcChannelUser chu; 943 SilcChannelUser chu;
944 GList *users = NULL; 944 GList *users = NULL, *flags = NULL;
945 char tmp[256]; 945 char tmp[256];
946 946
947 if (!clients && retry < 1) { 947 if (!clients && retry < 1) {
948 /* Resolving users failed, try again. */ 948 /* Resolving users failed, try again. */
949 channel->context = SILC_32_TO_PTR(retry + 1); 949 channel->context = SILC_32_TO_PTR(retry + 1);
961 return; 961 return;
962 962
963 /* Add all users to channel */ 963 /* Add all users to channel */
964 silc_hash_table_list(channel->user_list, &htl); 964 silc_hash_table_list(channel->user_list, &htl);
965 while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { 965 while (silc_hash_table_get(&htl, NULL, (void *)&chu)) {
966 GaimConvChatBuddyFlags f = GAIM_CBFLAGS_NONE;
966 if (!chu->client->nickname) 967 if (!chu->client->nickname)
967 continue; 968 continue;
968 chu->context = SILC_32_TO_PTR(sg->channel_ids); 969 chu->context = SILC_32_TO_PTR(sg->channel_ids);
969 970
970 #if 0 /* XXX don't append mode char to nick because Gaim doesn't 971 if (chu->mode & SILC_CHANNEL_UMODE_CHANFO)
971 give a way to change it afterwards when mode changes. */ 972 f |= GAIM_CBFLAGS_FOUNDER;
972 tmp2 = silc_client_chumode_char(chu->mode); 973 if (chu->mode & SILC_CHANNEL_UMODE_CHANOP)
973 if (tmp2) 974 f |= GAIM_CBFLAGS_OP;
974 g_snprintf(tmp, sizeof(tmp), "%s%s", tmp2,
975 chu->client->nickname);
976 else
977 g_snprintf(tmp, sizeof(tmp), "%s",
978 chu->client->nickname);
979 silc_free(tmp2);
980
981 users = g_list_append(users, g_strdup(tmp));
982 #else
983 users = g_list_append(users, g_strdup(chu->client->nickname)); 975 users = g_list_append(users, g_strdup(chu->client->nickname));
984 #endif 976 flags = g_list_append(flags, GINT_TO_POINTER(f));
985 977
986 if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { 978 if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) {
987 if (chu->client == conn->local_entry) 979 if (chu->client == conn->local_entry)
988 g_snprintf(tmp, sizeof(tmp), 980 g_snprintf(tmp, sizeof(tmp),
989 _("You are channel founder on <I>%s</I>"), 981 _("You are channel founder on <I>%s</I>"),
998 990
999 } 991 }
1000 } 992 }
1001 silc_hash_table_list_reset(&htl); 993 silc_hash_table_list_reset(&htl);
1002 994
1003 gaim_conv_chat_add_users(GAIM_CONV_CHAT(convo), users); 995 gaim_conv_chat_add_users(GAIM_CONV_CHAT(convo), users, flags);
1004 g_list_free(users); 996 g_list_free(users);
997 g_list_free(flags);
1005 998
1006 /* Set topic */ 999 /* Set topic */
1007 if (channel->topic) 1000 if (channel->topic)
1008 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, channel->topic); 1001 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, channel->topic);
1009 1002