comparison src/gaim-remote.c @ 5116:c081a81ee013

[gaim-migrate @ 5479] Bjoern Voigt writes: "I have prepared some updates and patches: 1) File i18n5-de.patch - updated German translation 2) File i18n5.patch - new files in po/POTFILES.in - new strings marked for translation 3) File i18n5-accelgroup.patch - keyboard accelerators for conversation window 4) File i18n5-gaim-remote.patch - i18n support for gaim-remote.c - correct handling of "--help" option" committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 12 Apr 2003 23:31:41 +0000
parents cf19d8102b34
children 2e78141ec1b5
comparison
equal deleted inserted replaced
5115:5ec912df7a18 5116:c081a81ee013
130 int command_uri() { 130 int command_uri() {
131 int fd = 0; 131 int fd = 0;
132 struct gaim_cui_packet *p = NULL; 132 struct gaim_cui_packet *p = NULL;
133 fd = gaim_connect_to_session(0); 133 fd = gaim_connect_to_session(0);
134 if (!fd) { 134 if (!fd) {
135 fprintf(stderr, "Gaim not running (on session 0)\n"); 135 fprintf(stderr, _("Gaim not running (on session 0)\n"));
136 return 1; 136 return 1;
137 } 137 }
138 p = cui_packet_new(CUI_TYPE_REMOTE, CUI_REMOTE_URI); 138 p = cui_packet_new(CUI_TYPE_REMOTE, CUI_REMOTE_URI);
139 cui_packet_append_string(p, opts.uri); 139 cui_packet_append_string(p, opts.uri);
140 cui_send_packet (fd, p); 140 cui_send_packet (fd, p);
146 int command_quit() { 146 int command_quit() {
147 int fd = 0; 147 int fd = 0;
148 struct gaim_cui_packet *p = NULL; 148 struct gaim_cui_packet *p = NULL;
149 fd = gaim_connect_to_session(0); 149 fd = gaim_connect_to_session(0);
150 if (!fd) { 150 if (!fd) {
151 fprintf(stderr, "Gaim not running (on session 0)\n"); 151 fprintf(stderr, _("Gaim not running (on session 0)\n"));
152 return 1; 152 return 1;
153 } 153 }
154 p = cui_packet_new(CUI_TYPE_META, CUI_META_QUIT); 154 p = cui_packet_new(CUI_TYPE_META, CUI_META_QUIT);
155 cui_send_packet (fd, p); 155 cui_send_packet (fd, p);
156 close(fd); 156 close(fd);
157 cui_packet_free(p); 157 cui_packet_free(p);
158 return 0; 158 return 0;
159 } 159 }
160 160
161 void show_longhelp_uri(){ 161 void show_longhelp_uri( char *name, char *command){
162 printf ("\n" 162 if(!strcmp(command, "uri")) {
163 163 printf (_("\n"
164 "Using AIM: URIs:\n" 164 "Using AIM: URIs:\n"
165 "Sending an IM to a screenname:\n" 165 "Sending an IM to a screenname:\n"
166 " gaim-remote uri 'aim:goim?screenname=Penguin&message=hello+world'\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" 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" 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" 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" 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" 171 "Also,the following will just open a conversation window to a screenname,\n"
172 "with no message:\n" 172 "with no message:\n"
173 " gaim-remote uri aim:goim?screenname=Penguin\n\n" 173 " gaim-remote uri aim:goim?screenname=Penguin\n\n"
174 "Joining a chat:\n" 174 "Joining a chat:\n"
175 " gaim-remote uri aim:gochat?roomname=PenguinLounge\n" 175 " gaim-remote uri aim:gochat?roomname=PenguinLounge\n"
176 "...joins the 'PenguinLounge' chat room.\n\n" 176 "...joins the 'PenguinLounge' chat room.\n\n"
177 "Adding a buddy to your buddy list:\n" 177 "Adding a buddy to your buddy list:\n"
178 " gaim-remote uri aim:addbuddy?screenname=Penguin\n" 178 " gaim-remote uri aim:addbuddy?screenname=Penguin\n"
179 "...prompts you to add 'Penguin' to your buddy list.\n" 179 "...prompts you to add 'Penguin' to your buddy list.\n")
180 ); 180 );
181 return; 181 }
182 else if(!strcmp(command, "quit")) {
183 printf (_("\nClose running copy of Gaim\n"));
184 }
185 else {
186 show_remote_usage(name);
187 }
182 } 188 }
183 189
184 /* Work in progress - JBS 190 /* Work in progress - JBS
185 int command_info(){ 191 int command_info(){
186 fprintf(stderr, "Info not yet implemented\n"); 192 fprintf(stderr, "Info not yet implemented\n");
188 }*/ 194 }*/
189 195
190 int main (int argc, char *argv[]) 196 int main (int argc, char *argv[])
191 { 197 {
192 198
199 #ifdef ENABLE_NLS
200 setlocale (LC_ALL, "");
201 bindtextdomain(PACKAGE, LOCALEDIR);
202 bind_textdomain_codeset(PACKAGE, "UTF-8");
203 textdomain(PACKAGE);
204 #endif
205
193 if (get_options(argc, argv)) { 206 if (get_options(argc, argv)) {
194 show_remote_usage(argv[0]); 207 show_remote_usage(argv[0]);
195 return 0; 208 return 0;
196 } 209 }
197 210
198 211
199 if (!strcmp(opts.command, "uri")) { 212 if (!strcmp(opts.command, "uri")) {
200 if(opts.help){ 213 if(opts.help){
201 show_longhelp_uri(); 214 show_longhelp_uri(argv[0], "uri");
202 }else{ 215 }else{
203 return command_uri(); 216 return command_uri();
204 } 217 }
205 /* } else if (!strcmp(opts.command, "info")) { 218 /* } else if (!strcmp(opts.command, "info")) {
206 return command_info();*/ 219 return command_info();*/
207 } else if (!strcmp(opts.command, "quit")) { 220 } else if (!strcmp(opts.command, "quit")) {
208 return command_quit(); 221 if(opts.help){
222 show_longhelp_uri(argv[0], "quit");
223 }else{
224 return command_quit();
225 }
209 } else { 226 } else {
210 show_remote_usage(argv[0]); 227 show_remote_usage(argv[0]);
211 return 1; 228 return 1;
212 } 229 }
213 230