changeset 9608:204f5d66a863

[gaim-migrate @ 10451] " I added two possible commands to gtk-remote: away and back. away causes the away dialog to appear with the default message and sets the status to away, back hides the dialog and sets the status to online. To implement this, I added to new CUI packet subtypes: CUI_USER_AWAY and CUI_USER_BACK. This are processed in core.c by calling do_away_message and do_im_back, respectively." --Istv?n V?radi committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 28 Jul 2004 00:29:52 +0000
parents 293de2970493
children 93211b7538d6
files COPYRIGHT ChangeLog plugins/gaim-remote/remote.c plugins/gaim-remote/remote.h src/gaim-remote.c
diffstat 5 files changed, 60 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Wed Jul 28 00:13:37 2004 +0000
+++ b/COPYRIGHT	Wed Jul 28 00:29:52 2004 +0000
@@ -155,6 +155,7 @@
 Tom Tromey
 Chris Toshok
 Junichi Uekawa
+István Váradi
 David Vermeille
 Bjoern Voigt
 Nathan Walp
--- a/ChangeLog	Wed Jul 28 00:13:37 2004 +0000
+++ b/ChangeLog	Wed Jul 28 00:29:52 2004 +0000
@@ -6,6 +6,7 @@
 	  Radchenko)
 	* Visual display of ops/voice/halfops/so on in Chats (Stu Tomlinson)
 	* Tab completion of slash commands in Chats (Stu Tomlinson)
+	* gaim-remote can now manipulate status (István Váradi)
 	* The text messages of Yahoo Audibles are now displayed, although
 	  the audio and graphics are not.
 
--- a/plugins/gaim-remote/remote.c	Wed Jul 28 00:13:37 2004 +0000
+++ b/plugins/gaim-remote/remote.c	Wed Jul 28 00:29:52 2004 +0000
@@ -42,6 +42,7 @@
 #include "gtkplugin.h"
 #include "gaim.h"
 #include "ui.h"
+#include "prefs.h"
 
 #include <gaim-remote/remote.h>
 
@@ -394,6 +395,22 @@
 			gaim_account_connect(account);
 		/* don't need to do anything here because the UI will get updates from other handlers */
 		break;
+       case CUI_USER_AWAY:
+                {
+                    GSList* l;
+                    const char* default_away_name = gaim_prefs_get_string("/core/away/default_message");
+
+                    for(l = away_messages; l; l = l->next) {
+                        if(!strcmp(default_away_name, ((struct away_message *)l->data)->name)) {
+                            do_away_message(NULL, l->data);
+                            break;
+                        }
+                    }
+                }
+                break;
+       case CUI_USER_BACK:
+                do_im_back(NULL, NULL);
+                break;
 	default:
 		gaim_debug(GAIM_DEBUG_WARNING, "cui",
 				   "Unhandled user subtype %d\n", subtype);
--- a/plugins/gaim-remote/remote.h	Wed Jul 28 00:13:37 2004 +0000
+++ b/plugins/gaim-remote/remote.h	Wed Jul 28 00:29:52 2004 +0000
@@ -59,6 +59,8 @@
 #define CUI_USER_REMOVE		3
 #define CUI_USER_MODIFY		4	/* this handles moving them in the list too */
 #define CUI_USER_SIGNON		5
+#define CUI_USER_AWAY		6
+#define CUI_USER_BACK		7
 
 #define CUI_CONN_LIST		1
 #define CUI_CONN_PROGRESS	2
--- a/src/gaim-remote.c	Wed Jul 28 00:13:37 2004 +0000
+++ b/src/gaim-remote.c	Wed Jul 28 00:29:52 2004 +0000
@@ -66,6 +66,8 @@
 
 	     "    COMMANDS:\n"
 	     "       uri                      Handle AIM: URI\n"
+             "       away                     Popup the away dialog with the default message\n"
+             "       back                     Remove the away dialog\n"
 	     "       quit                     Close running copy of Gaim\n\n"
 
 	     "    OPTIONS:\n"
@@ -197,6 +199,39 @@
 	return 0;
 }
 
+int command_away()
+{
+	int fd = 0;
+	GaimRemotePacket *p = NULL;
+	fd = gaim_remote_session_connect(0);
+	if (fd<0) {
+		message(_("Gaim not running (on session 0)\n"),2);
+		return 1;
+	}
+	p = gaim_remote_packet_new(CUI_TYPE_USER, CUI_USER_AWAY);
+	gaim_remote_session_send_packet(fd, p);
+	close(fd);
+	gaim_remote_packet_free(p);
+	return 0;
+}
+
+int command_back()
+{
+	int fd = 0;
+	GaimRemotePacket *p = NULL;
+	fd = gaim_remote_session_connect(0);
+	if (fd<0) {
+		message(_("Gaim not running (on session 0)\n"),2);
+		return 1;
+	}
+	p = gaim_remote_packet_new(CUI_TYPE_USER, CUI_USER_BACK);
+	gaim_remote_session_send_packet(fd, p);
+	close(fd);
+	gaim_remote_packet_free(p);
+	return 0;
+}
+
+
 void show_longhelp_uri( char *name, char *command)
 {
 	if(!strcmp(command, "uri")) {
@@ -256,6 +291,10 @@
 		}
 /*	} else if (!strcmp(opts.command, "info")) {
 		return command_info();*/
+        } else if (!strcmp(opts.command, "away")) {
+                return command_away();
+        } else if (!strcmp(opts.command, "back")) {
+                return command_back();
 	} else if (!strcmp(opts.command, "quit")) {
 		if(opts.help){
 			show_longhelp_uri(argv[0], "quit");