[asterisk-commits] trunk r31275 - in /trunk: configs/ include/asterisk/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 1 00:49:48 MST 2006


Author: mogorman
Date: Thu Jun  1 02:49:47 2006
New Revision: 31275

URL: http://svn.digium.com/view/asterisk?rev=31275&view=rev
Log:
adds statusmessage customization from Julian Lyndon-Smith
and fixes bug with pruneregister

Modified:
    trunk/configs/jabber.conf.sample
    trunk/include/asterisk/jabber.h
    trunk/res/res_jabber.c

Modified: trunk/configs/jabber.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/jabber.conf.sample?rev=31275&r1=31274&r2=31275&view=diff
==============================================================================
--- trunk/configs/jabber.conf.sample (original)
+++ trunk/configs/jabber.conf.sample Thu Jun  1 02:49:47 2006
@@ -7,9 +7,11 @@
 ;type=client				;;Client or Component connection
 ;serverhost=astjab.org			;;Route to server for example,
 					;;	talk.google.com
-;username=asterisk at astjab.org/asterisk	;;username with optional roster.
+;username=asterisk at astjab.org/asterisk	;;Username with optional roster.
 ;secret=blah				;;Password
 ;port=5222				;;Port to use defaults to 5222
-;usetls=yes				;;use tls or not
-;usesasl=yes				;;use sasl or not
-;buddy=mogorman at astjab.org		;;manual addition of buddy to list.
+;usetls=yes				;;Use tls or not
+;usesasl=yes				;;Use sasl or not
+;buddy=mogorman at astjab.org		;;Manual addition of buddy to list.
+;statusmessage="I am available"		;;Have custom status message for
+					;;Asterisk.

Modified: trunk/include/asterisk/jabber.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/jabber.h?rev=31275&r1=31274&r2=31275&view=diff
==============================================================================
--- trunk/include/asterisk/jabber.h (original)
+++ trunk/include/asterisk/jabber.h Thu Jun  1 02:49:47 2006
@@ -93,6 +93,7 @@
 	char user[160];
 	char serverhost[160];
 	char context[100];
+	char statusmessage[256];
 	char sid[10]; /* Session ID */
 	char mid[6]; /* Message ID */
 	iksid *jid;

Modified: trunk/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_jabber.c?rev=31275&r1=31274&r2=31275&view=diff
==============================================================================
--- trunk/res/res_jabber.c (original)
+++ trunk/res/res_jabber.c Thu Jun  1 02:49:47 2006
@@ -377,14 +377,14 @@
 {
 	struct aji_client *client = NULL;
 
-	char *s = NULL, *sender = NULL, *recipiant = NULL, *message = NULL;
+	char *s = NULL, *sender = NULL, *recipient = NULL, *message = NULL;
 	if (data) {
 		s = ast_strdupa((char *) data);
 		if (s) {
 			sender = strsep(&s, "|");
 			if (sender && (sender[0] != '\0')) {
-				recipiant = strsep(&s, "|");
-				if (recipiant && (recipiant[0] != '\0')) {
+				recipient = strsep(&s, "|");
+				if (recipient && (recipient[0] != '\0')) {
 					message = s;
 				} else {
 					ast_log(LOG_ERROR, "Bad arguments \n");
@@ -401,8 +401,8 @@
 		ast_log(LOG_ERROR, "Out of memory\n");
 		return -1;
 	}
-	if (strchr(recipiant, '@') && message)
-		ast_aji_send(client, recipiant, message);
+	if (strchr(recipient, '@') && message)
+		ast_aji_send(client, recipient, message);
 	return 0;
 }
 
@@ -1019,7 +1019,7 @@
 
 	buddy = ASTOBJ_CONTAINER_FIND(&client->buddies, pak->from->partial);
 	if (!buddy) {
-		ast_log(LOG_WARNING, "Got presence packet from %s, somone not in our roster!!!!\n", pak->from->partial);
+		ast_log(LOG_WARNING, "Got presence packet from %s, someone not in our roster!!!!\n", pak->from->partial);
 		return;
 	}
 	status = (pak->show) ? pak->show : 6;
@@ -1475,6 +1475,8 @@
 	send = iks_make_iq(IKS_TYPE_GET, "http://jabber.org/protocol/disco#items");
 
 	if (client && removeiq && removequery && removeitem && send) {
+		iks_insert_node(removeiq, removequery);
+		iks_insert_node(removequery, removeitem);
 		ASTOBJ_CONTAINER_TRAVERSE(&client->buddies, 1, {
 			ASTOBJ_RDLOCK(iterator);
 			/* For an aji_buddy, both AUTOPRUNE and AUTOREGISTER will never
@@ -1491,8 +1493,6 @@
 				iks_insert_attrib(removequery, "xmlns", "jabber:iq:roster");
 				iks_insert_attrib(removeitem, "jid", iterator->name);
 				iks_insert_attrib(removeitem, "subscription", "remove");
-				iks_insert_node(removeiq, removequery);
-				iks_insert_node(removequery, removeitem);
 				res = iks_send(client->p, removeiq);
 			} else if (ast_test_flag(iterator, AJI_AUTOREGISTER)) {
 				if (iterator->btype == AJI_USER) {	/*if it is not a transport */
@@ -1639,7 +1639,7 @@
 	roster = iks_make_iq(IKS_TYPE_GET, IKS_NS_ROSTER);
 	if(roster) {
 		iks_insert_attrib(roster, "id", "roster");
-		aji_set_presence(client, client->jid->full, 1, "im available");
+		aji_set_presence(client, client->jid->full, 1, client->statusmessage);
 		iks_send(client->p, roster);
 	}
 	if (roster)
@@ -1920,6 +1920,8 @@
 	client->keepalive = 1;
 	client->timeout = 20;
 	client->component = AJI_CLIENT;
+	ast_copy_string(client->statusmessage, "Online and Available", sizeof(client->statusmessage));
+
 	if (flag) client->authorized = 0;
 	client->usesasl = 0;
 	if (flag) client->state = AJI_DISCONNECTED;
@@ -1930,6 +1932,8 @@
 			ast_copy_string(client->serverhost, var->value, sizeof(client->serverhost));
 		else if (!strcasecmp(var->name, "secret"))
 			ast_copy_string(client->password, var->value, sizeof(client->password));
+		else if (!strcasecmp(var->name, "statusmessage"))
+			ast_copy_string(client->statusmessage, var->value, sizeof(client->statusmessage));
 		else if (!strcasecmp(var->name, "port"))
 			client->port = atoi(var->value);
 		else if (!strcasecmp(var->name, "debug"))



More information about the asterisk-commits mailing list