diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/command/command.c | 10 | ||||
-rw-r--r-- | src/contact.c | 4 | ||||
-rw-r--r-- | src/xmpp/stanza.c | 6 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/command/command.c b/src/command/command.c index c2fa1e26..2eb0adc0 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -275,14 +275,16 @@ static struct cmd_t main_commands[] = NULL } } }, { "/roster", - _cmd_roster, parse_args_with_freetext, 3, 3, - { "/roster nick jid handle", "Add or change a contacts handle.", - { "/roster nick jid handle", - "-----------------------", + _cmd_roster, parse_args_with_freetext, 2, 3, + { "/roster nick jid [handle]", "Add or change a contacts handle.", + { "/roster nick jid [handle]", + "-------------------------", "Change the nickname (handle) associated with a contact in your roster." + "If no handle is supplied, any existing handle will be removed.", "", "Example : /roster nick bob.smith@server.com bobby", "Example : /roster nick myfriend@chat.org My Friend", + "Example : /roster nick kai@server.com (clears handle)", NULL } } }, { "/info", diff --git a/src/contact.c b/src/contact.c index 32313fcb..c1e38514 100644 --- a/src/contact.c +++ b/src/contact.c @@ -80,7 +80,9 @@ p_contact_set_name(const PContact contact, const char * const name) FREE_SET_NULL(contact->name); } - contact->name = strdup(name); + if (name != NULL) { + contact->name = strdup(name); + } } gboolean diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index b368dd7f..722fe4dd 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -104,7 +104,11 @@ stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const jid, xmpp_stanza_t *item = xmpp_stanza_new(ctx); xmpp_stanza_set_name(item, STANZA_NAME_ITEM); xmpp_stanza_set_attribute(item, STANZA_ATTR_JID, jid); - xmpp_stanza_set_attribute(item, STANZA_ATTR_NAME, handle); + if (handle != NULL) { + xmpp_stanza_set_attribute(item, STANZA_ATTR_NAME, handle); + } else { + xmpp_stanza_set_attribute(item, STANZA_ATTR_NAME, ""); + } xmpp_stanza_add_child(query, item); xmpp_stanza_add_child(iq, query); |