set the 'from' address in outbound xmpp messages
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 29 Jul 2009 12:53:49 +0000 (12:53 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 29 Jul 2009 12:53:49 +0000 (12:53 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1730 9efc2488-bf62-4759-914b-345cdb29e865

src/perl/lib/OpenSRF/Transport/SlimJabber/Client.pm

index e6f6705..f30abf5 100644 (file)
@@ -113,6 +113,7 @@ sub send {
        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);
 }
 
@@ -130,8 +131,6 @@ sub initialize {
        my $resource    = $self->params->{resource};
        my $password    = $self->params->{password};
 
-    my $jid = "$username\@$host/$resource";
-
        my $conf = OpenSRF::Utils::Config->current;
 
        my $tail = "_$$";
@@ -153,10 +152,19 @@ sub initialize {
     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