Mercurial > pidgin
comparison src/gaim-remote.c @ 4242:cf19d8102b34
[gaim-migrate @ 4492]
John B. Silvestri (silvestrij) writes:
"This adds a --longhelp (-H) option to gaim-remote, which details its
usage (aim?goim,gochat, and addbuddy)."
he further writes:
"Now follows Sean's request of being `gaim-remote
-h uri` or `gaim-remote --help uri`
This is version 3.11.\n"), name);
luke writes that this patch is needed because _i_ can't remember how to use
the gaim-remote stuff, much less help others to do so, and what use is a
gaim-remote that only 2 people know how to use?
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 08 Jan 2003 04:00:29 +0000 |
parents | cba92ec56248 |
children | c081a81ee013 |
comparison
equal
deleted
inserted
replaced
4241:cc14954cc399 | 4242:cf19d8102b34 |
---|---|
1 /* | 1 /* |
2 * gaim-remote | 2 * gaim-remote |
3 * | 3 * |
4 * Copyright (C) 2002, Sean Egan <bj91704@binghamton.edu> | 4 * Copyright (C) 2002, Sean Egan <bj91704@binghamton.edu> |
5 * Features/functionality added (C) 2002, John B. Silvestri <silvestrij@mville.edu> | |
6 * 'quit', long help for URIs | |
5 * | 7 * |
6 * This program is free software; you can redistribute it and/or modify | 8 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License as published by | 9 * it under the terms of the GNU General Public License as published by |
8 * the Free Software Foundation; either version 2 of the License, or | 10 * the Free Software Foundation; either version 2 of the License, or |
9 * (at your option) any later version. | 11 * (at your option) any later version. |
23 #include <getopt.h> | 25 #include <getopt.h> |
24 #include <unistd.h> | 26 #include <unistd.h> |
25 #include <string.h> | 27 #include <string.h> |
26 #include "gaim-socket.h" | 28 #include "gaim-socket.h" |
27 | 29 |
28 void show_remote_usage(char *name) | 30 void show_remote_usage(char *name) |
29 { | 31 { |
30 printf(_("Usage: %s command [OPTIONS] [URI]\n\n" | 32 printf(_("Usage: %s command [OPTIONS] [URI]\n\n" |
31 | 33 |
32 " COMMANDS:\n" | 34 " COMMANDS:\n" |
33 " uri Handle AIM:// URI\n" | 35 " uri Handle AIM: URI\n" |
36 " quit Close running copy of Gaim\n\n" | |
37 | |
38 " OPTIONS:\n" | |
39 " -h, --help [commmand] Show help for command\n"), name); | |
40 return; | |
41 } | |
42 | |
43 /*To be implemented: | |
34 " info Show information about connected accounts\n" | 44 " info Show information about connected accounts\n" |
35 " list Print buddy list\n" | 45 " list Print buddy list\n" |
36 " ison Show presence state of your buddy\n" | 46 " ison Show presence state of your buddy\n" |
37 " convo Open a new conversation window\n" | 47 " convo Open a new conversation window\n" |
38 " send Send message\n" | 48 " send Send message\n" |
39 " add Add buddy to buddy list\n" | 49 " add Add buddy to buddy list\n" |
40 " remove Remove buddy from list\n" | 50 " remove Remove buddy from list\n" |
41 " quit Close running copy of Gaim\n\n" | |
42 | |
43 " OPTIONS:\n" | |
44 " -m, --message=MESG Message to send or show in conversation window\n" | 51 " -m, --message=MESG Message to send or show in conversation window\n" |
45 " -t, --to=SCREENNAME Select a target for command\n" | 52 " -t, --to=SCREENNAME Select a target for command\n" |
46 " -p, --protocol=PROTO Specify protocol to use\n" | 53 " -p, --protocol=PROTO Specify protocol to use\n" |
47 " -f, --from=SCREENNAME Specify screenname to use\n" | 54 " -f, --from=SCREENNAME Specify screenname to use\n" |
48 " -q, --quiet Send message without showing a conversation\n" | 55 " -q, --quiet Send message without showing a conversation\n" |
49 " window\n" | 56 " window\n" |
50 " -h, --help Show help for command\n"), name); | 57 */ |
51 return; | |
52 } | |
53 | 58 |
54 static struct option longopts[] = { | 59 static struct option longopts[] = { |
55 {"message", required_argument, NULL, 'm'}, | 60 {"message", required_argument, NULL, 'm'}, |
56 {"to", required_argument, NULL, 't'}, | 61 {"to", required_argument, NULL, 't'}, |
57 {"protocol",required_argument, NULL, 'p'}, | 62 {"protocol",required_argument, NULL, 'p'}, |
151 close(fd); | 156 close(fd); |
152 cui_packet_free(p); | 157 cui_packet_free(p); |
153 return 0; | 158 return 0; |
154 } | 159 } |
155 | 160 |
161 void show_longhelp_uri(){ | |
162 printf ("\n" | |
163 | |
164 "Using AIM: URIs:\n" | |
165 "Sending an IM to a screenname:\n" | |
166 " gaim-remote uri 'aim:goim?screenname=Penguin&message=hello+world'\n" | |
167 "In this case, 'Penguin' is the screenname we wish to IM, and 'hello world'\n" | |
168 "is the message to be sent. '+' must be used in place of spaces.\n" | |
169 "Please note the quoting used above - if you run this from a shell the '&'\n" | |
170 "needs to be escaped, or the command will stop at that point.\n" | |
171 "Also,the following will just open a conversation window to a screenname,\n" | |
172 "with no message:\n" | |
173 " gaim-remote uri aim:goim?screenname=Penguin\n\n" | |
174 "Joining a chat:\n" | |
175 " gaim-remote uri aim:gochat?roomname=PenguinLounge\n" | |
176 "...joins the 'PenguinLounge' chat room.\n\n" | |
177 "Adding a buddy to your buddy list:\n" | |
178 " gaim-remote uri aim:addbuddy?screenname=Penguin\n" | |
179 "...prompts you to add 'Penguin' to your buddy list.\n" | |
180 ); | |
181 return; | |
182 } | |
183 | |
184 /* Work in progress - JBS | |
156 int command_info(){ | 185 int command_info(){ |
157 fprintf(stderr, "Info not yet implemented\n"); | 186 fprintf(stderr, "Info not yet implemented\n"); |
158 return 1; | 187 return 1; |
159 } | 188 }*/ |
160 | 189 |
161 int main (int argc, char *argv[]) | 190 int main (int argc, char *argv[]) |
162 { | 191 { |
163 | 192 |
164 if (get_options(argc, argv)) { | 193 if (get_options(argc, argv)) { |
166 return 0; | 195 return 0; |
167 } | 196 } |
168 | 197 |
169 | 198 |
170 if (!strcmp(opts.command, "uri")) { | 199 if (!strcmp(opts.command, "uri")) { |
171 return command_uri(); | 200 if(opts.help){ |
172 } else if (!strcmp(opts.command, "info")) { | 201 show_longhelp_uri(); |
173 return command_info(); | 202 }else{ |
203 return command_uri(); | |
204 } | |
205 /* } else if (!strcmp(opts.command, "info")) { | |
206 return command_info();*/ | |
174 } else if (!strcmp(opts.command, "quit")) { | 207 } else if (!strcmp(opts.command, "quit")) { |
175 return command_quit(); | 208 return command_quit(); |
176 } else { | 209 } else { |
177 show_remote_usage(argv[0]); | 210 show_remote_usage(argv[0]); |
178 return 1; | 211 return 1; |