Permalink
Browse files

Jabber: Don’t break private replies in anonymous MUCs.

In commit 7c5d060 we changed the
Jabber message ‘from’ property to show less duplicate information as
the long_sender.  But in anonymous MUCs, we need the old ‘from’ for
private replies, so remove the duplicate information inside sub
long_sender instead in that case.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
  • Loading branch information...
1 parent 5d59c1e commit 2f25537acb67e620a5be5052f5c2f9a1e5fe3abd @andersk andersk committed Jun 10, 2010
@@ -19,6 +19,7 @@ sub jtype { shift->{jtype} };
sub from { shift->{from} };
sub to { shift->{to} };
sub room { shift->{room} };
+sub nick { shift->{nick} };
sub subject { shift->{subject} };
sub status { shift->{status} }
@@ -40,6 +41,13 @@ sub login_extra {
sub long_sender {
my $self = shift;
+ if ($self->jtype eq 'groupchat' && $self->nick) {
+ my $from_jid = Net::Jabber::JID->new($self->from);
+ if ($from_jid->GetJID('base') eq $self->room &&
+ $from_jid->GetResource() eq $self->nick) {
+ return $self->nick;
+ }
+ }
return $self->from;
}
@@ -1240,7 +1240,7 @@ sub j2hash {
my $connection = $conn->getConnectionFromJID($props{from});
$muc = $connection->FindMUC(jid => $to);
}
- $props{from} = $muc->GetFullJID($from) || $nick || $room;
+ $props{from} = $muc->GetFullJID($from) || $props{from};
$props{sender} = $nick || $room;
$props{recipient} = $room;

0 comments on commit 2f25537

Please sign in to comment.