From: erickson Date: Wed, 29 Jul 2009 13:23:55 +0000 (+0000) Subject: set the 'from' address in outbound jabber messages X-Git-Tag: osrf_rel_2_0_1~354 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=700b4c54fd13305912d9f364eeecb1c5a72b8261;p=OpenSRF.git set the 'from' address in outbound jabber messages git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1731 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/include/opensrf/transport_client.h b/include/opensrf/transport_client.h index 2bd7605..d7dffb9 100644 --- a/include/opensrf/transport_client.h +++ b/include/opensrf/transport_client.h @@ -20,6 +20,8 @@ struct transport_client_struct { transport_message* msg_q_tail; transport_session* session; int error; + char* host; + char* xmpp_id; }; typedef struct transport_client_struct transport_client; diff --git a/src/libopensrf/transport_client.c b/src/libopensrf/transport_client.c index be83eb7..1d9f7fe 100644 --- a/src/libopensrf/transport_client.c +++ b/src/libopensrf/transport_client.c @@ -62,6 +62,7 @@ transport_client* client_init( const char* server, int port, const char* unix_pa client->session->message_callback = client_message_handler; client->error = 0; + client->host = strdup(server); return client; } @@ -71,6 +72,7 @@ int client_connect( transport_client* client, 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_connected( const transport_client* client ) { 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 @@ int client_free( transport_client* client ){ current = next; } + free(client->host); + free(client->xmpp_id); free( client ); return 1; }