| 195 static PurpleConversation * |
195 static PurpleConversation * |
| 196 find_im_with_contact(PurpleAccount *account, const char *name) |
196 find_im_with_contact(PurpleAccount *account, const char *name) |
| 197 { |
197 { |
| 198 PurpleBlistNode *node; |
198 PurpleBlistNode *node; |
| 199 PurpleBuddy *buddy = purple_blist_find_buddy(account, name); |
199 PurpleBuddy *buddy = purple_blist_find_buddy(account, name); |
| |
200 PurpleContact *contact; |
| 200 PurpleConversation *im = NULL; |
201 PurpleConversation *im = NULL; |
| 201 |
202 |
| 202 if (!buddy) |
203 if(!PURPLE_IS_BUDDY(buddy)) { |
| 203 return NULL; |
204 return NULL; |
| 204 |
205 } |
| 205 for (node = purple_blist_node_get_first_child(purple_blist_node_get_parent((PurpleBlistNode*)buddy)); |
206 |
| 206 node; node = purple_blist_node_get_sibling_next(node)) { |
207 contact = purple_buddy_get_contact(buddy); |
| 207 if (node == (PurpleBlistNode*)buddy) |
208 |
| |
209 node = purple_blist_node_get_first_child(PURPLE_BLIST_NODE(contact)); |
| |
210 while(node != NULL) { |
| |
211 PurpleBuddy *cbuddy; |
| |
212 PurpleConversationManager *manager; |
| |
213 |
| |
214 if(node == PURPLE_BLIST_NODE(buddy)) { |
| |
215 node = node->next; |
| |
216 |
| 208 continue; |
217 continue; |
| 209 if ((im = purple_conversations_find_im_with_account( |
218 } |
| 210 purple_buddy_get_name((PurpleBuddy*)node), purple_buddy_get_account((PurpleBuddy*)node))) != NULL) |
219 |
| |
220 cbuddy = PURPLE_BUDDY(node); |
| |
221 manager = purple_conversation_manager_get_default(); |
| |
222 im = purple_conversation_manager_find_im(manager, |
| |
223 purple_buddy_get_account(cbuddy), |
| |
224 purple_buddy_get_name(cbuddy)); |
| |
225 |
| |
226 if(PURPLE_IS_IM_CONVERSATION(im)) { |
| 211 break; |
227 break; |
| 212 } |
228 } |
| |
229 |
| |
230 node = node->next; |
| |
231 } |
| |
232 |
| 213 return im; |
233 return im; |
| 214 } |
234 } |
| 215 |
235 |
| 216 static char * |
236 static char * |
| 217 get_conversation_title(PurpleConversation *conv, PurpleAccount *account) |
237 get_conversation_title(PurpleConversation *conv, PurpleAccount *account) |
| 225 static void |
245 static void |
| 226 update_buddy_typing(PurpleAccount *account, const char *who, gpointer null) |
246 update_buddy_typing(PurpleAccount *account, const char *who, gpointer null) |
| 227 { |
247 { |
| 228 FinchConv *ggc; |
248 FinchConv *ggc; |
| 229 PurpleConversation *conv; |
249 PurpleConversation *conv; |
| |
250 PurpleConversationManager *manager; |
| 230 PurpleIMConversation *im; |
251 PurpleIMConversation *im; |
| 231 char *title, *str; |
252 char *title, *str; |
| 232 |
253 |
| 233 conv = purple_conversations_find_im_with_account(who, account); |
254 manager = purple_conversation_manager_get_default(); |
| 234 |
255 conv = purple_conversation_manager_find_im(manager, account, who); |
| 235 if (!conv) |
256 |
| |
257 if(!conv) { |
| 236 return; |
258 return; |
| |
259 } |
| 237 |
260 |
| 238 im = PURPLE_IM_CONVERSATION(conv); |
261 im = PURPLE_IM_CONVERSATION(conv); |
| 239 ggc = FINCH_CONV(conv); |
262 ggc = FINCH_CONV(conv); |
| 240 |
263 |
| 241 if (purple_im_conversation_get_typing_state(im) == PURPLE_IM_TYPING) { |
264 if (purple_im_conversation_get_typing_state(im) == PURPLE_IM_TYPING) { |
| 279 } |
302 } |
| 280 |
303 |
| 281 static void |
304 static void |
| 282 account_signed_on_off(PurpleConnection *gc, gpointer null) |
305 account_signed_on_off(PurpleConnection *gc, gpointer null) |
| 283 { |
306 { |
| |
307 PurpleConversationManager *manager; |
| 284 GList *list, *l; |
308 GList *list, *l; |
| 285 |
309 |
| 286 list = purple_conversations_get_all(); |
310 manager = purple_conversation_manager_get_default(); |
| |
311 list = purple_conversation_manager_get_all(manager); |
| 287 |
312 |
| 288 for(l = list; l != NULL; l = l->next) { |
313 for(l = list; l != NULL; l = l->next) { |
| 289 PurpleConversation *conv = NULL; |
314 PurpleConversation *conv = NULL; |
| 290 PurpleConversation *cc = NULL; |
315 PurpleConversation *cc = NULL; |
| 291 |
316 |
| 347 } |
372 } |
| 348 |
373 |
| 349 static void |
374 static void |
| 350 account_signing_off(PurpleConnection *gc) |
375 account_signing_off(PurpleConnection *gc) |
| 351 { |
376 { |
| 352 GList *list = purple_conversations_get_all(); |
377 PurpleConversationManager *manager; |
| |
378 GList *list; |
| 353 PurpleAccount *account = purple_connection_get_account(gc); |
379 PurpleAccount *account = purple_connection_get_account(gc); |
| |
380 |
| |
381 manager = purple_conversation_manager_get_default(); |
| |
382 list = purple_conversation_manager_get_all(manager); |
| 354 |
383 |
| 355 /* We are about to sign off. See which chats we are currently in, and mark |
384 /* We are about to sign off. See which chats we are currently in, and mark |
| 356 * them for rejoin on reconnect. */ |
385 * them for rejoin on reconnect. */ |
| 357 while(list != NULL) { |
386 while(list != NULL) { |
| 358 PurpleConversation *conv = NULL; |
387 PurpleConversation *conv = NULL; |