comparison src/protocols/irc/cmds.c @ 6350:34c07f5f34a0

[gaim-migrate @ 6849] -Compile warning fixes from The Man (Paco-Paco) -2 memleak fixes from me. One of them leaked the size of a chat message when either sending or receiving, I forgot which (my bad!) -Hopefully make AIM correctly refetch your buddy list when AOL doesn't send it to you the first time -Maybe something else -Chocolate -Vanilla -Strawberry -Napoleon committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 31 Jul 2003 23:21:36 +0000
parents e06e04e44914
children 72bbe310ac77
comparison
equal deleted inserted replaced
6349:dc89c06af77e 6350:34c07f5f34a0
34 { 34 {
35 GaimConversation *convo = gaim_find_conversation_with_account(target, irc->account); 35 GaimConversation *convo = gaim_find_conversation_with_account(target, irc->account);
36 char *buf; 36 char *buf;
37 37
38 if (!convo) 38 if (!convo)
39 return; 39 return 1;
40 40
41 buf = g_strdup_printf(_("Unknown command: %s"), cmd); 41 buf = g_strdup_printf(_("Unknown command: %s"), cmd);
42 if (gaim_conversation_get_type(convo) == GAIM_CONV_IM) 42 if (gaim_conversation_get_type(convo) == GAIM_CONV_IM)
43 gaim_im_write(GAIM_IM(convo), "", buf, -1, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL)); 43 gaim_im_write(GAIM_IM(convo), "", buf, -1, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
44 else 44 else
161 if (!args || !args[0]) 161 if (!args || !args[0])
162 return 0; 162 return 0;
163 163
164 convo = gaim_find_conversation_with_account(target, irc->account); 164 convo = gaim_find_conversation_with_account(target, irc->account);
165 if (!convo || gaim_conversation_get_type(convo) != GAIM_CONV_CHAT) 165 if (!convo || gaim_conversation_get_type(convo) != GAIM_CONV_CHAT)
166 return; 166 return 0;
167 167
168 if (args[1]) 168 if (args[1])
169 buf = irc_format(irc, "vcn:", "KICK", target, args[0], args[1]); 169 buf = irc_format(irc, "vcn:", "KICK", target, args[0], args[1]);
170 else 170 else
171 buf = irc_format(irc, "vcn", "KICK", target, args[0]); 171 buf = irc_format(irc, "vcn", "KICK", target, args[0]);
189 else if (args[0] && (*args[0] == '+' || *args[0] == '-')) 189 else if (args[0] && (*args[0] == '+' || *args[0] == '-'))
190 buf = irc_format(irc, "vcv", "MODE", target, args[0]); 190 buf = irc_format(irc, "vcv", "MODE", target, args[0]);
191 else if (args[0]) 191 else if (args[0])
192 buf = irc_format(irc, "vv", "MODE", args[0]); 192 buf = irc_format(irc, "vv", "MODE", args[0]);
193 else 193 else
194 return; 194 return 0;
195 } else if (!strcmp(cmd, "umode")) { 195 } else if (!strcmp(cmd, "umode")) {
196 if (!args[0]) 196 if (!args[0])
197 return; 197 return 0;
198 gc = gaim_account_get_connection(irc->account); 198 gc = gaim_account_get_connection(irc->account);
199 buf = irc_format(irc, "vnv", "MODE", gaim_connection_get_display_name(gc), args[0]); 199 buf = irc_format(irc, "vnv", "MODE", gaim_connection_get_display_name(gc), args[0]);
200 } 200 }
201 irc_send(irc, buf); 201 irc_send(irc, buf);
202 g_free(buf); 202 g_free(buf);
274 } 274 }
275 275
276 irc_do_mode(irc, target, sign, ops); 276 irc_do_mode(irc, target, sign, ops);
277 g_free(ops); 277 g_free(ops);
278 278
279 return; 279 return 0;
280 } 280 }
281 281
282 int irc_cmd_part(struct irc_conn *irc, const char *cmd, const char *target, const char **args) 282 int irc_cmd_part(struct irc_conn *irc, const char *cmd, const char *target, const char **args)
283 { 283 {
284 char *buf; 284 char *buf;
306 return 0; 306 return 0;
307 stamp = g_strdup_printf("\001PING %lu\001", time(NULL)); 307 stamp = g_strdup_printf("\001PING %lu\001", time(NULL));
308 buf = irc_format(irc, "vn:", "PRIVMSG", args[0], stamp); 308 buf = irc_format(irc, "vn:", "PRIVMSG", args[0], stamp);
309 g_free(stamp); 309 g_free(stamp);
310 } else { 310 } else {
311 stamp = g_strdup_printf("%s %d", target, time(NULL)); 311 stamp = g_strdup_printf("%s %lu", target, time(NULL));
312 buf = irc_format(irc, "v:", "PING", stamp); 312 buf = irc_format(irc, "v:", "PING", stamp);
313 g_free(stamp); 313 g_free(stamp);
314 } 314 }
315 irc_send(irc, buf); 315 irc_send(irc, buf);
316 g_free(buf); 316 g_free(buf);
417 if (!args) 417 if (!args)
418 return 0; 418 return 0;
419 419
420 convo = gaim_find_conversation_with_account(target, irc->account); 420 convo = gaim_find_conversation_with_account(target, irc->account);
421 if (!convo || gaim_conversation_get_type(convo) != GAIM_CONV_CHAT) 421 if (!convo || gaim_conversation_get_type(convo) != GAIM_CONV_CHAT)
422 return; 422 return 0;
423 423
424 if (!args[0]) { 424 if (!args[0]) {
425 topic = gaim_chat_get_topic (GAIM_CHAT(convo)); 425 topic = gaim_chat_get_topic (GAIM_CHAT(convo));
426 426
427 if (topic) 427 if (topic)
428 buf = g_strdup_printf("current topic is: %s", topic); 428 buf = g_strdup_printf(_("current topic is: %s"), topic);
429 else 429 else
430 buf = g_strdup(_("No topic is set")); 430 buf = g_strdup(_("No topic is set"));
431 gaim_chat_write(GAIM_CHAT(convo), target, buf, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL)); 431 gaim_chat_write(GAIM_CHAT(convo), target, buf, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
432 g_free(buf); 432 g_free(buf);
433 433
444 int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args) 444 int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args)
445 { 445 {
446 char *buf; 446 char *buf;
447 447
448 if (!args || !args[0]) 448 if (!args || !args[0])
449 return; 449 return 0;
450 450
451 if (!strcmp(cmd, "wallops")) 451 if (!strcmp(cmd, "wallops"))
452 buf = irc_format(irc, "v:", "WALLOPS", args[0]); 452 buf = irc_format(irc, "v:", "WALLOPS", args[0]);
453 else if (!strcmp(cmd, "operwall")) 453 else if (!strcmp(cmd, "operwall"))
454 buf = irc_format(irc, "v:", "OPERWALL", args[0]); 454 buf = irc_format(irc, "v:", "OPERWALL", args[0]);
501 i += 2; 501 i += 2;
502 } 502 }
503 irc_send(irc, buf); 503 irc_send(irc, buf);
504 g_free(buf); 504 g_free(buf);
505 } 505 }
506 } 506
507 return;
508 }