default => sub { ChainSet->new }
);
+has full_jid => (is => 'rw');
+
sub _build_xmpp_client {
my ($self) = @_;
$self->_login_xmpp_client($self->_new_child(XMPP_Client, {
my $me = $self->jabber_config->user;
+ return log_info {
+ "Received error message"
+ } if $msg->type eq 'error';
+
return log_debug {
"Received message for ${\$msg->to} instead of $me - ignoring"
- } unless $msg->to eq $me;
+ } unless $msg->to =~ /^\Q$me/; # may be foo@gmail.com or .../gsklgsh
+
+ $self->full_jid($msg->to); # need foo@gmail.com/skldshgsdg here
(my $from = $msg->from) =~ s/\/.*//;
sub send_xmpp_message {
my ($self, $args) = @_;
s/&/&/g, s/"/"/g, s/</</g, s/>/>/g for $args->{body};
+ $args->{from} = $self->full_jid;
$self->xmpp_client->compose(%$args)->send;
}