[asterisk-commits] branch mogorman/asterisk-xmpp - r7772
/team/mogorman/asterisk-xmpp/res/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Jan 3 23:37:42 CST 2006
Author: mogorman
Date: Tue Jan 3 23:37:41 2006
New Revision: 7772
URL: http://svn.digium.com/view/asterisk?rev=7772&view=rev
Log:
Hmm i think i added some comments but not much else.
getting it in sync so i can work on it from work tommorrow.
Modified:
team/mogorman/asterisk-xmpp/res/res_xmpp.c
Modified: team/mogorman/asterisk-xmpp/res/res_xmpp.c
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/res/res_xmpp.c?rev=7772&r1=7771&r2=7772&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/res/res_xmpp.c (original)
+++ team/mogorman/asterisk-xmpp/res/res_xmpp.c Tue Jan 3 23:37:41 2006
@@ -12,6 +12,11 @@
*
* This program is free software, distributed under the terms of
* the GNU General Public License
+ */
+
+/*! \file
+ * \brief A resource for interfacing asterisk directly as a client
+ * or a component to a xmpp compliant server.
*/
#include <stdlib.h>
@@ -83,6 +88,8 @@
static int axi_register_transport2(void *udata,ikspak *pak);
static void axi_increment_mid(char *mid);
static int axi_filter_roster(void *udata,ikspak *pak);
+unsigned char * base64_encode(const unsigned char *in, size_t len);
+static void axi_handle_discovery(struct axi_master *asterisk, ikspak *pak);
static char debug_usage[] =
"Usage: XMPP debug\n"
@@ -113,6 +120,12 @@
struct axi_master_container masters;
+
+/*!
+ * \brief Deletes the axi_master data structure.
+ * \param obj is the structure we will delete.
+ * \return void.
+ */
static void axi_master_destroy(struct axi_master *obj){
ASTOBJ_CONTAINER_DESTROYALL(&obj->buddies,axi_buddy_destroy);
ASTOBJ_CONTAINER_DESTROY(&obj->buddies);
@@ -399,6 +412,7 @@
ast_verbose(VERBOSE_PREFIX_3 "XMPP: I Dont know S10N subscribe!!\n");
break;
case IKS_PAK_IQ:
+ ast_verbose(VERBOSE_PREFIX_3 "XMPP: I Dont have an IQ!!!\n");
axi_handle_iq(asterisk,pak);
ast_verbose(VERBOSE_PREFIX_3 "XMPP: I Dont have an IQ!!!\n");
break;
@@ -434,8 +448,33 @@
}
*/
}
+
static void axi_handle_iq(struct axi_master *asterisk, ikspak *pak)
{
+ if(pak->subtype==IKS_TYPE_GET){
+ ast_verbose("this is it %s\n",iks_string(asterisk->stack,pak->query));
+ if(iks_find_with_attrib(pak->x,"query","xmlns","http://jabber.org/protocol/disco#info")){
+ axi_handle_discovery(asterisk,pak);
+ }
+ }
+}
+
+static void axi_handle_discovery(struct axi_master *asterisk, ikspak *pak)
+{
+ iks *iq, *query,*identify;
+ iq = iks_make_iq(IKS_TYPE_RESULT,"jabber:client");
+ query = iks_new("query");
+ identify = iks_new("identify");
+ if(iks_find_attrib(pak->x, "id"))
+ iks_insert_attrib(iq,"id",iks_find_attrib(pak->x, "id"));
+ if(iks_find_attrib(pak->x,"from"))
+ iks_insert_attrib(iq,"to",iks_find_attrib(pak->x,"from"));
+ iks_insert_attrib(query,"xmlns","http://jabber.org/protocol/disco#info");
+ iks_insert_attrib(identify,"category","client");
+ iks_insert_attrib(identify,"type","pc");
+
+ ast_verbose("I rule you!\n");
+
}
int ast_axi_check_roster(void)
More information about the asterisk-commits
mailing list