Mercurial > pidgin
changeset 32260:714e25ef2550
Fix up the Sametime prpl to play nice with Visual C++. This patch also puts
back a username split that was removed just about forever ago. Fixes #14608.
committer: John Bailey <rekkanoryo@rekkanoryo.org>
author | Patrick Cloke |
---|---|
date | Sat, 01 Oct 2011 23:29:40 +0000 |
parents | 2dd117990702 |
children | 952120a8ee02 |
files | libpurple/protocols/sametime/sametime.c |
diffstat | 1 files changed, 93 insertions(+), 115 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/sametime/sametime.c Sat Oct 01 23:20:49 2011 +0000 +++ b/libpurple/protocols/sametime/sametime.c Sat Oct 01 23:29:40 2011 +0000 @@ -171,10 +171,10 @@ /* debugging output */ -#define DEBUG_ERROR(a...) purple_debug_error(G_LOG_DOMAIN, a) -#define DEBUG_INFO(a...) purple_debug_info(G_LOG_DOMAIN, a) -#define DEBUG_MISC(a...) purple_debug_misc(G_LOG_DOMAIN, a) -#define DEBUG_WARN(a...) purple_debug_warning(G_LOG_DOMAIN, a) +#define DEBUG_ERROR(...) purple_debug_error(G_LOG_DOMAIN, __VA_ARGS__) +#define DEBUG_INFO(...) purple_debug_info(G_LOG_DOMAIN, __VA_ARGS__) +#define DEBUG_MISC(...) purple_debug_misc(G_LOG_DOMAIN, __VA_ARGS__) +#define DEBUG_WARN(...) purple_debug_warning(G_LOG_DOMAIN, __VA_ARGS__) /** ensure non-null strings */ @@ -927,6 +927,11 @@ return NULL; } + if (!name) { + DEBUG_WARN("Can't ensure a null group\n"); + return NULL; + } + DEBUG_INFO("attempting to ensure group %s, called %s\n", NSTR(name), NSTR(alias)); @@ -2219,7 +2224,7 @@ static void ft_send(struct mwFileTransfer *ft, FILE *fp) { guchar buf[MW_FT_LEN]; - struct mwOpaque o = { .data = buf, .len = MW_FT_LEN }; + struct mwOpaque o = { MW_FT_LEN, buf }; guint32 rem; PurpleXfer *xfer; @@ -3689,49 +3694,6 @@ static void mw_prpl_login(PurpleAccount *acct); -static void prompt_host_cancel_cb(PurpleConnection *gc) { - const char *msg = _("No Sametime Community Server specified"); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - msg); -} - - -static void prompt_host_ok_cb(PurpleConnection *gc, const char *host) { - if(host && *host) { - PurpleAccount *acct = purple_connection_get_account(gc); - purple_account_set_string(acct, MW_KEY_HOST, host); - mw_prpl_login(acct); - - } else { - prompt_host_cancel_cb(gc); - } -} - - -static void prompt_host(PurpleConnection *gc) { - PurpleAccount *acct; - const char *msgA; - char *msg; - - acct = purple_connection_get_account(gc); - msgA = _("No host or IP address has been configured for the" - " Meanwhile account %s. Please enter one below to" - " continue logging in."); - msg = g_strdup_printf(msgA, NSTR(purple_account_get_username(acct))); - - purple_request_input(gc, _("Meanwhile Connection Setup"), - _("No Sametime Community Server Specified"), msg, - MW_PLUGIN_DEFAULT_HOST, FALSE, FALSE, NULL, - _("Connect"), G_CALLBACK(prompt_host_ok_cb), - _("Cancel"), G_CALLBACK(prompt_host_cancel_cb), - acct, NULL, NULL, - gc); - - g_free(msg); -} - - static void mw_prpl_login(PurpleAccount *account) { PurpleConnection *gc; struct mwPurplePluginData *pd; @@ -3763,7 +3725,9 @@ /* somehow, we don't have a host to connect to. Well, we need one to actually continue, so let's ask the user directly. */ g_free(user); - prompt_host(gc); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, + _("A server is required to connect this account")); return; } @@ -5155,67 +5119,80 @@ static PurplePluginProtocolInfo mw_prpl_info = { - .options = OPT_PROTO_IM_IMAGE, - .user_splits = NULL, /*< set in mw_plugin_init */ - .protocol_options = NULL, /*< set in mw_plugin_init */ - .icon_spec = NO_BUDDY_ICONS, - .list_icon = mw_prpl_list_icon, - .list_emblem = mw_prpl_list_emblem, - .status_text = mw_prpl_status_text, - .tooltip_text = mw_prpl_tooltip_text, - .status_types = mw_prpl_status_types, - .blist_node_menu = mw_prpl_blist_node_menu, - .chat_info = mw_prpl_chat_info, - .chat_info_defaults = mw_prpl_chat_info_defaults, - .login = mw_prpl_login, - .close = mw_prpl_close, - .send_im = mw_prpl_send_im, - .set_info = NULL, - .send_typing = mw_prpl_send_typing, - .get_info = mw_prpl_get_info, - .set_status = mw_prpl_set_status, - .set_idle = mw_prpl_set_idle, - .change_passwd = NULL, - .add_buddy = mw_prpl_add_buddy, - .add_buddies = mw_prpl_add_buddies, - .remove_buddy = mw_prpl_remove_buddy, - .remove_buddies = NULL, - .add_permit = mw_prpl_add_permit, - .add_deny = mw_prpl_add_deny, - .rem_permit = mw_prpl_rem_permit, - .rem_deny = mw_prpl_rem_deny, - .set_permit_deny = mw_prpl_set_permit_deny, - .join_chat = mw_prpl_join_chat, - .reject_chat = mw_prpl_reject_chat, - .get_chat_name = mw_prpl_get_chat_name, - .chat_invite = mw_prpl_chat_invite, - .chat_leave = mw_prpl_chat_leave, - .chat_whisper = mw_prpl_chat_whisper, - .chat_send = mw_prpl_chat_send, - .keepalive = mw_prpl_keepalive, - .register_user = NULL, - .get_cb_info = NULL, - .get_cb_away = NULL, - .alias_buddy = mw_prpl_alias_buddy, - .group_buddy = mw_prpl_group_buddy, - .rename_group = mw_prpl_rename_group, - .buddy_free = mw_prpl_buddy_free, - .convo_closed = mw_prpl_convo_closed, - .normalize = mw_prpl_normalize, - .set_buddy_icon = NULL, - .remove_group = mw_prpl_remove_group, - .get_cb_real_name = NULL, - .set_chat_topic = NULL, - .find_blist_chat = NULL, - .roomlist_get_list = NULL, - .roomlist_expand_category = NULL, - .can_receive_file = mw_prpl_can_receive_file, - .send_file = mw_prpl_send_file, - .new_xfer = mw_prpl_new_xfer, - .offline_message = NULL, - .whiteboard_prpl_ops = NULL, - .send_raw = NULL, - .struct_size = sizeof(PurplePluginProtocolInfo) + OPT_PROTO_IM_IMAGE, + NULL, /*< set in mw_plugin_init */ + NULL, /*< set in mw_plugin_init */ + NO_BUDDY_ICONS, + mw_prpl_list_icon, + mw_prpl_list_emblem, + mw_prpl_status_text, + mw_prpl_tooltip_text, + mw_prpl_status_types, + mw_prpl_blist_node_menu, + mw_prpl_chat_info, + mw_prpl_chat_info_defaults, + mw_prpl_login, + mw_prpl_close, + mw_prpl_send_im, + NULL, + mw_prpl_send_typing, + mw_prpl_get_info, + mw_prpl_set_status, + mw_prpl_set_idle, + NULL, + mw_prpl_add_buddy, + mw_prpl_add_buddies, + mw_prpl_remove_buddy, + NULL, + mw_prpl_add_permit, + mw_prpl_add_deny, + mw_prpl_rem_permit, + mw_prpl_rem_deny, + mw_prpl_set_permit_deny, + mw_prpl_join_chat, + mw_prpl_reject_chat, + mw_prpl_get_chat_name, + mw_prpl_chat_invite, + mw_prpl_chat_leave, + mw_prpl_chat_whisper, + mw_prpl_chat_send, + mw_prpl_keepalive, + NULL, + NULL, + NULL, + mw_prpl_alias_buddy, + mw_prpl_group_buddy, + mw_prpl_rename_group, + mw_prpl_buddy_free, + mw_prpl_convo_closed, + mw_prpl_normalize, + NULL, + mw_prpl_remove_group, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + mw_prpl_can_receive_file, + mw_prpl_send_file, + mw_prpl_new_xfer, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + sizeof(PurplePluginProtocolInfo), + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL }; @@ -5792,6 +5769,7 @@ static void mw_plugin_init(PurplePlugin *plugin) { + PurpleAccountUserSplit *split; PurpleAccountOption *opt; GList *l = NULL; @@ -5802,15 +5780,15 @@ purple_prefs_add_none(MW_PRPL_OPT_BASE); purple_prefs_add_int(MW_PRPL_OPT_BLIST_ACTION, BLIST_CHOICE_DEFAULT); + /* set up account ID as user:server */ + split = purple_account_user_split_new(_("Server"), + MW_PLUGIN_DEFAULT_HOST, ':'); + mw_prpl_info.user_splits = g_list_append(mw_prpl_info.user_splits, split); + /* remove dead preferences */ purple_prefs_remove(MW_PRPL_OPT_PSYCHIC); purple_prefs_remove(MW_PRPL_OPT_SAVE_DYNAMIC); - /* host to connect to */ - opt = purple_account_option_string_new(_("Server"), MW_KEY_HOST, - MW_PLUGIN_DEFAULT_HOST); - l = g_list_append(l, opt); - /* port to connect to */ opt = purple_account_option_int_new(_("Port"), MW_KEY_PORT, MW_PLUGIN_DEFAULT_PORT);