[asterisk-commits] branch mogorman/asterisk-xmpp r17180 -
/team/mogorman/asterisk-xmpp/res/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Apr 3 14:44:22 MST 2006
Author: mogorman
Date: Mon Apr 3 16:44:21 2006
New Revision: 17180
URL: http://svn.digium.com/view/asterisk?rev=17180&view=rev
Log:
ooh its even cleaner
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=17180&r1=17179&r2=17180&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/res/res_xmpp.c (original)
+++ team/mogorman/asterisk-xmpp/res/res_xmpp.c Mon Apr 3 16:44:21 2006
@@ -392,7 +392,7 @@
}
}
} else if (!strcmp("failure",iks_name(node))) {
- ast_verbose("ENCRYPTION FAILURE");
+ ast_verbose("XMPP: encryption failure.\n");
} else if (!strcmp("success",iks_name(node))) {
client->authorized=1;
iks_send_header(client->p,client->jid->server);
@@ -424,12 +424,12 @@
break;
}
case IKS_NODE_ERROR: {
- ast_verbose("Danger Danger will robinson\n");
+ ast_verbose("XMPP: Node Error\n");
return IKS_HOOK;
break;
}
case IKS_NODE_STOP: {
- ast_verbose("You got discoed!\n");
+ ast_verbose("XMPP: Disconnected\n");
return IKS_HOOK;
break;
}
@@ -452,7 +452,6 @@
static void axi_handle_iq(struct axi_client *client, iks *node)
{
if(iks_packet(node)->subtype==IKS_TYPE_GET) {
- ast_verbose("this is it %s\n",iks_string(client->stack,iks_packet(node)->query));
if(iks_find_with_attrib(iks_packet(node)->x,"query","xmlns","http://jabber.org/protocol/disco#info")) {
axi_handle_discovery(client,iks_packet(node));
}
@@ -463,10 +462,8 @@
}
if(iks_packet(node)->subtype==IKS_TYPE_RESULT) {
char *data;
- ast_verbose("RESULTITH TO THE QUERY!!\n");
data = iks_find_attrib(iks_packet(node)->x, "id");
if(data) {
- ast_verbose("STEP 2 %s \n", data);
if(strstr(data,"j:")) {
if(strstr(data,"active:"))
jingle_callback(client,iks_copy(node));
@@ -493,9 +490,6 @@
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");
-
}
/*!
@@ -592,7 +586,7 @@
if(message_packet)
iks_delete(message_packet);
} else
- ast_verbose("We arent connected dont send\n");
+ ast_verbose("XMPP: Not connected can't send\n");
return 1;
}
@@ -838,10 +832,8 @@
switch(iterator->on_roster)
{
case AXI_DONOTHING:
- ast_verbose("Already in list and a buddy %s\n",iterator->name);
break;
case AXI_PRUNE:
- ast_verbose("PRUNE THIS USER %s\n",iterator->name);
res =iks_send(client->p,iks_make_s10n(IKS_TYPE_UNSUBSCRIBE,iterator->name,"GoodBye your status is no longer needed by Asterisk the Open Source PBX so I am no longer subscribing to your presence.\n"));
res =iks_send(client->p,iks_make_s10n(IKS_TYPE_UNSUBSCRIBED,iterator->name,"GoodBye you are no longer in the asterisk config file so I am removing your access to my presence.\n"));
removeiq = iks_new("iq");
@@ -863,7 +855,6 @@
iks_delete(removeitem);
break;
case AXI_REGISTER:
- ast_verbose("REGISTER THIS USER %s\n",iterator->name);
if(iterator->btype==AXI_USER) { /*if it is not a transport */
res =iks_send(client->p,iks_make_s10n(IKS_TYPE_SUBSCRIBE,iterator->name,"Greetings I am the Asterisk Open Source PBX and I want to subscribe to your presence\n"));
} else {
@@ -994,7 +985,6 @@
if(client->state==AXI_DISCONNECTED) {
client->state=AXI_CONNECTING;
client->jid =(iks_find_cdata(pak->query,"jid"))?iks_id_new(iks_parser_stack(client->p),iks_find_cdata(pak->query,"jid")):client->jid;
- ast_verbose("HELLO %s anddd %s\n",client->jid->full,iks_find_cdata(pak->query,"jid"));
iks_filter_remove_hook(client->f,axi_client_connect);
}
@@ -1079,13 +1069,11 @@
iks_set_log_hook(client->p,axi_log_hook);
if(!strchr(client->user,'/')) {
- ast_verbose("blah blaah!\n");
resource = (char *)malloc(strlen(client->user) + 9); /*+ 9 for asterisk / */
sprintf(resource,"%s/asterisk", client->user);
client->jid = iks_id_new(iks_parser_stack(client->p),resource);
free(resource);
} else {
- ast_verbose("ssddblah blaah!\n");
client->jid = iks_id_new(iks_parser_stack(client->p),client->user);
}
connected = iks_connect_via(client->p, client->serverhost, client->port, client->server);
@@ -1125,7 +1113,7 @@
int ast_axi_disconnect(struct axi_client *client)
{
if(client) {
- ast_verbose(VERBOSE_PREFIX_3"DISCO!\n");
+ ast_verbose(VERBOSE_PREFIX_3"XMPP: Disconnecting\n");
iks_disconnect(client->p);
iks_parser_delete(client->p);
ASTOBJ_UNREF(client, axi_client_destroy);
@@ -1326,11 +1314,9 @@
int ast_axi_jingle_register(int (*func)(struct axi_client *client, iks *node))
{
if(func) {
- ast_verbose("XXXXXXXXXXXXXXXXXX REGISTERED\n");
jingle_callback = func;
}
else {
- ast_verbose("XXXXXXXXXXXXXXXXXX UNREGISTERED");
jingle_callback = NULL;
}
return 1;
@@ -1561,56 +1547,30 @@
{
- if(!axi_load_config())
+ if(!axi_load_config()) {
+ ast_verbose("XMPP: Failed to load\n");
return 0;
- else {
-
- ASTOBJ_CONTAINER_TRAVERSE2(&clients,1,1, {
- ASTOBJ_RDLOCK(iterator1);
- ast_verbose("Label: %s\n",iterator1->name);
- ast_verbose("User: %s\n",iterator1->user);
- ast_verbose("Server: %s\n",iterator1->serverhost);
- ast_verbose("Host: %s\n",iterator1->server);
- ast_verbose("PASS: %s\n",iterator1->password);
- ast_verbose("USESASL: %d\n",iterator1->usesasl);
- ast_verbose("port: %d\n",iterator1->port);
- ast_verbose("debug: %d\n",iterator1->debug);
- ast_verbose("usetls: %d\n",iterator1->usetls);
- ast_verbose("forsessl: %d\n",iterator1->forcessl);
- ast_verbose("keepalive: %d\n",iterator1->keepalive);
- ast_verbose("pruneregister: %d\n",iterator1->pruneregister);
- ast_verbose("component: %d\n\n\n",iterator1->component);
- ASTOBJ_CONTAINER_TRAVERSE2(&iterator1->buddies,2,1, {
- ast_verbose("User: %s\n",iterator2->name);
- ast_verbose("User: %s\n",iterator2->user);
- ast_verbose("Pass: %s\n",iterator2->pass);
- ast_verbose("Host: %s\n",iterator2->host);
- ast_verbose("status: %d\n",iterator2->status);
- ast_verbose("DefChannel: %s\n\n",iterator2->channel);
+ } else {
+ ASTOBJ_CONTAINER_TRAVERSE(&clients,1, {
+ ASTOBJ_RDLOCK(iterator);
+ switch (iterator->component){
+
+ case AXI_COMPONENT:
+ axi_component_initialize(iterator);
+ break;
+ case AXI_CLIENT:
+ axi_client_initialize(iterator);
+ break;
+ }
+ ast_pthread_create(&iterator->thread, NULL, axi_recv_loop, iterator);
+ ASTOBJ_UNLOCK(iterator);
});
- ASTOBJ_UNLOCK(iterator1);
- });
-
- ASTOBJ_CONTAINER_TRAVERSE(&clients,1, {
- ASTOBJ_RDLOCK(iterator);
- switch (iterator->component){
-
- case AXI_COMPONENT:
- axi_component_initialize(iterator);
- break;
- case AXI_CLIENT:
- axi_client_initialize(iterator);
- break;
- }
- ast_pthread_create(&iterator->thread, NULL, axi_recv_loop, iterator);
- ASTOBJ_UNLOCK(iterator);
- });
- ast_register_application(app_axisend, axi_send_exec, axisend_synopsis, axisend_descrip);
- ast_register_application(app_axistatus,axi_status_exec,axistatus_synopsis,axistatus_descrip);
- ast_cli_register_multiple(axi_cli,sizeof(axi_cli) / sizeof(axi_cli[0]));
- ast_log(LOG_NOTICE, "res_xmpp.so loaded.\n");
- ast_install_xmpp_functions(ast_axi_check_roster,ast_axi_send,ast_axi_register2);
- return 0;
+ ast_register_application(app_axisend, axi_send_exec, axisend_synopsis, axisend_descrip);
+ ast_register_application(app_axistatus,axi_status_exec,axistatus_synopsis,axistatus_descrip);
+ ast_cli_register_multiple(axi_cli,sizeof(axi_cli) / sizeof(axi_cli[0]));
+ ast_log(LOG_NOTICE, "res_xmpp.so loaded.\n");
+ ast_install_xmpp_functions(ast_axi_check_roster,ast_axi_send,ast_axi_register2);
+ return 0;
}
}
More information about the asterisk-commits
mailing list