| 5040 static void |
5040 static void |
| 5041 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
5041 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
| 5042 PurpleConversation *conv, PurpleMessageFlags flags) |
5042 PurpleConversation *conv, PurpleMessageFlags flags) |
| 5043 { |
5043 { |
| 5044 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); |
5044 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); |
| 5045 |
5045 if (conv != NULL) |
| 5046 /* XXX sadrul: set _ui_ops for the conversation to NULL, and get rid of the hidden convwindow */ |
5046 return; |
| |
5047 |
| 5047 /* create hidden conv if hide_new pref is always */ |
5048 /* create hidden conv if hide_new pref is always */ |
| 5048 /* or if hide_new pref is away and account is away */ |
5049 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0) |
| 5049 if ((strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0) || |
5050 { |
| 5050 (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away") == 0 && |
5051 ui_ops->create_conversation = pidgin_conv_new_hidden; |
| 5051 !purple_status_is_available(purple_account_get_active_status(account)))) { |
5052 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
| 5052 if (!conv) { |
5053 ui_ops->create_conversation = pidgin_conv_new; |
| 5053 ui_ops->create_conversation = NULL; |
5054 return; |
| 5054 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
5055 } |
| 5055 purple_conversation_set_ui_ops(conv, NULL); |
5056 |
| 5056 ui_ops->create_conversation = pidgin_conv_new; |
5057 /* create hidden conv if hide_new pref is away and account is away */ |
| 5057 } |
5058 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away") == 0 && |
| 5058 } else { |
5059 !purple_status_is_available(purple_account_get_active_status(account))) |
| 5059 /* new message for an IM */ |
5060 { |
| 5060 if (conv && conv->type == PURPLE_CONV_TYPE_IM) |
5061 ui_ops->create_conversation = pidgin_conv_new_hidden; |
| 5061 pidgin_conv_attach_to_conversation(conv); |
5062 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
| |
5063 ui_ops->create_conversation = pidgin_conv_new; |
| |
5064 return; |
| 5062 } |
5065 } |
| 5063 } |
5066 } |
| 5064 |
5067 |
| 5065 static void |
5068 static void |
| 5066 pidgin_conv_destroy(PurpleConversation *conv) |
5069 pidgin_conv_destroy(PurpleConversation *conv) |