diff -U4 -r asterisk-1.6.1.0/configs/jabber.conf.sample asterisk-1.6.1.0+sa0015228/configs/jabber.conf.sample --- asterisk-1.6.1.0/configs/jabber.conf.sample 2008-05-22 16:49:17.000000000 +0100 +++ asterisk-1.6.1.0+sa0015228/configs/jabber.conf.sample 2009-05-30 10:59:34.000000000 +0100 @@ -1,8 +1,9 @@ [general] ;debug=yes ;;Turn on debugging by default. ;autoprune=yes ;;Auto remove users from buddy list. ;autoregister=yes ;;Auto register users from buddy list. +;autoaccept=yes ;;Auto accept users' subscription requests. ;[asterisk] ;;label ;type=client ;;Client or Component connection ;serverhost=astjab.org ;;Route to server for example, diff -U4 -r asterisk-1.6.1.0/include/asterisk/jabber.h asterisk-1.6.1.0+sa0015228/include/asterisk/jabber.h --- asterisk-1.6.1.0/include/asterisk/jabber.h 2008-06-27 08:28:17.000000000 +0100 +++ asterisk-1.6.1.0+sa0015228/include/asterisk/jabber.h 2009-05-30 11:17:00.000000000 +0100 @@ -81,9 +81,10 @@ }; enum { AJI_AUTOPRUNE = (1 << 0), - AJI_AUTOREGISTER = (1 << 1) + AJI_AUTOREGISTER = (1 << 1), + AJI_AUTOACCEPT = (1 << 2) }; enum aji_btype { AJI_USER=0, diff -U4 -r asterisk-1.6.1.0/res/res_jabber.c asterisk-1.6.1.0+sa0015228/res/res_jabber.c --- asterisk-1.6.1.0/res/res_jabber.c 2008-11-02 23:56:13.000000000 +0000 +++ asterisk-1.6.1.0+sa0015228/res/res_jabber.c 2009-05-30 11:13:12.000000000 +0100 @@ -158,9 +158,9 @@ struct aji_client_container clients; struct aji_capabilities *capabilities = NULL; /*! \brief Global flags, initialized to default values */ -static struct ast_flags globalflags = { AJI_AUTOPRUNE | AJI_AUTOREGISTER }; +static struct ast_flags globalflags = { AJI_AUTOPRUNE | AJI_AUTOREGISTER | AJI_AUTOACCEPT }; /*! * \brief Deletes the aji_client data structure. * \param obj aji_client The structure we will delete. @@ -1739,24 +1739,26 @@ struct aji_buddy* buddy = NULL; switch (pak->subtype) { case IKS_TYPE_SUBSCRIBE: - presence = iks_new("presence"); - status = iks_new("status"); - if (presence && status) { - iks_insert_attrib(presence, "type", "subscribed"); - iks_insert_attrib(presence, "to", pak->from->full); - iks_insert_attrib(presence, "from", client->jid->full); - if (pak->id) - iks_insert_attrib(presence, "id", pak->id); - iks_insert_cdata(status, "Asterisk has approved subscription", 0); - iks_insert_node(presence, status); - ast_aji_send(client, presence); - } else - ast_log(LOG_ERROR, "Unable to allocate nodes\n"); + if (ast_test_flag(&client->flags, AJI_AUTOACCEPT)) { + presence = iks_new("presence"); + status = iks_new("status"); + if (presence && status) { + iks_insert_attrib(presence, "type", "subscribed"); + iks_insert_attrib(presence, "to", pak->from->full); + iks_insert_attrib(presence, "from", client->jid->full); + if (pak->id) + iks_insert_attrib(presence, "id", pak->id); + iks_insert_cdata(status, "Asterisk has approved subscription", 0); + iks_insert_node(presence, status); + ast_aji_send(client, presence); + } else + ast_log(LOG_ERROR, "Unable to allocate nodes\n"); - iks_delete(presence); - iks_delete(status); + iks_delete(presence); + iks_delete(status); + } if (client->component) aji_set_presence(client, pak->from->full, iks_find_attrib(pak->x, "to"), client->status, client->statusmessage); case IKS_TYPE_SUBSCRIBED: @@ -2685,8 +2687,10 @@ else if (!strcasecmp(var->name, "autoprune")) ast_set2_flag(&client->flags, ast_true(var->value), AJI_AUTOPRUNE); else if (!strcasecmp(var->name, "autoregister")) ast_set2_flag(&client->flags, ast_true(var->value), AJI_AUTOREGISTER); + else if (!strcasecmp(var->name, "autoaccept")) + ast_set2_flag(&client->flags, ast_true(var->value), AJI_AUTOACCEPT); else if (!strcasecmp(var->name, "buddy")) aji_create_buddy((char *)var->value, client); else if (!strcasecmp(var->name, "priority")) client->priority = atoi(var->value);