| 257 message_source_activated(MessagingMenuApp *app, const gchar *id, |
257 message_source_activated(MessagingMenuApp *app, const gchar *id, |
| 258 gpointer user_data) |
258 gpointer user_data) |
| 259 { |
259 { |
| 260 gchar **sections = g_strsplit(id, ":", 0); |
260 gchar **sections = g_strsplit(id, ":", 0); |
| 261 PurpleConversation *conv = NULL; |
261 PurpleConversation *conv = NULL; |
| 262 PurpleConversationManager *manager = NULL; |
262 PurpleConversationManager *conversation_manager = NULL; |
| 263 PurpleAccount *account; |
263 PurpleAccount *account; |
| |
264 PurpleAccountManager *account_manager = NULL; |
| 264 |
265 |
| 265 char *type = sections[0]; |
266 char *type = sections[0]; |
| 266 char *cname = sections[1]; |
267 char *cname = sections[1]; |
| 267 char *aname = sections[2]; |
268 char *aname = sections[2]; |
| 268 char *protocol = sections[3]; |
269 char *protocol = sections[3]; |
| 269 |
270 |
| 270 manager = purple_conversation_manager_get_default(); |
271 conversation_manager = purple_conversation_manager_get_default(); |
| 271 |
272 |
| 272 account = purple_accounts_find(aname, protocol); |
273 account_manager = purple_account_manager_get_default(); |
| |
274 account = purple_account_manager_find(account_manager, aname, protocol); |
| 273 |
275 |
| 274 if (g_strcmp0(type, "im") == 0) { |
276 if (g_strcmp0(type, "im") == 0) { |
| 275 conv = purple_conversation_manager_find_im(manager, account, cname); |
277 conv = purple_conversation_manager_find_im(conversation_manager, |
| |
278 account, cname); |
| 276 } else if (g_strcmp0(type, "chat") == 0) { |
279 } else if (g_strcmp0(type, "chat") == 0) { |
| 277 conv = purple_conversation_manager_find_chat(manager, account, cname); |
280 conv = purple_conversation_manager_find_chat(conversation_manager, |
| |
281 account, cname); |
| 278 } else { |
282 } else { |
| 279 conv = purple_conversation_manager_find(manager, account, cname); |
283 conv = purple_conversation_manager_find(conversation_manager, |
| |
284 account, cname); |
| 280 } |
285 } |
| 281 |
286 |
| 282 if (conv) { |
287 if (conv) { |
| 283 GtkWidget *win = NULL; |
288 GtkWidget *win = NULL; |
| 284 PidginConversationWindow *convwin = NULL; |
289 PidginConversationWindow *convwin = NULL; |
| 293 } |
298 } |
| 294 g_strfreev (sections); |
299 g_strfreev (sections); |
| 295 } |
300 } |
| 296 |
301 |
| 297 static PurpleSavedStatus * |
302 static PurpleSavedStatus * |
| 298 create_transient_status(PurpleStatusPrimitive primitive, PurpleStatusType *status_type) |
303 create_transient_status(PurpleStatusPrimitive primitive, |
| |
304 PurpleStatusType *status_type) |
| 299 { |
305 { |
| 300 PurpleSavedStatus *saved_status = purple_savedstatus_new(NULL, primitive); |
306 PurpleSavedStatus *saved_status = purple_savedstatus_new(NULL, primitive); |
| 301 |
307 |
| 302 if(status_type != NULL) { |
308 if(status_type != NULL) { |
| 303 GList *tmp, *active_accts = purple_accounts_get_all_active(); |
309 PurpleAccountManager *manager = NULL; |
| 304 for (tmp = active_accts; tmp != NULL; tmp = tmp->next) { |
310 GList *active_accts = NULL; |
| 305 purple_savedstatus_set_substatus(saved_status, |
311 |
| 306 (PurpleAccount*) tmp->data, status_type, NULL); |
312 manager = purple_account_manager_get_default(); |
| |
313 active_accts = purple_account_manager_get_active(manager); |
| |
314 |
| |
315 while(active_accts != NULL) { |
| |
316 PurpleAccount *account = PURPLE_ACCOUNT(active_accts->data); |
| |
317 |
| |
318 purple_savedstatus_set_substatus(saved_status, account, |
| |
319 status_type, NULL); |
| |
320 |
| |
321 active_accts = g_list_delete_link(active_accts, active_accts); |
| 307 } |
322 } |
| 308 g_list_free(active_accts); |
|
| 309 } |
323 } |
| 310 |
324 |
| 311 return saved_status; |
325 return saved_status; |
| 312 } |
326 } |
| 313 |
327 |