diff options
author | phsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-29 13:05:15 +0000 |
---|---|---|
committer | phsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-29 13:05:15 +0000 |
commit | 53ac10b0db15e7c0ec5e5af8c375c325eb04644d (patch) | |
tree | 567a88b957267ffce9dcc34e16cc80ef4727d007 /res/res_jabber.c | |
parent | dc70203748f5c0afa54d449549d9200d0c11ea68 (diff) |
Automatically create new buddy upon reception of a presence stanza of
type subscribed.
(closes issue #12066)
Reported by: ffadaie
Patches:
branch-1.4-12066-1.diff uploaded by phsultan (license 73)
trunk-12066-1.diff uploaded by phsultan (license 73)
Tested by: ffadaie, phsultan
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@105209 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_jabber.c')
-rw-r--r-- | res/res_jabber.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c index 5d57eba80..37ef5a841 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -1385,8 +1385,11 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak) */ static void aji_handle_subscribe(struct aji_client *client, ikspak *pak) { - if(pak->subtype == IKS_TYPE_SUBSCRIBE) { - iks *presence = NULL, *status = NULL; + iks *presence = NULL, *status = NULL; + struct aji_buddy* buddy = NULL; + + switch (pak->subtype) { + case IKS_TYPE_SUBSCRIBE: presence = iks_new("presence"); status = iks_new("status"); if(presence && status) { @@ -1406,24 +1409,14 @@ static void aji_handle_subscribe(struct aji_client *client, ikspak *pak) iks_delete(status); if(client->component) aji_set_presence(client, pak->from->full, iks_find_attrib(pak->x, "to"), 1, client->statusmessage); - } - if (option_verbose > 4) { - switch (pak->subtype) { - case IKS_TYPE_SUBSCRIBE: - ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype); - break; - case IKS_TYPE_SUBSCRIBED: - ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype); - break; - case IKS_TYPE_UNSUBSCRIBE: - ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype); - break; - case IKS_TYPE_UNSUBSCRIBED: - ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype); - break; - default: /*IKS_TYPE_ERROR: */ + case IKS_TYPE_SUBSCRIBED: + buddy = ASTOBJ_CONTAINER_FIND(&client->buddies, pak->from->partial); + if (!buddy && pak->from->partial) { + aji_create_buddy(pak->from->partial, client); + } + default: + if (option_verbose > 4) { ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype); - break; } } } |