Mercurial > pidgin.yaz
diff src/protocols/yahoo/yahoochat.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 | 3aa848ccf986 |
children | d39eecc24a59 |
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoochat.c Sat Jul 17 17:08:24 2004 +0000 +++ b/src/protocols/yahoo/yahoochat.c Sat Jul 17 18:11:12 2004 +0000 @@ -69,36 +69,24 @@ yahoo_packet_free(pkt); } -static gint _mystrcmpwrapper(gconstpointer a, gconstpointer b) -{ - return strcmp(a, b); -} - /* this is slow, and different from the gaim_* version in that it (hopefully) won't add a user twice */ void yahoo_chat_add_users(GaimConvChat *chat, GList *newusers) { - GList *users, *i, *j; - - users = gaim_conv_chat_get_users(chat); + GList *i; for (i = newusers; i; i = i->next) { - j = g_list_find_custom(users, i->data, _mystrcmpwrapper); - if (j) + if (gaim_conv_chat_find_user(chat, i->data)) continue; - gaim_conv_chat_add_user(chat, i->data, NULL); + gaim_conv_chat_add_user(chat, i->data, NULL, GAIM_CBFLAGS_NONE); } } void yahoo_chat_add_user(GaimConvChat *chat, const char *user, const char *reason) { - GList *users; - - users = gaim_conv_chat_get_users(chat); - - if ((g_list_find_custom(users, user, _mystrcmpwrapper))) + if (gaim_conv_chat_find_user(chat, user)) return; - gaim_conv_chat_add_user(chat, user, reason); + gaim_conv_chat_add_user(chat, user, reason, GAIM_CBFLAGS_NONE); } static GaimConversation *yahoo_find_conference(GaimConnection *gc, const char *name) @@ -413,6 +401,10 @@ if (room && (!c || gaim_conv_chat_has_left(GAIM_CONV_CHAT(c))) && members && ((g_list_length(members) > 1) || !g_ascii_strcasecmp(members->data, gaim_connection_get_display_name(gc)))) { + int i; + GList *flags = NULL; + for (i = 0; i < g_list_length(members); i++) + flags = g_list_append(flags, GINT_TO_POINTER(GAIM_CBFLAGS_NONE)); if (c && gaim_conv_chat_has_left(GAIM_CONV_CHAT(c))) { /* this might be a hack, but oh well, it should nicely */ char *tmpmsg; @@ -424,7 +416,7 @@ gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), NULL, topic); yd->in_chat = 1; yd->chat_name = g_strdup(room); - gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members); + gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members, flags); tmpmsg = g_strdup_printf(_("You are now chatting in %s."), room); gaim_conv_chat_write(GAIM_CONV_CHAT(c), "", tmpmsg, GAIM_MESSAGE_SYSTEM, time(NULL)); @@ -435,7 +427,7 @@ gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), NULL, topic); yd->in_chat = 1; yd->chat_name = g_strdup(room); - gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members); + gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members, flags); } } else if (c) { yahoo_chat_add_users(GAIM_CONV_CHAT(c), members); @@ -600,7 +592,8 @@ yahoo_packet_hash(pkt, 1, dn); for (w = who; w; w = w->next) { - yahoo_packet_hash(pkt, 3, (char *)w->data); + const char *name = gaim_conv_chat_cb_get_name(w->data); + yahoo_packet_hash(pkt, 3, name); } yahoo_packet_hash(pkt, 57, room); @@ -626,8 +619,10 @@ pkt = yahoo_packet_new(YAHOO_SERVICE_CONFMSG, YAHOO_STATUS_AVAILABLE, 0); yahoo_packet_hash(pkt, 1, dn); - for (who = members; who; who = who->next) - yahoo_packet_hash(pkt, 53, (char *)who->data); + for (who = members; who; who = who->next) { + const char *name = gaim_conv_chat_cb_get_name(who->data); + yahoo_packet_hash(pkt, 53, name); + } yahoo_packet_hash(pkt, 57, room); yahoo_packet_hash(pkt, 14, msg2); if (utf8) @@ -663,7 +658,7 @@ if (!strcmp(memarr[i], "") || !strcmp(memarr[i], dn)) continue; yahoo_packet_hash(pkt, 3, memarr[i]); - gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), memarr[i], NULL); + gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), memarr[i], NULL, GAIM_CBFLAGS_NONE); } } yahoo_send_packet(yd, pkt); @@ -695,10 +690,11 @@ yahoo_packet_hash(pkt, 58, msg?msg2:""); yahoo_packet_hash(pkt, 13, "0"); for(; members; members = members->next) { - if (!strcmp(members->data, dn)) + const char *name = gaim_conv_chat_cb_get_name(members->data); + if (!strcmp(name, dn)) continue; - yahoo_packet_hash(pkt, 52, (char *)members->data); - yahoo_packet_hash(pkt, 53, (char *)members->data); + yahoo_packet_hash(pkt, 52, name); + yahoo_packet_hash(pkt, 53, name); } yahoo_send_packet(yd, pkt);