comparison mcabber/src/commands.c @ 638:f6946251acdf

"/add" 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 11:08:39 +0100
parents f84cce8382e8
children 1cd7f8e3895b
comparison
equal deleted inserted replaced
637:aff6df4b408b 638:f6946251acdf
528 528
529 paramlst = split_arg(arg, 2, 0); // jid, [nickname] 529 paramlst = split_arg(arg, 2, 0); // jid, [nickname]
530 id = *paramlst; 530 id = *paramlst;
531 nick = *(paramlst+1); 531 nick = *(paramlst+1);
532 532
533 if (check_jid_syntax(id)) { 533 if (!id)
534 nick = NULL; // Allow things like: /add "" nick
535 else if (!*id)
536 id = NULL;
537
538 if (id) {
539 // The JID has been specified. Quick check...
540 if (check_jid_syntax(id)) {
541 scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", id);
542 id = NULL;
543 } else {
544 mc_strtolower(id);
545 }
546 } else {
547 // Add the current buddy
548 if (current_buddy)
549 id = (char*)buddy_getjid(BUDDATA(current_buddy));
534 if (!id) 550 if (!id)
535 scr_LogPrint(LPRINT_NORMAL, "Wrong usage"); 551 scr_LogPrint(LPRINT_NORMAL, "Please specify a Jabber id");
536 else 552 }
537 scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", id); 553
538 } else { 554 if (id) {
539 mc_strtolower(id);
540 // 2nd parameter = optional nickname 555 // 2nd parameter = optional nickname
541 jb_addbuddy(id, nick, NULL); 556 jb_addbuddy(id, nick, NULL);
542 scr_LogPrint(LPRINT_LOGNORM, "Sent presence notification request to <%s>", 557 scr_LogPrint(LPRINT_LOGNORM, "Sent presence notification request to <%s>",
543 id); 558 id);
544 } 559 }