[Opensrf-commits] r1731 - in trunk: include/opensrf src/libopensrf (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jul 29 09:23:56 EDT 2009
Author: erickson
Date: 2009-07-29 09:23:55 -0400 (Wed, 29 Jul 2009)
New Revision: 1731
Modified:
trunk/include/opensrf/transport_client.h
trunk/src/libopensrf/transport_client.c
Log:
set the 'from' address in outbound jabber messages
Modified: trunk/include/opensrf/transport_client.h
===================================================================
--- trunk/include/opensrf/transport_client.h 2009-07-29 12:53:49 UTC (rev 1730)
+++ trunk/include/opensrf/transport_client.h 2009-07-29 13:23:55 UTC (rev 1731)
@@ -20,6 +20,8 @@
transport_message* msg_q_tail;
transport_session* session;
int error;
+ char* host;
+ char* xmpp_id;
};
typedef struct transport_client_struct transport_client;
Modified: trunk/src/libopensrf/transport_client.c
===================================================================
--- trunk/src/libopensrf/transport_client.c 2009-07-29 12:53:49 UTC (rev 1730)
+++ trunk/src/libopensrf/transport_client.c 2009-07-29 13:23:55 UTC (rev 1731)
@@ -62,6 +62,7 @@
client->session->message_callback = client_message_handler;
client->error = 0;
+ client->host = strdup(server);
return client;
}
@@ -71,6 +72,7 @@
const char* username, const char* password, const char* resource,
int connect_timeout, enum TRANSPORT_AUTH_TYPE auth_type ) {
if(client == NULL) return 0;
+ client->xmpp_id = va_list_to_string("%s@%s/%s", username, client->host, resource);
return session_connect( client->session, username,
password, resource, connect_timeout, auth_type );
}
@@ -89,6 +91,7 @@
int client_send_message( transport_client* client, transport_message* msg ) {
if(client == NULL) return 0;
if( client->error ) return -1;
+ msg->sender = strdup(client->xmpp_id); // free'd in message_free
return session_send_msg( client->session, msg );
}
@@ -186,6 +189,8 @@
current = next;
}
+ free(client->host);
+ free(client->xmpp_id);
free( client );
return 1;
}
More information about the opensrf-commits
mailing list