mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 08:56:21 +00:00
fix: allow adding own JID to roster
Enable adding oneself to the roster. Self subscriptions are implicit according to XEP-0060 / XEP-0163. So we adapt the /sub command to handle this gracefully by just printing an informative message. Profanitys logic didn't handle own presence/when adding to roster correctly. This got fixed now. Fixes: https://github.com/profanity-im/profanity/issues/2084 Signed-off-by: Michael Vetter <jubalh@iodoru.org>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "xmpp/resource.h"
|
||||
#include "xmpp/contact.h"
|
||||
#include "xmpp/jid.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
typedef struct prof_roster_t
|
||||
{
|
||||
@@ -366,6 +367,19 @@ roster_add(const char* const barejid, const char* const name, GSList* groups, co
|
||||
}
|
||||
|
||||
g_hash_table_insert(roster->contacts, strdup(barejid), contact);
|
||||
|
||||
if (equals_our_barejid(barejid)) {
|
||||
GList* resources = connection_get_available_resources();
|
||||
GList* curr = resources;
|
||||
while (curr) {
|
||||
Resource* res = curr->data;
|
||||
Resource* res_copy = resource_copy(res);
|
||||
p_contact_set_presence(contact, res_copy);
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
g_list_free(resources);
|
||||
}
|
||||
|
||||
autocomplete_add(roster->barejid_ac, barejid);
|
||||
_add_name_and_barejid(name, barejid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user