summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorPhilippe Sultan <philippe.sultan@gmail.com>2008-02-29 13:12:34 +0000
committerPhilippe Sultan <philippe.sultan@gmail.com>2008-02-29 13:12:34 +0000
commit265f5cd62cae801394e503b17fcde1022742dffb (patch)
tree3dc17b50d59a43e3a4666ff54bf725aaaac556c6 /res
parentb341fa817e12b2478d84eeac85f143a46d99f4a3 (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: https://origsvn.digium.com/svn/asterisk/trunk@105210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_jabber.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c
index 51306ccfd..f5cabb11a 100644
--- a/res/res_jabber.c
+++ b/res/res_jabber.c
@@ -1723,8 +1723,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) {
@@ -1744,24 +1747,15 @@ 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"), client->status, client->statusmessage);
- }
-
- switch (pak->subtype) {
- case IKS_TYPE_SUBSCRIBE:
- ast_verb(5, "JABBER: Subscribe handled.\n");
- break;
case IKS_TYPE_SUBSCRIBED:
- ast_verb(5, "JABBER: Subscribed (%d) not handled.\n", pak->subtype);
- break;
- case IKS_TYPE_UNSUBSCRIBE:
- ast_verb(5, "JABBER: Unsubscribe (%d) not handled.\n", pak->subtype);
- break;
- case IKS_TYPE_UNSUBSCRIBED:
- ast_verb(5, "JABBER: Unsubscribed (%d) not handled.\n", pak->subtype);
- break;
- default: /*IKS_TYPE_ERROR: */
- ast_verb(5, "JABBER: Unknown pak subtype %d.\n", pak->subtype);
- break;
+ 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);
+ }
}
}