client->session->message_callback = client_message_handler;
client->error = 0;
+ client->host = strdup(server);
return 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 );
}
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 );
}
current = next;
}
+ free(client->host);
+ free(client->xmpp_id);
free( client );
return 1;
}
my $self = shift;
my $msg = OpenSRF::Transport::SlimJabber::XMPPMessage->new(@_);
$msg->osrf_xid($logger->get_osrf_xid);
+ $msg->from($self->xmpp_id);
$self->reader->send($msg->to_xml);
}
my $resource = $self->params->{resource};
my $password = $self->params->{password};
- my $jid = "$username\@$host/$resource";
-
my $conf = OpenSRF::Utils::Config->current;
my $tail = "_$$";
throw OpenSRF::EX::Jabber("Could not authenticate with Jabber server: $@")
unless ( $self->reader->connected );
+ $self->xmpp_id("$username\@$host/$resource");
return $self;
}
+# Our full login: username@host/resource
+sub xmpp_id {
+ my($self, $xmpp_id) = @_;
+ $self->{xmpp_id} = $xmpp_id if $xmpp_id;
+ return $self->{xmpp_id};
+}
+
+
=head2 construct
=cut