Mercurial > pidgin
changeset 10395:b4b9dabdd7c7
[gaim-migrate @ 11624]
Some whitespace fixes, a compile warning fix, and add a "logout" option
to gaim-remote
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 17 Dec 2004 23:30:38 +0000 |
parents | 45a0a07e8b25 |
children | 3cf69ffdc25e |
files | plugins/gaim-remote/remote-socket.c plugins/gaim-remote/remote.c plugins/gaim-remote/remote.h src/gaim-remote.c src/protocols/gg/gg.c |
diffstat | 5 files changed, 46 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/gaim-remote/remote-socket.c Fri Dec 17 00:05:32 2004 +0000 +++ b/plugins/gaim-remote/remote-socket.c Fri Dec 17 23:30:38 2004 +0000 @@ -24,7 +24,7 @@ * Thomas Nilsson and 4Front Technologies * Copyright (C) 1999-2002 Haavard Kvaalen */ - + /* This provides code for connecting to a Gaim socket and communicating with * it. It will eventually be made a library once the core and ui are split. */ @@ -140,7 +140,7 @@ g_free(p); return NULL; } - + if (p->length) { data = g_malloc(p->length); @@ -193,10 +193,9 @@ gaim_remote_session_send_packet(fd, pack); gaim_remote_packet_free(pack); close(fd); - + return TRUE; } return FALSE; } -
--- a/plugins/gaim-remote/remote.c Fri Dec 17 00:05:32 2004 +0000 +++ b/plugins/gaim-remote/remote.c Fri Dec 17 23:30:38 2004 +0000 @@ -95,7 +95,7 @@ char *who, *what; GaimConversation *c; uri = uri + strlen("aim:goim?"); - + if (!(who = strstr(uri, "screenname="))) { return _("No screenname given."); } @@ -108,7 +108,7 @@ } who = g_strdup(str->str); g_string_free(str, TRUE); - + what = strstr(uri, "message="); if (what) { what = what + strlen("message="); @@ -168,10 +168,10 @@ char *room; GHashTable *components; int exch = 5; - + uri = uri + strlen("aim:gochat?"); /* spaces are encoded as +'s */ - + if (!(room = strstr(uri, "roomname="))) { return _("No roomname given."); } @@ -194,8 +194,7 @@ } else { return _("Invalid AIM URI"); } - - + return NULL; } @@ -305,6 +304,7 @@ { GaimRemotePacket *p; GError *error = NULL; + switch (subtype) { case CUI_META_LIST: break; @@ -416,6 +416,11 @@ break; #endif /* STATUS */ + + case CUI_USER_LOGOUT: + gaim_connections_disconnect_all(); + break; + default: gaim_debug_warning("cui", "Unhandled user subtype %d\n", subtype); break; @@ -682,10 +687,10 @@ case CUI_TYPE_CHAT: chat_handler(ui, subtype, in); break; - */ + */ case CUI_TYPE_REMOTE: remote_handler(ui, subtype, in, len); - break; + break; default: gaim_debug_warning("cui", "Unhandled type %d\n", type); break; @@ -724,12 +729,12 @@ { struct sockaddr_un saddr; gint fd; - + while (gaim_remote_session_exists(gaim_session)) gaim_session++; - + gaim_debug_misc("cui", "Session: %d\n", gaim_session); - + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { mode_t m = umask(0177); saddr.sun_family = AF_UNIX; @@ -742,7 +747,7 @@ *error = g_strdup_printf(_("Failed to assign %s to a socket:\n%s"), saddr.sun_path, strerror(errno)); g_log(NULL, G_LOG_LEVEL_CRITICAL, - "Failed to assign %s to a socket (Error: %s)", + "Failed to assign %s to a socket (Error: %s)", saddr.sun_path, strerror(errno)); umask(m); return -1;
--- a/plugins/gaim-remote/remote.h Fri Dec 17 00:05:32 2004 +0000 +++ b/plugins/gaim-remote/remote.h Fri Dec 17 23:30:38 2004 +0000 @@ -33,22 +33,22 @@ #define CUI_TYPE_BUDDY 5 /* BUDDY_LIST, i.e., both groups and buddies */ #define CUI_TYPE_MESSAGE 6 #define CUI_TYPE_CHAT 7 -#define CUI_TYPE_REMOTE 8 +#define CUI_TYPE_REMOTE 8 /* This is used to send commands to other UI's, * like "Open new conversation" or "send IM". * Even though there's much redundancy with the * other CUI_TYPES, we're better keeping this stuff * separate because it's intended use is so different */ -#define CUI_META_LIST 1 +#define CUI_META_LIST 1 /* 1 is always list; this is ignored by the core. If we move to TCP this can be a keepalive */ #define CUI_META_QUIT 2 -#define CUI_META_DETACH 3 +#define CUI_META_DETACH 3 /* you don't need to send this, you can just close the socket. the core will understand. */ -#define CUI_META_PING 4 -#define CUI_META_ACK 5 +#define CUI_META_PING 4 +#define CUI_META_ACK 5 #define CUI_PLUGIN_LIST 1 #define CUI_PLUGIN_LOAD 2 @@ -61,6 +61,7 @@ #define CUI_USER_SIGNON 5 #define CUI_USER_AWAY 6 #define CUI_USER_BACK 7 +#define CUI_USER_LOGOUT 8 #define CUI_CONN_LIST 1 #define CUI_CONN_PROGRESS 2 @@ -68,7 +69,7 @@ #define CUI_CONN_OFFLINE 4 /* this may send a "reason" for why it was killed */ #define CUI_BUDDY_LIST 1 -#define CUI_BUDDY_STATE 2 +#define CUI_BUDDY_STATE 2 /* notifies the UI of state changes; UI can use it to request the current status from the core */ #define CUI_BUDDY_ADD 3
--- a/src/gaim-remote.c Fri Dec 17 00:05:32 2004 +0000 +++ b/src/gaim-remote.c Fri Dec 17 23:30:38 2004 +0000 @@ -65,7 +65,7 @@ * * If channel is 1, the message is printed to stdout. * if channel is 2, the message is printed to stderr. - */ + */ static void message(char *text, int channel) { @@ -103,11 +103,13 @@ text = g_strdup_printf(_("Usage: %s command [OPTIONS] [URI]\n\n" " COMMANDS:\n" + " send Send message\n" " uri Handle AIM: URI\n" " away Popup the away dialog with the default message\n" " back Remove the away dialog\n" - " send Send message\n" - " quit Close running copy of Gaim\n\n" + " logout Log out all accounts\n" + " quit Close running copy of Gaim\n" + "\n" " OPTIONS:\n" " -m, --message=MESG Message to send or show in conversation window\n" " -t, --to=SCREENNAME Select a target for command\n" @@ -307,6 +309,10 @@ "...prompts you to add 'Penguin' to your buddy list.\n"), 1); } + else if (!strcmp(command, "logout")) { + message(_("\nLog out all accounts\n"), 1); + } + else if (!strcmp(command, "quit")) { message(_("\nClose running copy of Gaim\n"), 1); } @@ -370,6 +376,13 @@ return send_generic_command(CUI_TYPE_USER, CUI_USER_BACK); } + else if (!strcmp(opts.command, "logout")) { + if (opts.help) + show_longhelp(argv[0], "logout"); + else + return send_generic_command(CUI_TYPE_USER, CUI_USER_LOGOUT); + } + else if (!strcmp(opts.command, "quit")) { if (opts.help) show_longhelp(argv[0], "quit"); @@ -381,6 +394,6 @@ show_remote_usage(argv[0]); return 1; } - + return 0; }
--- a/src/protocols/gg/gg.c Fri Dec 17 00:05:32 2004 +0000 +++ b/src/protocols/gg/gg.c Fri Dec 17 23:30:38 2004 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 11615 2004-12-16 03:50:54Z faceprint $ + * $Id: gg.c 11624 2004-12-17 23:30:38Z thekingant $ * * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> * @@ -1512,7 +1512,7 @@ } #endif -static void agg_change_passwd(GaimConnection *gc, const unsigned char *old, const unsigned char *new) +static void agg_change_passwd(GaimConnection *gc, const char *old, const char *new) { struct agg_http *hpass = g_new0(struct agg_http, 1); gchar *u = gg_urlencode(gaim_account_get_username(gc->account));