Mercurial > pidgin.yaz
diff libpurple/protocols/msn/msn.c @ 15823:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 71af5b6209d5 |
children | 391a79778f89 08db93bbd798 60bc06498746 4a099e4d0d09 be098f796b32 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c Mon Mar 19 06:11:46 2007 +0000 +++ b/libpurple/protocols/msn/msn.c Mon Mar 19 07:01:17 2007 +0000 @@ -1,9 +1,9 @@ /** * @file msn.c The MSN protocol plugin * - * gaim + * purple * - * Gaim is the legal property of its developers, whose names are too numerous + * Purple is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * @@ -51,14 +51,14 @@ typedef struct { - GaimConnection *gc; + PurpleConnection *gc; const char *passport; } MsnMobileData; typedef struct { - GaimConnection *gc; + PurpleConnection *gc; char *name; } MsnGetInfoData; @@ -68,13 +68,13 @@ MsnGetInfoData *info_data; char *stripped; char *url_buffer; - GaimNotifyUserInfo *user_info; + PurpleNotifyUserInfo *user_info; char *photo_url_text; } MsnGetInfoStepTwoData; static const char * -msn_normalize(const GaimAccount *account, const char *str) +msn_normalize(const PurpleAccount *account, const char *str) { static char buf[BUF_LEN]; char *tmp; @@ -91,60 +91,60 @@ return buf; } -static GaimCmdRet -msn_cmd_nudge(GaimConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) +static PurpleCmdRet +msn_cmd_nudge(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) { - GaimAccount *account = gaim_conversation_get_account(conv); - GaimConnection *gc = gaim_account_get_connection(account); + PurpleAccount *account = purple_conversation_get_account(conv); + PurpleConnection *gc = purple_account_get_connection(account); MsnMessage *msg; MsnSession *session; MsnSwitchBoard *swboard; msg = msn_message_new_nudge(); session = gc->proto_data; - swboard = msn_session_get_swboard(session, gaim_conversation_get_name(conv), MSN_SB_FLAG_IM); + swboard = msn_session_get_swboard(session, purple_conversation_get_name(conv), MSN_SB_FLAG_IM); if (swboard == NULL) - return GAIM_CMD_RET_FAILED; + return PURPLE_CMD_RET_FAILED; msn_switchboard_send_msg(swboard, msg, TRUE); - gaim_conversation_write(conv, NULL, _("You have just sent a Nudge!"), GAIM_MESSAGE_SYSTEM, time(NULL)); + purple_conversation_write(conv, NULL, _("You have just sent a Nudge!"), PURPLE_MESSAGE_SYSTEM, time(NULL)); - return GAIM_CMD_RET_OK; + return PURPLE_CMD_RET_OK; } static void -msn_act_id(GaimConnection *gc, const char *entry) +msn_act_id(PurpleConnection *gc, const char *entry) { MsnCmdProc *cmdproc; MsnSession *session; - GaimAccount *account; + PurpleAccount *account; const char *alias; session = gc->proto_data; cmdproc = session->notification->cmdproc; - account = gaim_connection_get_account(gc); + account = purple_connection_get_account(gc); if(entry && strlen(entry)) - alias = gaim_url_encode(entry); + alias = purple_url_encode(entry); else alias = ""; if (strlen(alias) > BUDDY_ALIAS_MAXLEN) { - gaim_notify_error(gc, NULL, + purple_notify_error(gc, NULL, _("Your new MSN friendly name is too long."), NULL); return; } msn_cmdproc_send(cmdproc, "REA", "%s %s", - gaim_account_get_username(account), + purple_account_get_username(account), alias); } static void -msn_set_prp(GaimConnection *gc, const char *type, const char *entry) +msn_set_prp(PurpleConnection *gc, const char *type, const char *entry) { MsnCmdProc *cmdproc; MsnSession *session; @@ -159,42 +159,42 @@ else { msn_cmdproc_send(cmdproc, "PRP", "%s %s", type, - gaim_url_encode(entry)); + purple_url_encode(entry)); } } static void -msn_set_home_phone_cb(GaimConnection *gc, const char *entry) +msn_set_home_phone_cb(PurpleConnection *gc, const char *entry) { msn_set_prp(gc, "PHH", entry); } static void -msn_set_work_phone_cb(GaimConnection *gc, const char *entry) +msn_set_work_phone_cb(PurpleConnection *gc, const char *entry) { msn_set_prp(gc, "PHW", entry); } static void -msn_set_mobile_phone_cb(GaimConnection *gc, const char *entry) +msn_set_mobile_phone_cb(PurpleConnection *gc, const char *entry) { msn_set_prp(gc, "PHM", entry); } static void -enable_msn_pages_cb(GaimConnection *gc) +enable_msn_pages_cb(PurpleConnection *gc) { msn_set_prp(gc, "MOB", "Y"); } static void -disable_msn_pages_cb(GaimConnection *gc) +disable_msn_pages_cb(PurpleConnection *gc) { msn_set_prp(gc, "MOB", "N"); } static void -send_to_mobile(GaimConnection *gc, const char *who, const char *entry) +send_to_mobile(PurpleConnection *gc, const char *who, const char *entry) { MsnTransaction *trans; MsnSession *session; @@ -236,73 +236,73 @@ /* -- */ static void -msn_show_set_friendly_name(GaimPluginAction *action) +msn_show_set_friendly_name(PurplePluginAction *action) { - GaimConnection *gc; + PurpleConnection *gc; - gc = (GaimConnection *) action->context; + gc = (PurpleConnection *) action->context; - gaim_request_input(gc, NULL, _("Set your friendly name."), + purple_request_input(gc, NULL, _("Set your friendly name."), _("This is the name that other MSN buddies will " "see you as."), - gaim_connection_get_display_name(gc), FALSE, FALSE, NULL, + purple_connection_get_display_name(gc), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(msn_act_id), _("Cancel"), NULL, gc); } static void -msn_show_set_home_phone(GaimPluginAction *action) +msn_show_set_home_phone(PurplePluginAction *action) { - GaimConnection *gc; + PurpleConnection *gc; MsnSession *session; - gc = (GaimConnection *) action->context; + gc = (PurpleConnection *) action->context; session = gc->proto_data; - gaim_request_input(gc, NULL, _("Set your home phone number."), NULL, + purple_request_input(gc, NULL, _("Set your home phone number."), NULL, msn_user_get_home_phone(session->user), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(msn_set_home_phone_cb), _("Cancel"), NULL, gc); } static void -msn_show_set_work_phone(GaimPluginAction *action) +msn_show_set_work_phone(PurplePluginAction *action) { - GaimConnection *gc; + PurpleConnection *gc; MsnSession *session; - gc = (GaimConnection *) action->context; + gc = (PurpleConnection *) action->context; session = gc->proto_data; - gaim_request_input(gc, NULL, _("Set your work phone number."), NULL, + purple_request_input(gc, NULL, _("Set your work phone number."), NULL, msn_user_get_work_phone(session->user), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(msn_set_work_phone_cb), _("Cancel"), NULL, gc); } static void -msn_show_set_mobile_phone(GaimPluginAction *action) +msn_show_set_mobile_phone(PurplePluginAction *action) { - GaimConnection *gc; + PurpleConnection *gc; MsnSession *session; - gc = (GaimConnection *) action->context; + gc = (PurpleConnection *) action->context; session = gc->proto_data; - gaim_request_input(gc, NULL, _("Set your mobile phone number."), NULL, + purple_request_input(gc, NULL, _("Set your mobile phone number."), NULL, msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), _("Cancel"), NULL, gc); } static void -msn_show_set_mobile_pages(GaimPluginAction *action) +msn_show_set_mobile_pages(PurplePluginAction *action) { - GaimConnection *gc; + PurpleConnection *gc; - gc = (GaimConnection *) action->context; + gc = (PurpleConnection *) action->context; - gaim_request_action(gc, NULL, _("Allow MSN Mobile pages?"), + purple_request_action(gc, NULL, _("Allow MSN Mobile pages?"), _("Do you want to allow or disallow people on " "your buddy list to send you MSN Mobile pages " "to your cell phone or other mobile device?"), @@ -313,36 +313,36 @@ } static void -msn_show_hotmail_inbox(GaimPluginAction *action) +msn_show_hotmail_inbox(PurplePluginAction *action) { - GaimConnection *gc; + PurpleConnection *gc; MsnSession *session; - gc = (GaimConnection *) action->context; + gc = (PurpleConnection *) action->context; session = gc->proto_data; if (session->passport_info.file == NULL) { - gaim_notify_error(gc, NULL, + purple_notify_error(gc, NULL, _("This Hotmail account may not be active."), NULL); return; } - gaim_notify_uri(gc, session->passport_info.file); + purple_notify_uri(gc, session->passport_info.file); } static void -show_send_to_mobile_cb(GaimBlistNode *node, gpointer ignored) +show_send_to_mobile_cb(PurpleBlistNode *node, gpointer ignored) { - GaimBuddy *buddy; - GaimConnection *gc; + PurpleBuddy *buddy; + PurpleConnection *gc; MsnSession *session; MsnMobileData *data; - g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); + g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - buddy = (GaimBuddy *) node; - gc = gaim_account_get_connection(buddy->account); + buddy = (PurpleBuddy *) node; + gc = purple_account_get_connection(buddy->account); session = gc->proto_data; @@ -350,7 +350,7 @@ data->gc = gc; data->passport = buddy->name; - gaim_request_input(gc, NULL, _("Send a mobile message."), NULL, + purple_request_input(gc, NULL, _("Send a mobile message."), NULL, NULL, TRUE, FALSE, NULL, _("Page"), G_CALLBACK(send_to_mobile_cb), _("Close"), G_CALLBACK(close_mobile_page_cb), @@ -358,18 +358,18 @@ } static void -initiate_chat_cb(GaimBlistNode *node, gpointer data) +initiate_chat_cb(PurpleBlistNode *node, gpointer data) { - GaimBuddy *buddy; - GaimConnection *gc; + PurpleBuddy *buddy; + PurpleConnection *gc; MsnSession *session; MsnSwitchBoard *swboard; - g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); + g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - buddy = (GaimBuddy *) node; - gc = gaim_account_get_connection(buddy->account); + buddy = (PurpleBuddy *) node; + gc = purple_account_get_connection(buddy->account); session = gc->proto_data; @@ -382,24 +382,24 @@ swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat"); swboard->flag = MSN_SB_FLAG_IM; - gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv), - gaim_account_get_username(buddy->account), NULL, GAIM_CBFLAGS_NONE, TRUE); + purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), + purple_account_get_username(buddy->account), NULL, PURPLE_CBFLAGS_NONE, TRUE); } static void -t_msn_xfer_init(GaimXfer *xfer) +t_msn_xfer_init(PurpleXfer *xfer) { MsnSlpLink *slplink; const char *filename; FILE *fp; - filename = gaim_xfer_get_local_filename(xfer); + filename = purple_xfer_get_local_filename(xfer); slplink = xfer->data; if ((fp = g_fopen(filename, "rb")) == NULL) { - GaimAccount *account; + PurpleAccount *account; const char *who; char *msg; @@ -408,8 +408,8 @@ msg = g_strdup_printf(_("Error reading %s: \n%s.\n"), filename, strerror(errno)); - gaim_xfer_error(gaim_xfer_get_type(xfer), account, xfer->who, msg); - gaim_xfer_cancel_local(xfer); + purple_xfer_error(purple_xfer_get_type(xfer), account, xfer->who, msg); + purple_xfer_cancel_local(xfer); g_free(msg); return; @@ -419,49 +419,49 @@ msn_slplink_request_ft(slplink, xfer); } -static GaimXfer* -msn_new_xfer(GaimConnection *gc, const char *who) +static PurpleXfer* +msn_new_xfer(PurpleConnection *gc, const char *who) { MsnSession *session; MsnSlpLink *slplink; - GaimXfer *xfer; + PurpleXfer *xfer; session = gc->proto_data; - xfer = gaim_xfer_new(gc->account, GAIM_XFER_SEND, who); + xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); if (xfer) { slplink = msn_session_get_slplink(session, who); xfer->data = slplink; - gaim_xfer_set_init_fnc(xfer, t_msn_xfer_init); + purple_xfer_set_init_fnc(xfer, t_msn_xfer_init); } return xfer; } static void -msn_send_file(GaimConnection *gc, const char *who, const char *file) +msn_send_file(PurpleConnection *gc, const char *who, const char *file) { - GaimXfer *xfer = msn_new_xfer(gc, who); + PurpleXfer *xfer = msn_new_xfer(gc, who); if (file) - gaim_xfer_request_accepted(xfer, file); + purple_xfer_request_accepted(xfer, file); else - gaim_xfer_request(xfer); + purple_xfer_request(xfer); } static gboolean -msn_can_receive_file(GaimConnection *gc, const char *who) +msn_can_receive_file(PurpleConnection *gc, const char *who) { - GaimAccount *account; + PurpleAccount *account; char *normal; gboolean ret; - account = gaim_connection_get_account(gc); + account = purple_connection_get_account(gc); - normal = g_strdup(msn_normalize(account, gaim_account_get_username(account))); + normal = g_strdup(msn_normalize(account, purple_account_get_username(account))); ret = strcmp(normal, msn_normalize(account, who)); @@ -475,100 +475,100 @@ **************************************************************************/ static const char * -msn_list_icon(GaimAccount *a, GaimBuddy *b) +msn_list_icon(PurpleAccount *a, PurpleBuddy *b) { return "msn"; } static char * -msn_status_text(GaimBuddy *buddy) +msn_status_text(PurpleBuddy *buddy) { - GaimPresence *presence; - GaimStatus *status; + PurplePresence *presence; + PurpleStatus *status; - presence = gaim_buddy_get_presence(buddy); - status = gaim_presence_get_active_status(presence); + presence = purple_buddy_get_presence(buddy); + status = purple_presence_get_active_status(presence); - if (!gaim_presence_is_available(presence) && !gaim_presence_is_idle(presence)) + if (!purple_presence_is_available(presence) && !purple_presence_is_idle(presence)) { - return g_strdup(gaim_status_get_name(status)); + return g_strdup(purple_status_get_name(status)); } return NULL; } static void -msn_tooltip_text(GaimBuddy *buddy, GaimNotifyUserInfo *user_info, gboolean full) +msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full) { MsnUser *user; - GaimPresence *presence = gaim_buddy_get_presence(buddy); - GaimStatus *status = gaim_presence_get_active_status(presence); + PurplePresence *presence = purple_buddy_get_presence(buddy); + PurpleStatus *status = purple_presence_get_active_status(presence); user = buddy->proto_data; - if (gaim_presence_is_online(presence)) + if (purple_presence_is_online(presence)) { - gaim_notify_user_info_add_pair(user_info, _("Status"), - (gaim_presence_is_idle(presence) ? _("Idle") : gaim_status_get_name(status))); + purple_notify_user_info_add_pair(user_info, _("Status"), + (purple_presence_is_idle(presence) ? _("Idle") : purple_status_get_name(status))); } if (full && user) { - gaim_notify_user_info_add_pair(user_info, _("Has you"), + purple_notify_user_info_add_pair(user_info, _("Has you"), ((user->list_op & (1 << MSN_LIST_RL)) ? _("Yes") : _("No"))); } /* XXX: This is being shown in non-full tooltips because the * XXX: blocked icon overlay isn't always accurate for MSN. - * XXX: This can die as soon as gaim_privacy_check() knows that + * XXX: This can die as soon as purple_privacy_check() knows that * XXX: this prpl always honors both the allow and deny lists. */ if (user) { - gaim_notify_user_info_add_pair(user_info, _("Blocked"), + purple_notify_user_info_add_pair(user_info, _("Blocked"), ((user->list_op & (1 << MSN_LIST_BL)) ? _("Yes") : _("No"))); } } static GList * -msn_status_types(GaimAccount *account) +msn_status_types(PurpleAccount *account) { - GaimStatusType *status; + PurpleStatusType *status; GList *types = NULL; - status = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, + status = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, NULL, NULL, FALSE, TRUE, FALSE); types = g_list_append(types, status); - status = gaim_status_type_new_full(GAIM_STATUS_AWAY, + status = purple_status_type_new_full(PURPLE_STATUS_AWAY, NULL, NULL, FALSE, TRUE, FALSE); types = g_list_append(types, status); - status = gaim_status_type_new_full(GAIM_STATUS_AWAY, + status = purple_status_type_new_full(PURPLE_STATUS_AWAY, "brb", _("Be Right Back"), FALSE, TRUE, FALSE); types = g_list_append(types, status); - status = gaim_status_type_new_full(GAIM_STATUS_UNAVAILABLE, + status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, "busy", _("Busy"), FALSE, TRUE, FALSE); types = g_list_append(types, status); - status = gaim_status_type_new_full(GAIM_STATUS_UNAVAILABLE, + status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, "phone", _("On the Phone"), FALSE, TRUE, FALSE); types = g_list_append(types, status); - status = gaim_status_type_new_full(GAIM_STATUS_AWAY, + status = purple_status_type_new_full(PURPLE_STATUS_AWAY, "lunch", _("Out to Lunch"), FALSE, TRUE, FALSE); types = g_list_append(types, status); - status = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE, + status = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, NULL, NULL, FALSE, TRUE, FALSE); types = g_list_append(types, status); - status = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, + status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, NULL, NULL, FALSE, TRUE, FALSE); types = g_list_append(types, status); - status = gaim_status_type_new_full(GAIM_STATUS_MOBILE, + status = purple_status_type_new_full(PURPLE_STATUS_MOBILE, "mobile", NULL, FALSE, FALSE, TRUE); types = g_list_append(types, status); @@ -576,50 +576,50 @@ } static GList * -msn_actions(GaimPlugin *plugin, gpointer context) +msn_actions(PurplePlugin *plugin, gpointer context) { - GaimConnection *gc = (GaimConnection *)context; - GaimAccount *account; + PurpleConnection *gc = (PurpleConnection *)context; + PurpleAccount *account; const char *user; GList *m = NULL; - GaimPluginAction *act; + PurplePluginAction *act; - act = gaim_plugin_action_new(_("Set Friendly Name..."), + act = purple_plugin_action_new(_("Set Friendly Name..."), msn_show_set_friendly_name); m = g_list_append(m, act); m = g_list_append(m, NULL); - act = gaim_plugin_action_new(_("Set Home Phone Number..."), + act = purple_plugin_action_new(_("Set Home Phone Number..."), msn_show_set_home_phone); m = g_list_append(m, act); - act = gaim_plugin_action_new(_("Set Work Phone Number..."), + act = purple_plugin_action_new(_("Set Work Phone Number..."), msn_show_set_work_phone); m = g_list_append(m, act); - act = gaim_plugin_action_new(_("Set Mobile Phone Number..."), + act = purple_plugin_action_new(_("Set Mobile Phone Number..."), msn_show_set_mobile_phone); m = g_list_append(m, act); m = g_list_append(m, NULL); #if 0 - act = gaim_plugin_action_new(_("Enable/Disable Mobile Devices..."), + act = purple_plugin_action_new(_("Enable/Disable Mobile Devices..."), msn_show_set_mobile_support); m = g_list_append(m, act); #endif - act = gaim_plugin_action_new(_("Allow/Disallow Mobile Pages..."), + act = purple_plugin_action_new(_("Allow/Disallow Mobile Pages..."), msn_show_set_mobile_pages); m = g_list_append(m, act); - account = gaim_connection_get_account(gc); - user = msn_normalize(account, gaim_account_get_username(account)); + account = purple_connection_get_account(gc); + user = msn_normalize(account, purple_account_get_username(account)); if (strstr(user, "@hotmail.com") != NULL) { m = g_list_append(m, NULL); - act = gaim_plugin_action_new(_("Open Hotmail Inbox"), + act = purple_plugin_action_new(_("Open Hotmail Inbox"), msn_show_hotmail_inbox); m = g_list_append(m, act); } @@ -628,12 +628,12 @@ } static GList * -msn_buddy_menu(GaimBuddy *buddy) +msn_buddy_menu(PurpleBuddy *buddy) { MsnUser *user; GList *m = NULL; - GaimMenuAction *act; + PurpleMenuAction *act; g_return_val_if_fail(buddy != NULL, NULL); @@ -643,18 +643,18 @@ { if (user->mobile) { - act = gaim_menu_action_new(_("Send to Mobile"), - GAIM_CALLBACK(show_send_to_mobile_cb), + act = purple_menu_action_new(_("Send to Mobile"), + PURPLE_CALLBACK(show_send_to_mobile_cb), NULL, NULL); m = g_list_append(m, act); } } if (g_ascii_strcasecmp(buddy->name, - gaim_account_get_username(buddy->account))) + purple_account_get_username(buddy->account))) { - act = gaim_menu_action_new(_("Initiate _Chat"), - GAIM_CALLBACK(initiate_chat_cb), + act = purple_menu_action_new(_("Initiate _Chat"), + PURPLE_CALLBACK(initiate_chat_cb), NULL, NULL); m = g_list_append(m, act); } @@ -663,11 +663,11 @@ } static GList * -msn_blist_node_menu(GaimBlistNode *node) +msn_blist_node_menu(PurpleBlistNode *node) { - if(GAIM_BLIST_NODE_IS_BUDDY(node)) + if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return msn_buddy_menu((GaimBuddy *) node); + return msn_buddy_menu((PurpleBuddy *) node); } else { @@ -676,51 +676,51 @@ } static void -msn_login(GaimAccount *account) +msn_login(PurpleAccount *account) { - GaimConnection *gc; + PurpleConnection *gc; MsnSession *session; const char *username; const char *host; gboolean http_method = FALSE; int port; - gc = gaim_account_get_connection(account); + gc = purple_account_get_connection(account); - if (!gaim_ssl_is_supported()) + if (!purple_ssl_is_supported()) { gc->wants_to_die = TRUE; - gaim_connection_error(gc, + purple_connection_error(gc, _("SSL support is needed for MSN. Please install a supported " "SSL library.")); return; } - http_method = gaim_account_get_bool(account, "http_method", FALSE); + http_method = purple_account_get_bool(account, "http_method", FALSE); - host = gaim_account_get_string(account, "server", MSN_SERVER); - port = gaim_account_get_int(account, "port", MSN_PORT); + host = purple_account_get_string(account, "server", MSN_SERVER); + port = purple_account_get_int(account, "port", MSN_PORT); session = msn_session_new(account); gc->proto_data = session; - gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_FORMATTING_WBFO | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_NO_FONTSIZE | GAIM_CONNECTION_NO_URLDESC; + gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC; msn_session_set_login_step(session, MSN_LOGIN_STEP_START); /* Hmm, I don't like this. */ /* XXX shx: Me neither */ - username = msn_normalize(account, gaim_account_get_username(account)); + username = msn_normalize(account, purple_account_get_username(account)); - if (strcmp(username, gaim_account_get_username(account))) - gaim_account_set_username(account, username); + if (strcmp(username, purple_account_get_username(account))) + purple_account_set_username(account, username); if (!msn_session_connect(session, host, port, http_method)) - gaim_connection_error(gc, _("Failed to connect to server.")); + purple_connection_error(gc, _("Failed to connect to server.")); } static void -msn_close(GaimConnection *gc) +msn_close(PurpleConnection *gc) { MsnSession *session; @@ -734,21 +734,21 @@ } static int -msn_send_im(GaimConnection *gc, const char *who, const char *message, - GaimMessageFlags flags) +msn_send_im(PurpleConnection *gc, const char *who, const char *message, + PurpleMessageFlags flags) { - GaimAccount *account; - GaimBuddy *buddy = gaim_find_buddy(gc->account, who); + PurpleAccount *account; + PurpleBuddy *buddy = purple_find_buddy(gc->account, who); MsnMessage *msg; char *msgformat; char *msgtext; - account = gaim_connection_get_account(gc); + account = purple_connection_get_account(gc); if (buddy) { - GaimPresence *p = gaim_buddy_get_presence(buddy); - if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_MOBILE)) { - char *text = gaim_markup_strip_html(message); + PurplePresence *p = purple_buddy_get_presence(buddy); + if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) { + char *text = purple_markup_strip_html(message); send_to_mobile(gc, who, text); g_free(text); return 1; @@ -771,7 +771,7 @@ g_free(msgformat); g_free(msgtext); - if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) + if (g_ascii_strcasecmp(who, purple_account_get_username(account))) { MsnSession *session; MsnSwitchBoard *swboard; @@ -812,28 +812,28 @@ } static unsigned int -msn_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) +msn_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) { - GaimAccount *account; + PurpleAccount *account; MsnSession *session; MsnSwitchBoard *swboard; MsnMessage *msg; - account = gaim_connection_get_account(gc); + account = purple_connection_get_account(gc); session = gc->proto_data; /* - * TODO: I feel like this should be "if (state != GAIM_TYPING)" + * TODO: I feel like this should be "if (state != PURPLE_TYPING)" * but this is how it was before, and I don't want to break * anything. --KingAnt */ - if (state == GAIM_NOT_TYPING) + if (state == PURPLE_NOT_TYPING) return 0; - if (!g_ascii_strcasecmp(who, gaim_account_get_username(account))) + if (!g_ascii_strcasecmp(who, purple_account_get_username(account))) { /* We'll just fake it, since we're sending to ourself. */ - serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, GAIM_TYPING); + serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, PURPLE_TYPING); return MSN_TYPING_SEND_TIMEOUT; } @@ -849,7 +849,7 @@ msn_message_set_content_type(msg, "text/x-msmsgscontrol"); msn_message_set_flag(msg, 'U'); msn_message_set_attr(msg, "TypingUser", - gaim_account_get_username(account)); + purple_account_get_username(account)); msn_message_set_bin_data(msg, "\r\n", 2); msn_switchboard_send_msg(swboard, msg, FALSE); @@ -860,12 +860,12 @@ } static void -msn_set_status(GaimAccount *account, GaimStatus *status) +msn_set_status(PurpleAccount *account, PurpleStatus *status) { - GaimConnection *gc; + PurpleConnection *gc; MsnSession *session; - gc = gaim_account_get_connection(account); + gc = purple_account_get_connection(account); if (gc != NULL) { @@ -875,7 +875,7 @@ } static void -msn_set_idle(GaimConnection *gc, int idle) +msn_set_idle(PurpleConnection *gc, int idle) { MsnSession *session; @@ -935,7 +935,7 @@ #endif static void -msn_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) +msn_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { MsnSession *session; MsnUserList *userlist; @@ -951,7 +951,7 @@ fake_userlist_add_buddy(session->sync_userlist, who, MSN_LIST_FL, group ? group->name : NULL); #else - gaim_debug_error("msn", "msn_add_buddy called before connected\n"); + purple_debug_error("msn", "msn_add_buddy called before connected\n"); #endif return; @@ -959,18 +959,18 @@ #if 0 if (group != NULL && group->name != NULL) - gaim_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name); + purple_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name); else - gaim_debug_info("msn", "msn_add_buddy: %s\n", who); + purple_debug_info("msn", "msn_add_buddy: %s\n", who); #endif #if 0 /* Which is the max? */ if (session->fl_users_count >= 150) { - gaim_debug_info("msn", "Too many buddies\n"); + purple_debug_info("msn", "Too many buddies\n"); /* Buddy list full */ - /* TODO: gaim should be notified of this */ + /* TODO: purple should be notified of this */ return; } #endif @@ -983,7 +983,7 @@ } static void -msn_rem_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) +msn_rem_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { MsnSession *session; MsnUserList *userlist; @@ -999,7 +999,7 @@ } static void -msn_add_permit(GaimConnection *gc, const char *who) +msn_add_permit(PurpleConnection *gc, const char *who) { MsnSession *session; MsnUserList *userlist; @@ -1019,7 +1019,7 @@ } static void -msn_add_deny(GaimConnection *gc, const char *who) +msn_add_deny(PurpleConnection *gc, const char *who) { MsnSession *session; MsnUserList *userlist; @@ -1039,7 +1039,7 @@ } static void -msn_rem_permit(GaimConnection *gc, const char *who) +msn_rem_permit(PurpleConnection *gc, const char *who) { MsnSession *session; MsnUserList *userlist; @@ -1060,7 +1060,7 @@ } static void -msn_rem_deny(GaimConnection *gc, const char *who) +msn_rem_deny(PurpleConnection *gc, const char *who) { MsnSession *session; MsnUserList *userlist; @@ -1081,18 +1081,18 @@ } static void -msn_set_permit_deny(GaimConnection *gc) +msn_set_permit_deny(PurpleConnection *gc) { - GaimAccount *account; + PurpleAccount *account; MsnSession *session; MsnCmdProc *cmdproc; - account = gaim_connection_get_account(gc); + account = purple_connection_get_account(gc); session = gc->proto_data; cmdproc = session->notification->cmdproc; - if (account->perm_deny == GAIM_PRIVACY_ALLOW_ALL || - account->perm_deny == GAIM_PRIVACY_DENY_USERS) + if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL || + account->perm_deny == PURPLE_PRIVACY_DENY_USERS) { msn_cmdproc_send(cmdproc, "BLP", "%s", "AL"); } @@ -1103,7 +1103,7 @@ } static void -msn_chat_invite(GaimConnection *gc, int id, const char *msg, +msn_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *who) { MsnSession *session; @@ -1119,7 +1119,7 @@ swboard = msn_switchboard_new(session); msn_switchboard_request(swboard); swboard->chat_id = id; - swboard->conv = gaim_find_chat(gc, id); + swboard->conv = purple_find_chat(gc, id); } swboard->flag |= MSN_SB_FLAG_IM; @@ -1128,11 +1128,11 @@ } static void -msn_chat_leave(GaimConnection *gc, int id) +msn_chat_leave(PurpleConnection *gc, int id) { MsnSession *session; MsnSwitchBoard *swboard; - GaimConversation *conv; + PurpleConversation *conv; session = gc->proto_data; @@ -1156,16 +1156,16 @@ } static int -msn_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) +msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) { - GaimAccount *account; + PurpleAccount *account; MsnSession *session; MsnSwitchBoard *swboard; MsnMessage *msg; char *msgformat; char *msgtext; - account = gaim_connection_get_account(gc); + account = purple_connection_get_account(gc); session = gc->proto_data; swboard = msn_session_find_swboard_with_id(session, id); @@ -1195,14 +1195,14 @@ g_free(msgformat); g_free(msgtext); - serv_got_chat_in(gc, id, gaim_account_get_username(account), 0, + serv_got_chat_in(gc, id, purple_account_get_username(account), 0, message, time(NULL)); return 0; } static void -msn_keepalive(GaimConnection *gc) +msn_keepalive(PurpleConnection *gc) { MsnSession *session; @@ -1219,7 +1219,7 @@ } static void -msn_group_buddy(GaimConnection *gc, const char *who, +msn_group_buddy(PurpleConnection *gc, const char *who, const char *old_group_name, const char *new_group_name) { MsnSession *session; @@ -1232,8 +1232,8 @@ } static void -msn_rename_group(GaimConnection *gc, const char *old_name, - GaimGroup *group, GList *moved_buddies) +msn_rename_group(PurpleConnection *gc, const char *old_name, + PurpleGroup *group, GList *moved_buddies) { MsnSession *session; MsnCmdProc *cmdproc; @@ -1242,7 +1242,7 @@ session = gc->proto_data; cmdproc = session->notification->cmdproc; - enc_new_group_name = gaim_url_encode(group->name); + enc_new_group_name = purple_url_encode(group->name); old_gid = msn_userlist_find_group_id(session->userlist, old_name); @@ -1258,11 +1258,11 @@ } static void -msn_convo_closed(GaimConnection *gc, const char *who) +msn_convo_closed(PurpleConnection *gc, const char *who) { MsnSession *session; MsnSwitchBoard *swboard; - GaimConversation *conv; + PurpleConversation *conv; session = gc->proto_data; @@ -1290,7 +1290,7 @@ } static void -msn_set_buddy_icon(GaimConnection *gc, const char *filename) +msn_set_buddy_icon(PurpleConnection *gc, const char *filename) { MsnSession *session; MsnUser *user; @@ -1304,7 +1304,7 @@ } static void -msn_remove_group(GaimConnection *gc, GaimGroup *group) +msn_remove_group(PurpleConnection *gc, PurpleGroup *group) { MsnSession *session; MsnCmdProc *cmdproc; @@ -1323,11 +1323,11 @@ * Extract info text from info_data and add it to user_info */ static gboolean -msn_tooltip_extract_info_text(GaimNotifyUserInfo *user_info, MsnGetInfoData *info_data) +msn_tooltip_extract_info_text(PurpleNotifyUserInfo *user_info, MsnGetInfoData *info_data) { - GaimBuddy *b; + PurpleBuddy *b; - b = gaim_find_buddy(gaim_connection_get_account(info_data->gc), + b = purple_find_buddy(purple_connection_get_account(info_data->gc), info_data->name); if (b) @@ -1337,7 +1337,7 @@ if (b->alias && b->alias[0]) { char *aliastext = g_markup_escape_text(b->alias, -1); - gaim_notify_user_info_add_pair(user_info, _("Alias"), aliastext); + purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext); g_free(aliastext); } @@ -1345,7 +1345,7 @@ { char *nicktext = g_markup_escape_text(b->server_alias, -1); tmp = g_strdup_printf("<font sml=\"msn\">%s</font><br>", nicktext); - gaim_notify_user_info_add_pair(user_info, _("Nickname"), tmp); + purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); g_free(tmp); g_free(nicktext); } @@ -1377,7 +1377,7 @@ return NULL; } -static void msn_got_photo(GaimUtilFetchUrlData *url_data, gpointer data, +static void msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, const gchar *url_text, size_t len, const gchar *error_message); #endif @@ -1386,25 +1386,25 @@ static char *msn_info_date_reformat(const char *field, size_t len) { char *tmp = g_strndup(field, len); - time_t t = gaim_str_to_time(tmp, FALSE, NULL, NULL, NULL); + time_t t = purple_str_to_time(tmp, FALSE, NULL, NULL, NULL); g_free(tmp); - return g_strdup(gaim_date_format_short(localtime(&t))); + return g_strdup(purple_date_format_short(localtime(&t))); } #endif #define MSN_GOT_INFO_GET_FIELD(a, b) \ - found = gaim_markup_extract_info_field(stripped, stripped_len, user_info, \ + found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, NULL); \ if (found) \ sect_info = TRUE; static void -msn_got_info(GaimUtilFetchUrlData *url_data, gpointer data, +msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, const gchar *url_text, size_t len, const gchar *error_message) { MsnGetInfoData *info_data = (MsnGetInfoData *)data; - GaimNotifyUserInfo *user_info; + PurpleNotifyUserInfo *user_info; char *stripped, *p, *q, *tmp; char *user_url = NULL; gboolean found; @@ -1420,28 +1420,28 @@ MsnGetInfoStepTwoData *info2_data = NULL; #endif - gaim_debug_info("msn", "In msn_got_info\n"); + purple_debug_info("msn", "In msn_got_info\n"); /* Make sure the connection is still valid */ - if (g_list_find(gaim_connections_get_all(), info_data->gc) == NULL) + if (g_list_find(purple_connections_get_all(), info_data->gc) == NULL) { - gaim_debug_warning("msn", "invalid connection. ignoring buddy info.\n"); + purple_debug_warning("msn", "invalid connection. ignoring buddy info.\n"); g_free(info_data->name); g_free(info_data); return; } - user_info = gaim_notify_user_info_new(); + user_info = purple_notify_user_info_new(); has_tooltip_text = msn_tooltip_extract_info_text(user_info, info_data); if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) { tmp = g_strdup_printf("<b>%s</b>", _("Error retrieving profile")); - gaim_notify_user_info_add_pair(user_info, NULL, tmp); + purple_notify_user_info_add_pair(user_info, NULL, tmp); g_free(tmp); - gaim_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); - gaim_notify_user_info_destroy(user_info); + purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); + purple_notify_user_info_destroy(user_info); g_free(info_data->name); g_free(info_data); @@ -1451,7 +1451,7 @@ url_buffer = g_strdup(url_text); /* If they have a homepage link, MSN masks it such that we need to - * fetch the url out before gaim_markup_strip_html() nukes it */ + * fetch the url out before purple_markup_strip_html() nukes it */ /* I don't think this works with the new spaces profiles - Stu 3/2/06 */ if ((p = strstr(url_text, "Take a look at my </font><A class=viewDesc title=\"")) != NULL) @@ -1463,7 +1463,7 @@ } /* - * gaim_markup_strip_html() doesn't strip out character entities like + * purple_markup_strip_html() doesn't strip out character entities like * and · */ while ((p = strstr(url_buffer, " ")) != NULL) @@ -1481,7 +1481,7 @@ } /* Nuke the nasty \r's that just get in the way */ - gaim_str_strip_char(url_buffer, '\r'); + purple_str_strip_char(url_buffer, '\r'); /* MSN always puts in ' for apostrophes...replace them */ while ((p = strstr(url_buffer, "'")) != NULL) @@ -1492,11 +1492,11 @@ } /* Nuke the html, it's easier than trying to parse the horrid stuff */ - stripped = gaim_markup_strip_html(url_buffer); + stripped = purple_markup_strip_html(url_buffer); stripped_len = strlen(stripped); - gaim_debug_misc("msn", "stripped = %p\n", stripped); - gaim_debug_misc("msn", "url_buffer = %p\n", url_buffer); + purple_debug_misc("msn", "stripped = %p\n", stripped); + purple_debug_misc("msn", "url_buffer = %p\n", url_buffer); /* Gonna re-use the memory we've already got for url_buffer */ /* No we're not. */ @@ -1505,9 +1505,9 @@ /* General section header */ if (has_tooltip_text) - gaim_notify_user_info_add_section_break(user_info); + purple_notify_user_info_add_section_break(user_info); - gaim_notify_user_info_add_section_header(user_info, _("General")); + purple_notify_user_info_add_section_header(user_info, _("General")); /* Extract their Name and put it in */ MSN_GOT_INFO_GET_FIELD("Name", _("Name")); @@ -1520,7 +1520,7 @@ MSN_GOT_INFO_GET_FIELD("Location", _("Location")); /* Extract their Interests and put it in */ - found = gaim_markup_extract_info_field(stripped, stripped_len, user_info, + found = purple_markup_extract_info_field(stripped, stripped_len, user_info, "\nInterests\t", 0, " (/default.aspx?page=searchresults", 0, "Undisclosed", _("Hobbies and Interests") /* _("Interests") */, 0, NULL, NULL); @@ -1538,14 +1538,14 @@ else { /* Remove the section header */ - gaim_notify_user_info_remove_last_item(user_info); + purple_notify_user_info_remove_last_item(user_info); if (has_tooltip_text) - gaim_notify_user_info_remove_last_item(user_info); + purple_notify_user_info_remove_last_item(user_info); } /* Social */ - gaim_notify_user_info_add_section_break(user_info); - gaim_notify_user_info_add_section_header(user_info, _("Social")); + purple_notify_user_info_add_section_break(user_info); + purple_notify_user_info_add_section_header(user_info, _("Social")); MSN_GOT_INFO_GET_FIELD("Marital status", _("Marital Status")); MSN_GOT_INFO_GET_FIELD("Interested in", _("Interests")); @@ -1565,15 +1565,15 @@ else { /* Remove the section header */ - gaim_notify_user_info_remove_last_item(user_info); - gaim_notify_user_info_remove_last_item(user_info); + purple_notify_user_info_remove_last_item(user_info); + purple_notify_user_info_remove_last_item(user_info); } /* Contact Info */ /* Personal */ - gaim_notify_user_info_add_section_break(user_info); - gaim_notify_user_info_add_section_header(user_info, _("Contact Info")); - gaim_notify_user_info_add_section_header(user_info, _("Personal")); + purple_notify_user_info_add_section_break(user_info); + purple_notify_user_info_add_section_header(user_info, _("Contact Info")); + purple_notify_user_info_add_section_header(user_info, _("Personal")); MSN_GOT_INFO_GET_FIELD("Name", _("Name")); MSN_GOT_INFO_GET_FIELD("Significant other", _("Significant Other")); @@ -1597,11 +1597,11 @@ else { /* Remove the section header */ - gaim_notify_user_info_remove_last_item(user_info); + purple_notify_user_info_remove_last_item(user_info); } /* Business */ - gaim_notify_user_info_add_section_header(user_info, _("Work")); + purple_notify_user_info_add_section_header(user_info, _("Work")); MSN_GOT_INFO_GET_FIELD("Name", _("Name")); MSN_GOT_INFO_GET_FIELD("Job title", _("Job Title")); MSN_GOT_INFO_GET_FIELD("Company", _("Company")); @@ -1627,13 +1627,13 @@ else { /* Remove the section header */ - gaim_notify_user_info_remove_last_item(user_info); + purple_notify_user_info_remove_last_item(user_info); } if (!has_contact_info) { /* Remove the Contact Info section header */ - gaim_notify_user_info_remove_last_item(user_info); + purple_notify_user_info_remove_last_item(user_info); } #if 0 /* these probably don't show up any more */ @@ -1646,27 +1646,27 @@ */ /* Check if they have A Little About Me */ - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " A Little About Me \n\n", 0, "Favorite Things", '\n', NULL, _("A Little About Me"), 0, NULL, NULL); if (!found) { - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " A Little About Me \n\n", 0, "Hobbies and Interests", '\n', NULL, _("A Little About Me"), 0, NULL, NULL); } if (!found) { - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " A Little About Me \n\n", 0, "Favorite Quote", '\n', NULL, _("A Little About Me"), 0, NULL, NULL); } if (!found) { - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " A Little About Me \n\n", 0, "My Homepage \n\nTake a look", '\n', NULL, _("A Little About Me"), 0, NULL, NULL); @@ -1674,7 +1674,7 @@ if (!found) { - gaim_markup_extract_info_field(stripped, stripped_len, s, + purple_markup_extract_info_field(stripped, stripped_len, s, " A Little About Me \n\n", 0, "last updated", '\n', NULL, _("A Little About Me"), 0, NULL, NULL); } @@ -1683,27 +1683,27 @@ has_info = TRUE; /* Check if they have Favorite Things */ - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " Favorite Things \n\n", 0, "Hobbies and Interests", '\n', NULL, _("Favorite Things"), 0, NULL, NULL); if (!found) { - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " Favorite Things \n\n", 0, "Favorite Quote", '\n', NULL, _("Favorite Things"), 0, NULL, NULL); } if (!found) { - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " Favorite Things \n\n", 0, "My Homepage \n\nTake a look", '\n', NULL, _("Favorite Things"), 0, NULL, NULL); } if (!found) { - gaim_markup_extract_info_field(stripped, stripped_len, s, + purple_markup_extract_info_field(stripped, stripped_len, s, " Favorite Things \n\n", 0, "last updated", '\n', NULL, _("Favorite Things"), 0, NULL, NULL); } @@ -1712,20 +1712,20 @@ has_info = TRUE; /* Check if they have Hobbies and Interests */ - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " Hobbies and Interests \n\n", 0, "Favorite Quote", '\n', NULL, _("Hobbies and Interests"), 0, NULL, NULL); if (!found) { - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " Hobbies and Interests \n\n", 0, "My Homepage \n\nTake a look", '\n', NULL, _("Hobbies and Interests"), 0, NULL, NULL); } if (!found) { - gaim_markup_extract_info_field(stripped, stripped_len, s, + purple_markup_extract_info_field(stripped, stripped_len, s, " Hobbies and Interests \n\n", 0, "last updated", '\n', NULL, _("Hobbies and Interests"), 0, NULL, NULL); } @@ -1734,13 +1734,13 @@ has_info = TRUE; /* Check if they have Favorite Quote */ - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, "Favorite Quote \n\n", 0, "My Homepage \n\nTake a look", '\n', NULL, _("Favorite Quote"), 0, NULL, NULL); if (!found) { - gaim_markup_extract_info_field(stripped, stripped_len, s, + purple_markup_extract_info_field(stripped, stripped_len, s, "Favorite Quote \n\n", 0, "last updated", '\n', NULL, _("Favorite Quote"), 0, NULL, NULL); } @@ -1749,7 +1749,7 @@ has_info = TRUE; /* Extract the last updated date and put it in */ - found = gaim_markup_extract_info_field(stripped, stripped_len, s, + found = purple_markup_extract_info_field(stripped, stripped_len, s, " last updated:", 1, "\n", 0, NULL, _("Last Updated"), 0, NULL, msn_info_date_reformat); @@ -1761,7 +1761,7 @@ if (user_url != NULL) { tmp = g_strdup_printf("<a href=\"%s\">%s</a>", user_url, user_url); - gaim_notify_user_info_add_pair(user_info, _("Homepage"), tmp); + purple_notify_user_info_add_pair(user_info, _("Homepage"), tmp); g_free(tmp); g_free(user_url); @@ -1779,9 +1779,9 @@ char *p = strstr(url_buffer, "Unknown Member </TITLE>"); * This might not work for long either ... */ char *p = strstr(url_buffer, "form id=\"SpacesSearch\" name=\"SpacesSearch\""); - GaimBuddy *b = gaim_find_buddy - (gaim_connection_get_account(info_data->gc), info_data->name); - gaim_notify_user_info_add_pair(user_info, _("Error retrieving profile"), + PurpleBuddy *b = purple_find_buddy + (purple_connection_get_account(info_data->gc), info_data->name); + purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), ((p && b) ? _("The user has not created a public profile.") : (p ? _("MSN reported not being able to find the user's profile. " "This either means that the user does not exist, " @@ -1795,7 +1795,7 @@ /* put a link to the actual profile URL */ tmp = g_strdup_printf("<a href=\"%s%s\">%s%s</a>", PROFILE_URL, info_data->name, PROFILE_URL, info_data->name); - gaim_notify_user_info_add_pair(user_info, _("Profile URL"), tmp); + purple_notify_user_info_add_pair(user_info, _("Profile URL"), tmp); g_free(tmp); #if PHOTO_SUPPORT @@ -1813,7 +1813,7 @@ /* Try to put the photo in there too, if there's one */ if (photo_url_text) { - gaim_util_fetch_url(photo_url_text, FALSE, NULL, FALSE, msn_got_photo, + purple_util_fetch_url(photo_url_text, FALSE, NULL, FALSE, msn_got_photo, info2_data); } else @@ -1825,7 +1825,7 @@ } static void -msn_got_photo(GaimUtilFetchUrlData *url_data, gpointer user_data, +msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) { MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)user_data; @@ -1835,14 +1835,14 @@ MsnGetInfoData *info_data = info2_data->info_data; char *stripped = info2_data->stripped; char *url_buffer = info2_data->url_buffer; - GaimNotifyUserInfo *user_info = info2_data->user_info; + PurpleNotifyUserInfo *user_info = info2_data->user_info; char *photo_url_text = info2_data->photo_url_text; /* Make sure the connection is still valid if we got here by fetching a photo url */ if (url_text && (error_message != NULL || - g_list_find(gaim_connections_get_all(), info_data->gc) == NULL)) + g_list_find(purple_connections_get_all(), info_data->gc) == NULL)) { - gaim_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n"); + purple_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n"); g_free(stripped); g_free(url_buffer); g_free(user_info); @@ -1862,38 +1862,38 @@ || strstr(url_text, "404 Not Found")) { - gaim_debug_info("msn", "Error getting %s: %s\n", + purple_debug_info("msn", "Error getting %s: %s\n", photo_url_text, url_text); } else { char buf[1024]; - gaim_debug_info("msn", "%s is %d bytes\n", photo_url_text, len); - id = gaim_imgstore_add(url_text, len, NULL); + purple_debug_info("msn", "%s is %d bytes\n", photo_url_text, len); + id = purple_imgstore_add(url_text, len, NULL); g_snprintf(buf, sizeof(buf), "<img id=\"%d\"><br>", id); - gaim_notify_user_info_prepend_pair(user_info, NULL, buf); + purple_notify_user_info_prepend_pair(user_info, NULL, buf); } } /* We continue here from msn_got_info, as if nothing has happened */ #endif - gaim_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); + purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); g_free(stripped); g_free(url_buffer); - gaim_notify_user_info_destroy(user_info); + purple_notify_user_info_destroy(user_info); g_free(info_data->name); g_free(info_data); #if PHOTO_SUPPORT g_free(photo_url_text); g_free(info2_data); if (id != -1) - gaim_imgstore_unref(id); + purple_imgstore_unref(id); #endif } static void -msn_get_info(GaimConnection *gc, const char *name) +msn_get_info(PurpleConnection *gc, const char *name) { MsnGetInfoData *data; char *url; @@ -1904,14 +1904,14 @@ url = g_strdup_printf("%s%s", PROFILE_URL, name); - gaim_util_fetch_url(url, FALSE, + purple_util_fetch_url(url, FALSE, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", TRUE, msn_got_info, data); g_free(url); } -static gboolean msn_load(GaimPlugin *plugin) +static gboolean msn_load(PurplePlugin *plugin) { msn_notification_init(); msn_switchboard_init(); @@ -1920,7 +1920,7 @@ return TRUE; } -static gboolean msn_unload(GaimPlugin *plugin) +static gboolean msn_unload(PurplePlugin *plugin) { msn_notification_end(); msn_switchboard_end(); @@ -1929,20 +1929,20 @@ return TRUE; } -static GaimAccount *find_acct(const char *prpl, const char *acct_id) +static PurpleAccount *find_acct(const char *prpl, const char *acct_id) { - GaimAccount *acct = NULL; + PurpleAccount *acct = NULL; /* If we have a specific acct, use it */ if (acct_id) { - acct = gaim_accounts_find(acct_id, prpl); - if (acct && !gaim_account_is_connected(acct)) + acct = purple_accounts_find(acct_id, prpl); + if (acct && !purple_account_is_connected(acct)) acct = NULL; } else { /* Otherwise find an active account for the protocol */ - GList *l = gaim_accounts_get_all(); + GList *l = purple_accounts_get_all(); while (l) { - if (!strcmp(prpl, gaim_account_get_protocol_id(l->data)) - && gaim_account_is_connected(l->data)) { + if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) + && purple_account_is_connected(l->data)) { acct = l->data; break; } @@ -1956,7 +1956,7 @@ static gboolean msn_uri_handler(const char *proto, const char *cmd, GHashTable *params) { char *acct_id = g_hash_table_lookup(params, "account"); - GaimAccount *acct; + PurpleAccount *acct; if (g_ascii_strcasecmp(proto, "msnim")) return FALSE; @@ -1970,15 +1970,15 @@ if (!g_ascii_strcasecmp(cmd, "Chat")) { char *sname = g_hash_table_lookup(params, "contact"); if (sname) { - GaimConversation *conv = gaim_find_conversation_with_account( - GAIM_CONV_TYPE_IM, sname, acct); + PurpleConversation *conv = purple_find_conversation_with_account( + PURPLE_CONV_TYPE_IM, sname, acct); if (conv == NULL) - conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, acct, sname); - gaim_conversation_present(conv); + conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname); + purple_conversation_present(conv); } /*else **If pidgindialogs_im() was in the core, we could use it here. - * It is all gaim_request_* based, but I'm not sure it really belongs in the core + * It is all purple_request_* based, but I'm not sure it really belongs in the core pidgindialogs_im();*/ return TRUE; @@ -1986,7 +1986,7 @@ /* msnim:add?contact=user@domain.tld */ else if (!g_ascii_strcasecmp(cmd, "Add")) { char *name = g_hash_table_lookup(params, "contact"); - gaim_blist_request_add_buddy(acct, name, NULL, NULL); + purple_blist_request_add_buddy(acct, name, NULL, NULL); return TRUE; } @@ -1994,12 +1994,12 @@ } -static GaimPluginProtocolInfo prpl_info = +static PurplePluginProtocolInfo prpl_info = { OPT_PROTO_MAIL_CHECK, NULL, /* user_splits */ NULL, /* protocol_options */ - {"png", 0, 0, 96, 96, 0, GAIM_ICON_SCALE_SEND}, /* icon_spec */ + {"png", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, /* icon_spec */ msn_list_icon, /* list_icon */ NULL, /* list_emblems */ msn_status_text, /* status_text */ @@ -2060,16 +2060,16 @@ NULL, /* roomlist_room_serialize */ }; -static GaimPluginInfo info = +static PurplePluginInfo info = { - GAIM_PLUGIN_MAGIC, - GAIM_MAJOR_VERSION, - GAIM_MINOR_VERSION, - GAIM_PLUGIN_PROTOCOL, /**< type */ + PURPLE_PLUGIN_MAGIC, + PURPLE_MAJOR_VERSION, + PURPLE_MINOR_VERSION, + PURPLE_PLUGIN_PROTOCOL, /**< type */ NULL, /**< ui_requirement */ 0, /**< flags */ NULL, /**< dependencies */ - GAIM_PRIORITY_DEFAULT, /**< priority */ + PURPLE_PRIORITY_DEFAULT, /**< priority */ "prpl-msn", /**< id */ "MSN", /**< name */ @@ -2079,7 +2079,7 @@ /** description */ N_("MSN Protocol Plugin"), "Christian Hammond <chipx86@gnupdate.org>", /**< author */ - GAIM_WEBSITE, /**< homepage */ + PURPLE_WEBSITE, /**< homepage */ msn_load, /**< load */ msn_unload, /**< unload */ @@ -2092,38 +2092,38 @@ }; static void -init_plugin(GaimPlugin *plugin) +init_plugin(PurplePlugin *plugin) { - GaimAccountOption *option; + PurpleAccountOption *option; - option = gaim_account_option_string_new(_("Server"), "server", + option = purple_account_option_string_new(_("Server"), "server", MSN_SERVER); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = gaim_account_option_int_new(_("Port"), "port", 1863); + option = purple_account_option_int_new(_("Port"), "port", 1863); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = gaim_account_option_bool_new(_("Use HTTP Method"), + option = purple_account_option_bool_new(_("Use HTTP Method"), "http_method", FALSE); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = gaim_account_option_bool_new(_("Show custom smileys"), + option = purple_account_option_bool_new(_("Show custom smileys"), "custom_smileys", TRUE); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - gaim_cmd_register("nudge", "", GAIM_CMD_P_PRPL, - GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_PRPL_ONLY, + purple_cmd_register("nudge", "", PURPLE_CMD_P_PRPL, + PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, "prpl-msn", msn_cmd_nudge, _("nudge: nudge a user to get their attention"), NULL); - gaim_prefs_remove("/plugins/prpl/msn"); + purple_prefs_remove("/plugins/prpl/msn"); - gaim_signal_connect(gaim_get_core(), "uri-handler", plugin, - GAIM_CALLBACK(msn_uri_handler), NULL); + purple_signal_connect(purple_get_core(), "uri-handler", plugin, + PURPLE_CALLBACK(msn_uri_handler), NULL); } -GAIM_INIT_PLUGIN(msn, init_plugin, info); +PURPLE_INIT_PLUGIN(msn, init_plugin, info);