| 2720 PurpleAccount *account; |
2720 PurpleAccount *account; |
| 2721 const char *name; |
2721 const char *name; |
| 2722 PurpleConnection *gc; |
2722 PurpleConnection *gc; |
| 2723 PurpleChat *chat; |
2723 PurpleChat *chat; |
| 2724 GHashTable *hash = NULL; |
2724 GHashTable *hash = NULL; |
| |
2725 PurpleConversation *conv; |
| 2725 |
2726 |
| 2726 account = purple_request_fields_get_account(fields, "account"); |
2727 account = purple_request_fields_get_account(fields, "account"); |
| 2727 name = purple_request_fields_get_string(fields, "chat"); |
2728 name = purple_request_fields_get_string(fields, "chat"); |
| 2728 |
2729 |
| 2729 if (!purple_account_is_connected(account)) |
2730 if (!purple_account_is_connected(account)) |
| 2730 return; |
2731 return; |
| 2731 |
2732 |
| 2732 gc = purple_account_get_connection(account); |
2733 gc = purple_account_get_connection(account); |
| 2733 purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); |
2734 /* Create a new conversation now. This will give focus to the new window. |
| |
2735 * But it's necessary to pretend that we left the chat, because otherwise |
| |
2736 * a new conversation window will pop up when we finally join the chat. */ |
| |
2737 if (!(conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, name, account))) { |
| |
2738 conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); |
| |
2739 purple_conv_chat_left(PURPLE_CONV_CHAT(conv)); |
| |
2740 } else { |
| |
2741 purple_conversation_present(conv); |
| |
2742 } |
| |
2743 |
| 2734 chat = purple_blist_find_chat(account, name); |
2744 chat = purple_blist_find_chat(account, name); |
| 2735 if (chat == NULL) { |
2745 if (chat == NULL) { |
| 2736 PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
2746 PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
| 2737 if (info->chat_info_defaults != NULL) |
2747 if (info->chat_info_defaults != NULL) |
| 2738 hash = info->chat_info_defaults(gc, name); |
2748 hash = info->chat_info_defaults(gc, name); |