comparison src/protocols/gg/confer.c @ 12961:4eae108efdde

[gaim-migrate @ 15314] A GG conference fix from Bartosz Oler. This should fix SF Bug #1395473 committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 20 Jan 2006 01:53:05 +0000
parents 508512caa22e
children 41747a38a1a8
comparison
equal deleted inserted replaced
12960:cefac38bcb9f 12961:4eae108efdde
45 GGPInfo *info = gc->proto_data; 45 GGPInfo *info = gc->proto_data;
46 GGPChat *chat; 46 GGPChat *chat;
47 GList *l; 47 GList *l;
48 gchar *str_uin; 48 gchar *str_uin;
49 49
50 str_uin = g_strdup_printf("%lu", (unsigned long int)uin);
51
52 for (l = info->chats; l != NULL; l = l->next) { 50 for (l = info->chats; l != NULL; l = l->next) {
53 chat = l->data; 51 chat = l->data;
54 52
55 if (g_utf8_collate(chat->name, chat_name) != 0) 53 if (g_utf8_collate(chat->name, chat_name) != 0)
56 continue; 54 continue;
57 55
58 if (g_list_find(chat->participants, str_uin) == NULL) { 56 if (g_list_find(chat->participants, GINT_TO_POINTER(uin)) == NULL) {
59 GaimBuddy *buddy; 57 chat->participants = g_list_append(
58 chat->participants, GINT_TO_POINTER(uin));
60 59
61 chat->participants = g_list_append( 60 str_uin = g_strdup_printf("%lu", (unsigned long int)uin);
62 chat->participants, str_uin); 61 conv = ggp_confer_find_by_name(gc, chat_name);
62 gaim_conv_chat_add_user(GAIM_CONV_CHAT(conv), str_uin, NULL,
63 GAIM_CBFLAGS_NONE, TRUE);
63 64
64 conv = ggp_confer_find_by_name(gc, chat_name); 65 g_free(str_uin);
65
66 buddy = gaim_find_buddy(gaim_connection_get_account(gc), str_uin);
67 if (buddy != NULL) {
68 gaim_conv_chat_add_user(GAIM_CONV_CHAT(conv),
69 gaim_buddy_get_alias(buddy), NULL,
70 GAIM_CBFLAGS_NONE, TRUE);
71 } else {
72 gaim_conv_chat_add_user(GAIM_CONV_CHAT(conv),
73 str_uin, NULL,
74 GAIM_CBFLAGS_NONE, TRUE);
75 }
76 } 66 }
77 break; 67 break;
78 } 68 }
79
80 g_free(str_uin);
81 } 69 }
82 /* }}} */ 70 /* }}} */
83 71
84 /* void ggp_confer_participants_add(GaimConnection *gc, const gchar *chat_name, const uin_t *recipients, int count) {{{ */ 72 /* void ggp_confer_participants_add(GaimConnection *gc, const gchar *chat_name, const uin_t *recipients, int count) {{{ */
85 void ggp_confer_participants_add(GaimConnection *gc, const gchar *chat_name, 73 void ggp_confer_participants_add(GaimConnection *gc, const gchar *chat_name,
86 const uin_t *recipients, int count) 74 const uin_t *recipients, int count)
87 { 75 {
88 GGPInfo *info = gc->proto_data; 76 GGPInfo *info = gc->proto_data;
89 GList *l; 77 GList *l;
78 gchar *str_uin;
90 79
91 for (l = info->chats; l != NULL; l = l->next) { 80 for (l = info->chats; l != NULL; l = l->next) {
92 GGPChat *chat = l->data; 81 GGPChat *chat = l->data;
93 int i; 82 int i;
94 83
95 if (g_utf8_collate(chat->name, chat_name) != 0) 84 if (g_utf8_collate(chat->name, chat_name) != 0)
96 continue; 85 continue;
97 86
98 for (i = 0; i < count; i++) { 87 for (i = 0; i < count; i++) {
99 gchar *str_uin = g_strdup_printf("%lu", (unsigned long int)recipients[i]);
100 GaimConversation *conv; 88 GaimConversation *conv;
101 GaimBuddy *buddy;
102 89
103 if (g_list_find(chat->participants, str_uin) != NULL) { 90 if (g_list_find(chat->participants,
104 g_free(str_uin); 91 GINT_TO_POINTER(recipients[i])) != NULL) {
105 continue; 92 continue;
106 } 93 }
107 94
108 chat->participants = g_list_append(chat->participants, str_uin); 95 chat->participants = g_list_append(chat->participants,
96 GINT_TO_POINTER(recipients[i]));
97
98 str_uin = g_strdup_printf("%lu", (unsigned long int)recipients[i]);
109 conv = ggp_confer_find_by_name(gc, chat_name); 99 conv = ggp_confer_find_by_name(gc, chat_name);
110 100 gaim_conv_chat_add_user(GAIM_CONV_CHAT(conv),
111 buddy = gaim_find_buddy(gaim_connection_get_account(gc), str_uin); 101 str_uin, NULL,
112 if (buddy != NULL) { 102 GAIM_CBFLAGS_NONE, TRUE);
113 gaim_conv_chat_add_user(GAIM_CONV_CHAT(conv),
114 gaim_buddy_get_alias(buddy), NULL,
115 GAIM_CBFLAGS_NONE, TRUE);
116 } else {
117 gaim_conv_chat_add_user(GAIM_CONV_CHAT(conv),
118 str_uin, NULL,
119 GAIM_CBFLAGS_NONE, TRUE);
120 }
121 g_free(str_uin); 103 g_free(str_uin);
122 } 104 }
123 break; 105 break;
124 } 106 }
125 } 107 }
141 123
142 chat = l->data; 124 chat = l->data;
143 matches = 0; 125 matches = 0;
144 126
145 for (m = chat->participants; m != NULL; m = m->next) { 127 for (m = chat->participants; m != NULL; m = m->next) {
146 uin_t p = ggp_str_to_uin(m->data); 128 uin_t uin = GPOINTER_TO_INT(m->data);
147 int i; 129 int i;
148 130
149 for (i = 0; i < count; i++) 131 for (i = 0; i < count; i++)
150 if (p == recipients[i]) 132 if (uin == recipients[i])
151 matches++; 133 matches++;
152 } 134 }
153 135
154 if (matches == count) 136 if (matches == count)
155 break; 137 break;