# HG changeset patch # User Luke Schierer # Date 1090974592 0 # Node ID 204f5d66a863707342535eccac2ac77ea64584eb # Parent 293de29704939b9d879dac100b91526c35ade47d [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 diff -r 293de2970493 -r 204f5d66a863 COPYRIGHT --- 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 diff -r 293de2970493 -r 204f5d66a863 ChangeLog --- 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. diff -r 293de2970493 -r 204f5d66a863 plugins/gaim-remote/remote.c --- 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 @@ -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); diff -r 293de2970493 -r 204f5d66a863 plugins/gaim-remote/remote.h --- 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 diff -r 293de2970493 -r 204f5d66a863 src/gaim-remote.c --- 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");