diff src/gaim-remote.c @ 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 3bc41e843afb
children a049733e41f3
line wrap: on
line diff
--- 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");