Mercurial > hg
changeset 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 | aff6df4b408b |
children | 3edd3687c38d |
files | mcabber/src/commands.c |
diffstat | 1 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/commands.c Mon Dec 26 19:42:57 2005 +0100 +++ b/mcabber/src/commands.c Wed Dec 28 11:08:39 2005 +0100 @@ -530,13 +530,28 @@ id = *paramlst; nick = *(paramlst+1); - if (check_jid_syntax(id)) { + if (!id) + nick = NULL; // Allow things like: /add "" nick + else if (!*id) + id = NULL; + + if (id) { + // The JID has been specified. Quick check... + if (check_jid_syntax(id)) { + scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", id); + id = NULL; + } else { + mc_strtolower(id); + } + } else { + // Add the current buddy + if (current_buddy) + id = (char*)buddy_getjid(BUDDATA(current_buddy)); if (!id) - scr_LogPrint(LPRINT_NORMAL, "Wrong usage"); - else - scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", id); - } else { - mc_strtolower(id); + scr_LogPrint(LPRINT_NORMAL, "Please specify a Jabber id"); + } + + if (id) { // 2nd parameter = optional nickname jb_addbuddy(id, nick, NULL); scr_LogPrint(LPRINT_LOGNORM, "Sent presence notification request to <%s>",