Changeset b2648bc


Ignore:
Timestamp:
Jan 25, 2007, 12:03:54 AM (14 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
71e33ca
Parents:
45d9eb0
Message:
* Show full jid if base jid matches a muc in type 'chat'
* isa checks use Net::XMPP, objects use Net::Jabber
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/jabber.pl

    r45d9eb0 rb2648bc  
    9797                                     server => $args{server});
    9898    }
    99     $jid = $jid->GetJID('base') if UNIVERSAL::isa($jid, 'Net::Jabber::JID');
     99    $jid = $jid->GetJID('base') if UNIVERSAL::isa($jid, 'Net::XMPP::JID');
    100100
    101101    foreach my $muc ($self->MUCs) {
     
    266266        }
    267267        if ($vars{status_changed}) {
    268             my $p = new Net::XMPP::Presence;
     268            my $p = new Net::Jabber::Presence;
    269269            $p->SetShow($vars{show}) if $vars{show};
    270270            $p->SetStatus($vars{status}) if $vars{status};
     
    415415sub cmd_login {
    416416    my $cmd = shift;
    417     my $jid = new Net::XMPP::JID;
     417    my $jid = new Net::Jabber::JID;
    418418    $jid->SetJID(shift);
    419419    my $password = '';
     
    830830    $name = "" unless (1 == scalar(@ARGV));
    831831
    832     my $p = new Net::XMPP::Presence;
     832    my $p = new Net::Jabber::Presence;
    833833    $p->SetType('subscribe');
    834834
     
    849849    my $baseJID = baseJID($jid);
    850850
    851     my $p = new Net::XMPP::Presence;
     851    my $p = new Net::Jabber::Presence;
    852852    $p->SetType('unsubscribe');
    853853    foreach my $to (@ARGV) {
     
    872872    foreach my $to (@ARGV) {
    873873        my %jq  = $roster->query($to);
    874         my $iq = new Net::XMPP::IQ;
     874        my $iq = new Net::Jabber::IQ;
    875875        $iq->SetType('set');
    876876        my $item = new XML::Stream::Node('item');
     
    912912    my $baseJID = baseJID($jid);
    913913
    914     my $iq = new Net::XMPP::IQ;
     914    my $iq = new Net::Jabber::IQ;
    915915    $iq->SetType('set');
    916916    my $item = new XML::Stream::Node('item');
     
    931931    my $baseJID = baseJID($jid);
    932932
    933     my $p = new Net::XMPP::Presence;
     933    my $p = new Net::Jabber::Presence;
    934934    $p->SetType('subscribed');
    935935    foreach my $to (@ARGV) {
     
    947947    my $baseJID = baseJID($jid);
    948948
    949     my $p = new Net::XMPP::Presence;
     949    my $p = new Net::Jabber::Presence;
    950950    $p->SetType('unsubscribed');
    951951    foreach my $to (@ARGV) {
     
    961961    my $body = shift;
    962962
    963     my $j = new Net::XMPP::Message;
     963    my $j = new Net::Jabber::Message;
    964964    $body =~ s/\n\z//;
    965965    $j->SetMessage(
     
    978978    }
    979979
    980     $j->RemoveFrom(); # Kludge to get around gtalk's random bits after the resouce.
     980    $j->RemoveFrom(); # Kludge to get around gtalk's random bits after the resource.
    981981    if ($vars{jwrite}{sid} && $conn->sidExists( $vars{jwrite}{sid} )) {
    982982        $conn->getConnectionFromSid($vars{jwrite}{sid})->Send($j);
     
    11141114    # Find a connection to reply with.
    11151115    foreach my $jid ($conn->getJIDs()) {
    1116         my $cJID = new Net::XMPP::JID;
     1116        my $cJID = new Net::Jabber::JID;
    11171117        $cJID->SetJID($jid);
    11181118        if ($to eq $cJID->GetJID('base') ||
     
    11891189          " -a " . ( ( $dir eq 'out' ) ? $props{from} : $props{to} );
    11901190        $props{private} = 1;
     1191
     1192        my $connection;
     1193        if ($dir eq 'in') {
     1194            $connection = $conn->getConnectionFromSid($props{sid});
     1195        }
     1196        else {
     1197            $connection = $conn->getConnectionFromJID($props{from});
     1198        }
     1199
     1200        # Check to see if we're doing personals with someone in a muc.
     1201        # If we are, show the full jid because the base jid is the room.
     1202        if ($connection) {
     1203            $props{sender} = $props{from}
     1204              if ($connection->FindMUC(jid => $from));
     1205            $props{recipient} = $props{to}
     1206              if ($connection->FindMUC(jid => $to));
     1207        }
    11911208    }
    11921209    elsif ( $jtype eq 'groupchat' ) {
     
    12811298sub baseJID {
    12821299    my $givenJIDStr = shift;
    1283     my $givenJID    = new Net::XMPP::JID;
     1300    my $givenJID    = new Net::Jabber::JID;
    12841301    $givenJID->SetJID($givenJIDStr);
    12851302    return $givenJID->GetJID('base');
     
    12881305sub resolveConnectedJID {
    12891306    my $givenJIDStr = shift;
    1290     my $givenJID    = new Net::XMPP::JID;
     1307    my $givenJID    = new Net::Jabber::JID;
    12911308    $givenJID->SetJID($givenJIDStr);
    12921309
     
    13061323
    13071324        foreach my $jid ( $conn->getJIDs() ) {
    1308             my $cJID = new Net::XMPP::JID;
     1325            my $cJID = new Net::Jabber::JID;
    13091326            $cJID->SetJID($jid);
    13101327            if ( $givenJIDStr eq $cJID->GetJID('base') ) {
Note: See TracChangeset for help on using the changeset viewer.