Mercurial > pidgin.yaz
comparison src/protocols/msn/msn.c @ 11321:95fa774d216d
[gaim-migrate @ 13525]
Kill off the conversation closed notices
Fix for setting the ACK id on slpmsg ACKs which might improve things for
other clients (see bug #1222320)
Clean up some debugging stuff
Add support for sending and receiving Nudges (Based on patch #1169352)
Add an account action to go direct to a Hotmail Inbox
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 21 Aug 2005 17:14:22 +0000 |
parents | 90be432e8385 |
children | dc75e1a824cd |
comparison
equal
deleted
inserted
replaced
11320:d3b567926e8f | 11321:95fa774d216d |
---|---|
32 #include "pluginpref.h" | 32 #include "pluginpref.h" |
33 #include "prefs.h" | 33 #include "prefs.h" |
34 #include "session.h" | 34 #include "session.h" |
35 #include "state.h" | 35 #include "state.h" |
36 #include "utils.h" | 36 #include "utils.h" |
37 #include "cmds.h" | |
37 #include "prpl.h" | 38 #include "prpl.h" |
38 #include "util.h" | 39 #include "util.h" |
39 #include "version.h" | 40 #include "version.h" |
40 | 41 |
41 #include "switchboard.h" | 42 #include "switchboard.h" |
87 tmp = g_utf8_strdown(buf, -1); | 88 tmp = g_utf8_strdown(buf, -1); |
88 strncpy(buf, tmp, sizeof(buf)); | 89 strncpy(buf, tmp, sizeof(buf)); |
89 g_free(tmp); | 90 g_free(tmp); |
90 | 91 |
91 return buf; | 92 return buf; |
93 } | |
94 | |
95 static GaimCmdRet | |
96 msn_cmd_nudge(GaimConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) | |
97 { | |
98 GaimAccount *account = gaim_conversation_get_account(conv); | |
99 GaimConnection *gc = gaim_account_get_connection(account); | |
100 const char *username = gaim_account_get_username(account); | |
101 MsnMessage *msg; | |
102 MsnSession *session; | |
103 MsnSwitchBoard *swboard; | |
104 | |
105 msg = msn_message_new_nudge(); | |
106 session = gc->proto_data; | |
107 swboard = msn_session_get_swboard(session, gaim_conversation_get_name(conv), MSN_SB_FLAG_IM); | |
108 | |
109 if (session == NULL || swboard == NULL) | |
110 return GAIM_CMD_RET_FAILED; | |
111 | |
112 msn_switchboard_send_msg(swboard, msg, TRUE); | |
113 | |
114 gaim_conversation_write(conv, NULL, _("You have just sent a Nudge!"), GAIM_MESSAGE_SYSTEM, time(NULL)); | |
115 | |
116 return GAIM_CMD_RET_OK; | |
92 } | 117 } |
93 | 118 |
94 static void | 119 static void |
95 msn_act_id(GaimConnection *gc, const char *entry) | 120 msn_act_id(GaimConnection *gc, const char *entry) |
96 { | 121 { |
288 _("Disallow"), G_CALLBACK(disable_msn_pages_cb), | 313 _("Disallow"), G_CALLBACK(disable_msn_pages_cb), |
289 _("Cancel"), NULL); | 314 _("Cancel"), NULL); |
290 } | 315 } |
291 | 316 |
292 static void | 317 static void |
318 msn_show_hotmail_inbox(GaimPluginAction *action) | |
319 { | |
320 GaimConnection *gc; | |
321 MsnSession *session; | |
322 | |
323 gc = (GaimConnection *) action->context; | |
324 session = gc->proto_data; | |
325 | |
326 if (session->passport_info.file == NULL) | |
327 { | |
328 gaim_notify_error(gc, NULL, | |
329 _("This Hotmail account may not be active."), NULL); | |
330 return; | |
331 } | |
332 | |
333 gaim_notify_uri(gc, session->passport_info.file); | |
334 } | |
335 | |
336 static void | |
293 show_send_to_mobile_cb(GaimBlistNode *node, gpointer ignored) | 337 show_send_to_mobile_cb(GaimBlistNode *node, gpointer ignored) |
294 { | 338 { |
295 GaimBuddy *buddy; | 339 GaimBuddy *buddy; |
296 GaimConnection *gc; | 340 GaimConnection *gc; |
297 MsnSession *session; | 341 MsnSession *session; |
562 } | 606 } |
563 | 607 |
564 static GList * | 608 static GList * |
565 msn_actions(GaimPlugin *plugin, gpointer context) | 609 msn_actions(GaimPlugin *plugin, gpointer context) |
566 { | 610 { |
611 GaimConnection *gc = (GaimConnection *)context; | |
612 GaimAccount *account; | |
613 const char *user; | |
614 | |
567 GList *m = NULL; | 615 GList *m = NULL; |
568 GaimPluginAction *act; | 616 GaimPluginAction *act; |
569 | 617 |
570 act = gaim_plugin_action_new(_("Set Friendly Name"), | 618 act = gaim_plugin_action_new(_("Set Friendly Name"), |
571 msn_show_set_friendly_name); | 619 msn_show_set_friendly_name); |
592 #endif | 640 #endif |
593 | 641 |
594 act = gaim_plugin_action_new(_("Allow/Disallow Mobile Pages"), | 642 act = gaim_plugin_action_new(_("Allow/Disallow Mobile Pages"), |
595 msn_show_set_mobile_pages); | 643 msn_show_set_mobile_pages); |
596 m = g_list_append(m, act); | 644 m = g_list_append(m, act); |
645 | |
646 account = gaim_connection_get_account(gc); | |
647 user = msn_normalize(account, gaim_account_get_username(account)); | |
648 | |
649 if (strstr(user, "@hotmail.com") != NULL) | |
650 { | |
651 m = g_list_append(m, NULL); | |
652 act = gaim_plugin_action_new(_("Open Hotmail Inbox"), | |
653 msn_show_hotmail_inbox); | |
654 m = g_list_append(m, act); | |
655 } | |
597 | 656 |
598 return m; | 657 return m; |
599 } | 658 } |
600 | 659 |
601 static GList * | 660 static GList * |
1929 option = gaim_account_option_bool_new(_("Use HTTP Method"), | 1988 option = gaim_account_option_bool_new(_("Use HTTP Method"), |
1930 "http_method", FALSE); | 1989 "http_method", FALSE); |
1931 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, | 1990 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
1932 option); | 1991 option); |
1933 | 1992 |
1993 gaim_cmd_register("nudge", "", GAIM_CMD_P_PRPL, | |
1994 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_PRPL_ONLY, | |
1995 "prpl-msn", msn_cmd_nudge, | |
1996 _("nudge: nudge a contact to get their attention"), NULL); | |
1997 | |
1934 gaim_prefs_remove("/plugins/prpl/msn"); | 1998 gaim_prefs_remove("/plugins/prpl/msn"); |
1935 } | 1999 } |
1936 | 2000 |
1937 GAIM_INIT_PLUGIN(msn, init_plugin, info); | 2001 GAIM_INIT_PLUGIN(msn, init_plugin, info); |