| 1323 if (timer) |
1323 if (timer) |
| 1324 purple_timeout_remove(timer); |
1324 purple_timeout_remove(timer); |
| 1325 timer = purple_timeout_add_seconds(CLOSE_CONV_TIMEOUT_SECS, close_already, conv); |
1325 timer = purple_timeout_add_seconds(CLOSE_CONV_TIMEOUT_SECS, close_already, conv); |
| 1326 purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(timer)); |
1326 purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(timer)); |
| 1327 } |
1327 } |
| |
1328 #if 0 |
| |
1329 /* I will miss you */ |
| 1328 purple_conversation_set_ui_ops(conv, NULL); |
1330 purple_conversation_set_ui_ops(conv, NULL); |
| |
1331 #else |
| |
1332 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); |
| |
1333 pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv); |
| |
1334 #endif |
| 1329 } |
1335 } |
| 1330 } |
1336 } |
| 1331 |
1337 |
| 1332 static void |
1338 static void |
| 1333 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
1339 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
| 3112 GList *list; |
3118 GList *list; |
| 3113 PidginConversation *gtkconv; |
3119 PidginConversation *gtkconv; |
| 3114 PurpleConversation *conv; |
3120 PurpleConversation *conv; |
| 3115 GtkWidget *item; |
3121 GtkWidget *item; |
| 3116 |
3122 |
| 3117 if (win->window == NULL || win->window == hidden_convwin) |
3123 if (win->window == NULL || win == hidden_convwin) |
| 3118 return; |
3124 return; |
| 3119 |
3125 |
| 3120 gtkconv = pidgin_conv_window_get_active_gtkconv(win); |
3126 gtkconv = pidgin_conv_window_get_active_gtkconv(win); |
| 3121 if (gtkconv == NULL) |
3127 if (gtkconv == NULL) |
| 3122 return; |
3128 return; |
| 5074 static void |
5080 static void |
| 5075 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
5081 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
| 5076 PurpleConversation *conv, PurpleMessageFlags flags) |
5082 PurpleConversation *conv, PurpleMessageFlags flags) |
| 5077 { |
5083 { |
| 5078 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); |
5084 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); |
| |
5085 gboolean hide = FALSE; |
| 5079 |
5086 |
| 5080 /* create hidden conv if hide_new pref is always */ |
5087 /* create hidden conv if hide_new pref is always */ |
| 5081 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0) |
5088 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0) |
| 5082 { |
5089 hide = TRUE; |
| |
5090 |
| |
5091 /* create hidden conv if hide_new pref is away and account is away */ |
| |
5092 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away") == 0 && |
| |
5093 !purple_status_is_available(purple_account_get_active_status(account))) |
| |
5094 hide = TRUE; |
| |
5095 |
| |
5096 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv) && !hide) { |
| |
5097 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
| |
5098 if (gtkconv->win == hidden_convwin) { |
| |
5099 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); |
| |
5100 pidgin_conv_placement_place(gtkconv); |
| |
5101 } |
| |
5102 return; |
| |
5103 } |
| |
5104 |
| |
5105 if (hide) { |
| 5083 ui_ops->create_conversation = pidgin_conv_new_hidden; |
5106 ui_ops->create_conversation = pidgin_conv_new_hidden; |
| 5084 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
5107 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
| 5085 ui_ops->create_conversation = pidgin_conv_new; |
5108 ui_ops->create_conversation = pidgin_conv_new; |
| 5086 return; |
|
| 5087 } |
|
| 5088 |
|
| 5089 /* create hidden conv if hide_new pref is away and account is away */ |
|
| 5090 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away") == 0 && |
|
| 5091 !purple_status_is_available(purple_account_get_active_status(account))) |
|
| 5092 { |
|
| 5093 ui_ops->create_conversation = pidgin_conv_new_hidden; |
|
| 5094 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
|
| 5095 ui_ops->create_conversation = pidgin_conv_new; |
|
| 5096 return; |
|
| 5097 } |
5109 } |
| 5098 } |
5110 } |
| 5099 |
5111 |
| 5100 static void |
5112 static void |
| 5101 pidgin_conv_destroy(PurpleConversation *conv) |
5113 pidgin_conv_destroy(PurpleConversation *conv) |
| 7451 gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv) |
7463 gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv) |
| 7452 { |
7464 { |
| 7453 GList *list; |
7465 GList *list; |
| 7454 PidginConversation *gtkconv; |
7466 PidginConversation *gtkconv; |
| 7455 |
7467 |
| 7456 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
7468 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { |
| 7457 return FALSE; |
7469 gtkconv = PIDGIN_CONVERSATION(conv); |
| |
7470 if (gtkconv->win != hidden_convwin) |
| |
7471 return FALSE; |
| |
7472 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv); |
| |
7473 pidgin_conv_placement_place(gtkconv); |
| |
7474 return TRUE; |
| |
7475 } |
| 7458 |
7476 |
| 7459 pidgin_conv_attach(conv); |
7477 pidgin_conv_attach(conv); |
| 7460 gtkconv = PIDGIN_CONVERSATION(conv); |
7478 gtkconv = PIDGIN_CONVERSATION(conv); |
| 7461 |
7479 |
| 7462 list = purple_conversation_get_message_history(conv); |
7480 list = purple_conversation_get_message_history(conv); |