comparison mcabber/src/commands.c @ 640:1cd7f8e3895b

"/status_to" can be used with no jid (it will use the current buddy's jid)
author Mikael Berthe <mikael@lilotux.net>
date Wed, 28 Dec 2005 18:58:03 +0100
parents f6946251acdf
children 62679532ea55
comparison
equal deleted inserted replaced
639:3edd3687c38d 640:1cd7f8e3895b
499 st = *(paramlst+1); 499 st = *(paramlst+1);
500 msg = *(paramlst+2); 500 msg = *(paramlst+2);
501 501
502 if (!jid || !st) { 502 if (!jid || !st) {
503 scr_LogPrint(LPRINT_NORMAL, "Wrong usage"); 503 scr_LogPrint(LPRINT_NORMAL, "Wrong usage");
504 } else if (check_jid_syntax(jid)) { 504 free_arg_lst(paramlst);
505 scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", jid); 505 return;
506 }
507
508 // Allow things like /status_to "" away
509 if (!*jid)
510 jid = NULL;
511
512 if (jid) {
513 // The JID has been specified. Quick check...
514 if (check_jid_syntax(jid)) {
515 scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", jid);
516 jid = NULL;
517 } else {
518 mc_strtolower(jid);
519 }
506 } else { 520 } else {
521 // Add the current buddy
522 if (current_buddy)
523 jid = (char*)buddy_getjid(BUDDATA(current_buddy));
524 if (!jid)
525 scr_LogPrint(LPRINT_NORMAL, "Please specify a Jabber id");
526 }
527
528 if (jid) {
507 char *cmd; 529 char *cmd;
508 if (!msg) 530 if (!msg)
509 msg = ""; 531 msg = "";
510 mc_strtolower(jid); 532 mc_strtolower(jid);
511 cmd = g_strdup_printf("%s %s", st, msg); 533 cmd = g_strdup_printf("%s %s", st, msg);