Changeset 63bbef4


Ignore:
Timestamp:
Jan 24, 2007, 5:24:05 PM (14 years ago)
Author:
Nelson Elhage <nelhage@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:
989fae0
Parents:
3ce5bdc
git-author:
Nelson Elhage <nelhage@mit.edu> (01/24/07 17:03:51)
git-committer:
Nelson Elhage <nelhage@mit.edu> (01/24/07 17:24:05)
Message:
s/Jid/JID/g
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/jabber.pl

    r3ce5bdc r63bbef4  
    155155}
    156156
    157 sub getJids {
     157sub getJIDs {
    158158    my $self = shift;
    159159    return keys %{ $self };
     
    248248    }
    249249
    250     foreach my $jid ( $conn->getJids() ) {
     250    foreach my $jid ( $conn->getJIDs() ) {
    251251        my $client = $conn->getConnectionFromJID($jid);
    252252
     
    335335sub onGetBuddyList {
    336336    my $blist = "";
    337     foreach my $jid ($conn->getJids()) {
     337    foreach my $jid ($conn->getJIDs()) {
    338338        $blist .= getSingleBuddyList($jid);
    339339    }
     
    513513            my $errStr =
    514514              "You are logged into multiple accounts. Please specify an account to log out of.\n";
    515             foreach my $jid ( $conn->getJids() ) {
     515            foreach my $jid ( $conn->getJIDs() ) {
    516516                $errStr .= "\t$jid\n";
    517517            }
     
    522522            if ( $_[1] eq '-a' )    #All accounts.
    523523            {
    524                 foreach my $jid ( $conn->getJids() ) {
     524                foreach my $jid ( $conn->getJIDs() ) {
    525525                    do_logout($jid);
    526526                }
     
    535535    else                            # Only one account logged in.
    536536    {
    537         do_logout( ( $conn->getJids() )[0] );
     537        do_logout( ( $conn->getJIDs() )[0] );
    538538    }
    539539    return "";
     
    541541
    542542sub cmd_jlist {
    543     if ( !( scalar $conn->getJids() ) ) {
     543    if ( !( scalar $conn->getJIDs() ) ) {
    544544        BarnOwl::error("You are not logged in to Jabber.");
    545545        return;
     
    672672      or die("Usage: jmuc join MUC [-p password] [-a account]");
    673673
    674     $conn->getConnectionFromJID($jid)->MUCJoin(Jid      => $muc,
     674    $conn->getConnectionFromJID($jid)->MUCJoin(JID      => $muc,
    675675                                                  Password => $password,
    676676                                                  History  => {
     
    794794    my @groups = @{ shift() };
    795795    my $purgeGroups = shift;
    796     my $baseJid = baseJID($jid);
     796    my $baseJID = baseJID($jid);
    797797
    798798    my $roster = $conn->getRosterFromJID($jid);
     
    809809        $p->SetTo($to);
    810810        $conn->getConnectionFromJID($jid)->Send($p);
    811         queue_admin_msg("You ($baseJid) have requested a subscription to ($to)'s presence.");
     811        queue_admin_msg("You ($baseJID) have requested a subscription to ($to)'s presence.");
    812812    }
    813813}
     
    818818    my @groups = @{ shift() };
    819819    my $purgeGroups = shift;
    820     my $baseJid = baseJID($jid);
     820    my $baseJID = baseJID($jid);
    821821
    822822    my $p = new Net::XMPP::Presence;
     
    825825        $p->SetTo($to);
    826826        $conn->getConnectionFromJID($jid)->Send($p);
    827         queue_admin_msg("You ($baseJid) have unsubscribed from ($to)'s presence.");
     827        queue_admin_msg("You ($baseJID) have unsubscribed from ($to)'s presence.");
    828828    }
    829829}
     
    834834    my @groups = @{ shift() };
    835835    my $purgeGroups = shift;
    836     my $baseJid = baseJID($jid);
     836    my $baseJID = baseJID($jid);
    837837
    838838    my $roster = $conn->getRosterFromJID($jid);
     
    867867        $item->put_attrib(name => $name) if $name;
    868868        $conn->getConnectionFromJID($jid)->Send($iq);
    869         my $msg = "$baseJid: "
     869        my $msg = "$baseJID: "
    870870          . ($name ? "$name ($to)" : "($to)")
    871871          . " is on your roster in the following groups: { "
     
    881881    my @groups = @{ shift() };
    882882    my $purgeGroups = shift;
    883     my $baseJid = baseJID($jid);
     883    my $baseJID = baseJID($jid);
    884884
    885885    my $iq = new Net::XMPP::IQ;
     
    891891        $item->put_attrib(jid => $to);
    892892        $conn->getConnectionFromJID($jid)->Send($iq);
    893         queue_admin_msg("You ($baseJid) have removed ($to) from your roster.");
     893        queue_admin_msg("You ($baseJID) have removed ($to) from your roster.");
    894894    }
    895895}
     
    900900    my @groups = @{ shift() };
    901901    my $purgeGroups = shift;
    902     my $baseJid = baseJID($jid);
     902    my $baseJID = baseJID($jid);
    903903
    904904    my $p = new Net::XMPP::Presence;
     
    907907        $p->SetTo($to);
    908908        $conn->getConnectionFromJID($jid)->Send($p);
    909         queue_admin_msg("($to) has been subscribed to your ($baseJid) presence.");
     909        queue_admin_msg("($to) has been subscribed to your ($baseJID) presence.");
    910910    }
    911911}
     
    916916    my @groups = @{ shift() };
    917917    my $purgeGroups = shift;
    918     my $baseJid = baseJID($jid);
     918    my $baseJID = baseJID($jid);
    919919
    920920    my $p = new Net::XMPP::Presence;
     
    923923        $p->SetTo($to);
    924924        $conn->getConnectionFromJID($jid)->Send($p);
    925         queue_admin_msg("($to) has been unsubscribed from your ($baseJid) presence.");
     925        queue_admin_msg("($to) has been unsubscribed from your ($baseJID) presence.");
    926926    }
    927927}
     
    10841084
    10851085    # Find a connection to reply with.
    1086     foreach my $jid ($conn->getJids()) {
    1087         my $cJid = new Net::XMPP::JID;
    1088         $cJid->SetJID($jid);
    1089         if ($to eq $cJid->GetJID('base') ||
    1090             $to eq $cJid->GetJID('full')) {
     1086    foreach my $jid ($conn->getJIDs()) {
     1087        my $cJID = new Net::XMPP::JID;
     1088        $cJID->SetJID($jid);
     1089        if ($to eq $cJID->GetJID('base') ||
     1090            $to eq $cJID->GetJID('full')) {
    10911091            my $reply = $p->Reply(type=>"unsubscribed");
    10921092            $conn->getConnectionFromJID($jid)->Send($reply);
     
    12391239
    12401240sub defaultJID {
    1241     return ( $conn->getJids() )[0] if ( $conn->connected() == 1 );
     1241    return ( $conn->getJIDs() )[0] if ( $conn->connected() == 1 );
    12421242    return;
    12431243}
    12441244
    12451245sub baseJID {
    1246     my $givenJidStr = shift;
    1247     my $givenJid    = new Net::XMPP::JID;
    1248     $givenJid->SetJID($givenJidStr);
    1249     return $givenJid->GetJID('base');
     1246    my $givenJIDStr = shift;
     1247    my $givenJID    = new Net::XMPP::JID;
     1248    $givenJID->SetJID($givenJIDStr);
     1249    return $givenJID->GetJID('base');
    12501250}
    12511251
    12521252sub resolveConnectedJID {
    1253     my $givenJidStr = shift;
    1254     my $givenJid    = new Net::XMPP::JID;
    1255     $givenJid->SetJID($givenJidStr);
     1253    my $givenJIDStr = shift;
     1254    my $givenJID    = new Net::XMPP::JID;
     1255    $givenJID->SetJID($givenJIDStr);
    12561256
    12571257    # Account fully specified.
    1258     if ( $givenJid->GetResource() ) {
     1258    if ( $givenJID->GetResource() ) {
    12591259        # Specified account exists
    1260         return $givenJidStr if ($conn->jidExists($givenJidStr) );
    1261         die("Invalid account: $givenJidStr");
     1260        return $givenJIDStr if ($conn->jidExists($givenJIDStr) );
     1261        die("Invalid account: $givenJIDStr");
    12621262    }
    12631263
    12641264    # Disambiguate.
    12651265    else {
    1266         my $matchingJid = "";
     1266        my $matchingJID = "";
    12671267        my $errStr =
    12681268          "Ambiguous account reference. Please specify a resource.\n";
    12691269        my $ambiguous = 0;
    12701270
    1271         foreach my $jid ( $conn->getJids() ) {
    1272             my $cJid = new Net::XMPP::JID;
    1273             $cJid->SetJID($jid);
    1274             if ( $givenJidStr eq $cJid->GetJID('base') ) {
    1275                 $ambiguous = 1 if ( $matchingJid ne "" );
    1276                 $matchingJid = $jid;
     1271        foreach my $jid ( $conn->getJIDs() ) {
     1272            my $cJID = new Net::XMPP::JID;
     1273            $cJID->SetJID($jid);
     1274            if ( $givenJIDStr eq $cJID->GetJID('base') ) {
     1275                $ambiguous = 1 if ( $matchingJID ne "" );
     1276                $matchingJID = $jid;
    12771277                $errStr .= "\t$jid\n";
    12781278            }
     
    12851285
    12861286        # Not one of ours.
    1287         elsif ( $matchingJid eq "" ) {
    1288             die("Invalid account: $givenJidStr");
     1287        elsif ( $matchingJID eq "" ) {
     1288            die("Invalid account: $givenJIDStr");
    12891289        }
    12901290
    12911291        # It's this one.
    12921292        else {
    1293             return $matchingJid;
     1293            return $matchingJID;
    12941294        }
    12951295    }
     
    13041304    my @jids = $roster->jids('all');
    13051305    for my $j (@jids) {
    1306         if(($roster->query($j, 'name') || "") eq $to) {
     1306        if(($roster->query($j, 'name') || $j->GetUserID()) eq $to) {
    13071307            return $j->GetJID('full');
    13081308        } elsif($j->GetJID('base') eq baseJID($to)) {
Note: See TracChangeset for help on using the changeset viewer.