diff 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
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Sun Aug 21 17:01:43 2005 +0000
+++ b/src/protocols/msn/msn.c	Sun Aug 21 17:14:22 2005 +0000
@@ -34,6 +34,7 @@
 #include "session.h"
 #include "state.h"
 #include "utils.h"
+#include "cmds.h"
 #include "prpl.h"
 #include "util.h"
 #include "version.h"
@@ -91,6 +92,30 @@
 	return buf;
 }
 
+static GaimCmdRet
+msn_cmd_nudge(GaimConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data)
+{
+	GaimAccount *account = gaim_conversation_get_account(conv);
+	GaimConnection *gc = gaim_account_get_connection(account);
+	const char *username = gaim_account_get_username(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);
+
+	if (session == NULL || swboard == NULL)
+		return GAIM_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));
+
+	return GAIM_CMD_RET_OK;
+}
+
 static void
 msn_act_id(GaimConnection *gc, const char *entry)
 {
@@ -290,6 +315,25 @@
 }
 
 static void
+msn_show_hotmail_inbox(GaimPluginAction *action)
+{
+	GaimConnection *gc;
+	MsnSession *session;
+
+	gc = (GaimConnection *) action->context;
+	session = gc->proto_data;
+
+	if (session->passport_info.file == NULL)
+	{
+		gaim_notify_error(gc, NULL,
+						  _("This Hotmail account may not be active."), NULL);
+		return;
+	}
+
+	gaim_notify_uri(gc, session->passport_info.file);
+}
+
+static void
 show_send_to_mobile_cb(GaimBlistNode *node, gpointer ignored)
 {
 	GaimBuddy *buddy;
@@ -564,6 +608,10 @@
 static GList *
 msn_actions(GaimPlugin *plugin, gpointer context)
 {
+	GaimConnection *gc = (GaimConnection *)context;
+	GaimAccount *account;
+	const char *user;
+
 	GList *m = NULL;
 	GaimPluginAction *act;
 
@@ -595,6 +643,17 @@
 			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));
+
+	if (strstr(user, "@hotmail.com") != NULL)
+	{
+		m = g_list_append(m, NULL);
+		act = gaim_plugin_action_new(_("Open Hotmail Inbox"),
+				msn_show_hotmail_inbox);
+		m = g_list_append(m, act);
+	}
+
 	return m;
 }
 
@@ -1931,6 +1990,11 @@
 	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,
+	                 "prpl-msn", msn_cmd_nudge,
+	                  _("nudge: nudge a contact to get their attention"), NULL);
+
 	gaim_prefs_remove("/plugins/prpl/msn");
 }