source: perl/modules/jabber.pl @ b405ff6

barnowl_perlaimdebianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since b405ff6 was b405ff6, checked in by Nelson Elhage <nelhage@mit.edu>, 17 years ago
perltidying jabber.pl and adding an emacs modeline
  • Property mode set to 100644
File size: 21.2 KB
Line 
1# -*- mode: cperl; cperl-indent-level: 4; indent-tabs-mode: nil -*-
2package owl_jabber;
3use warnings;
4use strict;
5
6use Authen::SASL qw(Perl);
7use Net::Jabber;
8use Net::DNS;
9use Getopt::Long;
10
11################################################################################
12# owl perl jabber support
13#
14# XXX Todo:
15# Rosters for MUCs
16# More user feedback
17#  * joining MUC
18#  * parting MUC
19#  * presence (Roster and MUC)
20# Implementing formatting and logging callbacks for C
21# Appropriate callbacks for presence subscription messages.
22#  * Current behavior => auto-accept (default for Net::Jabber)
23#
24################################################################################
25
26our $connections;
27our %vars;
28
29sub onStart {
30    if ( eval { \&owl::queue_message } ) {
31        register_owl_commands();
32        push @::onMainLoop,     sub { owl_jabber::onMainLoop(@_) };
33        push @::onGetBuddyList, sub { owl_jabber::onGetBuddyList(@_) };
34    }
35    else {
36
37        # Our owl doesn't support queue_message. Unfortunately, this
38        # means it probably *also* doesn't support owl::error. So just
39        # give up silently.
40    }
41}
42
43push @::onStartSubs, sub { owl_jabber::onStart(@_) };
44
45sub onMainLoop {
46    return if ( !connected() );
47
48    foreach my $jid ( keys %$connections ) {
49        my $client = \$connections->{$jid}->{client};
50
51        my $status = $$client->Process(0);
52        if ( !defined($status) ) {
53            owl::error("Jabber account $jid disconnected!");
54            do_logout($jid);
55        }
56        if ($::shutdown) {
57            do_logout($jid);
58            return;
59        }
60    }
61}
62
63sub blist_listBuddy {
64    my $roster = shift;
65    my $buddy  = shift;
66    my $blistStr .= "    ";
67    my %jq  = $$roster->query($buddy);
68    my $res = $$roster->resource($buddy);
69
70    $blistStr .= $jq{name} ? $jq{name} : $buddy->GetJID();
71
72    if ($res) {
73        my %rq = $$roster->resourceQuery( $buddy, $res );
74        $blistStr .= " [" . ( $rq{show} ? $rq{show} : 'online' ) . "]";
75        $blistStr .= " " . $rq{status} if $rq{status};
76        $blistStr = boldify($blistStr);
77    }
78    else {
79        $blistStr .= $jq{ask} ? " [pending]" : " [offline]";
80    }
81
82    return $blistStr . "\n";
83}
84
85sub onGetBuddyList {
86    my $blist = "";
87    foreach my $jid ( keys %{$connections} ) {
88        my $roster = \$connections->{$jid}->{roster};
89        if ($$roster) {
90            $blist .= "\n" . boldify("Jabber Roster for $jid\n");
91
92            foreach my $group ( $$roster->groups() ) {
93                $blist .= "  Group: $group\n";
94                foreach my $buddy ( $$roster->jids( 'group', $group ) ) {
95                    $blist .= blist_listBuddy( $roster, $buddy );
96                }
97            }
98
99            my @unsorted = $$roster->jids('nogroup');
100            if (@unsorted) {
101                $blist .= "  [unsorted]\n";
102                foreach my $buddy (@unsorted) {
103                    $blist .= blist_listBuddy( $roster, $buddy );
104                }
105            }
106        }
107    }
108    return $blist;
109}
110
111################################################################################
112### Owl Commands
113sub register_owl_commands() {
114    owl::new_command(
115        jabberlogin => \&cmd_login,
116        { summary => "Log into jabber", }
117    );
118    owl::new_command(
119        jabberlogout => \&cmd_logout,
120        { summary => "Log out of jabber" }
121    );
122    owl::new_command(
123        jwrite => \&cmd_jwrite,
124        {
125            summary => "Send a Jabber Message",
126            usage   => "jwrite JID [-g] [-t thread] [-s subject]"
127        }
128    );
129    owl::new_command(
130        jlist => \&cmd_jlist,
131        {
132            summary => "Show your Jabber roster.",
133            usage   => "jlist"
134        }
135    );
136    owl::new_command(
137        jmuc => \&cmd_jmuc,
138        {
139            summary     => "Jabber MUC related commands.",
140            description => "jmuc sends jabber commands related to muc.\n\n"
141              . "The following commands are available\n\n"
142              . "join {muc}  Join a muc.\n\n"
143              . "part [muc]  Part a muc.\n"
144              . "            The muc is taken from the current message if not supplied.\n\n"
145              . "invite {jid} [muc]\n"
146              . "            Invite {jid} to [muc].\n"
147              . "            The muc is taken from the current message if not supplied.\n\n"
148              . "configure [muc]\n" "            Configure [muc].\n"
149              . "            Necessary to initalize a new MUC",
150            usage => "jmuc {command} {args}"
151        }
152    );
153}
154
155sub cmd_login {
156    my $cmd = shift;
157    my $jid = new Net::XMPP::JID;
158    $jid->SetJID(shift);
159
160    my $uid           = $jid->GetUserID();
161    my $componentname = $jid->GetServer();
162    my $resource      = $jid->GetResource() || 'owl';
163    $jid->SetResource($resource);
164    my $jidStr = $jid->GetJID('full');
165
166    if ( !$uid || !$componentname ) {
167        owl::error("usage: $cmd {jid}");
168        return;
169    }
170
171    if ( $connections->{$jidStr} ) {
172        owl::error("Already logged in as $jidStr.");
173        return;
174    }
175
176    my ( $server, $port ) = getServerFromJID($jid);
177
178    $connections->{$jidStr}->{client} = Net::Jabber::Client->new(
179        debuglevel => owl::getvar('debug') eq 'on' ? 1 : 0,
180        debugfile => 'jabber.log'
181    );
182    my $client = \$connections->{$jidStr}->{client};
183    $connections->{$jidStr}->{roster} =
184      $connections->{$jidStr}->{client}->Roster();
185
186    #XXX Todo: Add more callbacks.
187    # MUC presence handlers
188    $$client->SetMessageCallBacks(
189        chat      => sub { owl_jabber::process_incoming_chat_message(@_) },
190        error     => sub { owl_jabber::process_incoming_error_message(@_) },
191        groupchat => sub { owl_jabber::process_incoming_groupchat_message(@_) },
192        headline  => sub { owl_jabber::process_incoming_headline_message(@_) },
193        normal    => sub { owl_jabber::process_incoming_normal_message(@_) }
194    );
195
196    $vars{jlogin_connhash} = {
197        hostname      => $server,
198        tls           => 1,
199        port          => $port,
200        componentname => $componentname
201    };
202
203    my $status = $$client->Connect( %{ $vars{jlogin_connhash} } );
204
205    if ( !$status ) {
206        delete $connections->{$jidStr};
207        delete $vars{jlogin_connhash};
208        owl::error("We failed to connect");
209        return "";
210    }
211
212    $vars{jlogin_authhash} =
213      { username => $uid, resource => $resource, password => '' };
214    my @result = $$client->AuthSend( %{ $vars{jlogin_authhash} } );
215    if ( $result[0] ne 'ok' ) {
216        if ( $result[1] == 401 ) {
217            $vars{jlogin_jid} = $jidStr;
218            delete $connections->{$jidStr};
219            owl::start_password( "Password for $jidStr: ", \&do_login_with_pw );
220            return "";
221        }
222        owl::error(
223            "Error in connect: " . join( " ", $result[ 1 .. $#result ] ) );
224        do_logout($jidStr);
225        delete $vars{jlogin_connhash};
226        delete $vars{jlogin_authhash};
227        return "";
228    }
229    $connections->{$jidStr}->{roster}->fetch();
230    $$client->PresenceSend( priority => 1 );
231    queue_admin_msg("Connected to jabber as $jidStr");
232    delete $vars{jlogin_connhash};
233    delete $vars{jlogin_authhash};
234    return "";
235}
236
237sub do_login_with_pw {
238    $vars{jlogin_authhash}->{password} = shift;
239    my $jidStr = delete $vars{jlogin_jid};
240    if ( !$jidStr ) {
241        owl::error("Got password but have no jid!");
242    }
243
244    $connections->{$jidStr}->{client} = Net::Jabber::Client->new();
245    my $client = \$connections->{$jidStr}->{client};
246    $connections->{$jidStr}->{roster} =
247      $connections->{$jidStr}->{client}->Roster();
248
249    $$client->SetMessageCallBacks(
250        chat      => sub { owl_jabber::process_incoming_chat_message(@_) },
251        error     => sub { owl_jabber::process_incoming_error_message(@_) },
252        groupchat => sub { owl_jabber::process_incoming_groupchat_message(@_) },
253        headline  => sub { owl_jabber::process_incoming_headline_message(@_) },
254        normal    => sub { owl_jabber::process_incoming_normal_message(@_) }
255    );
256
257    my $status = $$client->Connect( %{ $vars{jlogin_connhash} } );
258    if ( !$status ) {
259        delete $connections->{$jidStr};
260        delete $vars{jlogin_connhash};
261        delete $vars{jlogin_authhash};
262        owl::error("We failed to connect");
263        return "";
264    }
265
266    my @result = $$client->AuthSend( %{ $vars{jlogin_authhash} } );
267
268    if ( $result[0] ne 'ok' ) {
269        owl::error(
270            "Error in connect: " . join( " ", $result[ 1 .. $#result ] ) );
271        do_logout($jidStr);
272        delete $vars{jlogin_connhash};
273        delete $vars{jlogin_authhash};
274        return "";
275    }
276
277    $connections->{$jidStr}->{roster}->fetch();
278    $$client->PresenceSend( priority => 1 );
279    queue_admin_msg("Connected to jabber as $jidStr");
280    delete $vars{jlogin_connhash};
281    delete $vars{jlogin_authhash};
282    return "";
283}
284
285sub do_logout {
286    my $jid = shift;
287    $connections->{$jid}->{client}->Disconnect();
288    delete $connections->{$jid};
289    queue_admin_msg("Jabber disconnected ($jid).");
290}
291
292sub cmd_logout {
293
294    # Logged into multiple accounts
295    if ( connected() > 1 ) {
296
297        # Logged into multiple accounts, no accout specified.
298        if ( !$_[1] ) {
299            my $errStr =
300"You are logged into multiple accounts. Please specify an account to log out of.\n";
301            foreach my $jid ( keys %$connections ) {
302                $errStr .= "\t$jid\n";
303            }
304            queue_admin_msg($errStr);
305        }
306
307        # Logged into multiple accounts, account specified.
308        else {
309            if ( $_[1] eq '-a' )    #All accounts.
310            {
311                foreach my $jid ( keys %$connections ) {
312                    do_logout($jid);
313                }
314            }
315            else                    #One account.
316            {
317                my $jid = resolveJID( $_[1] );
318                do_logout($jid) if ( $jid ne '' );
319            }
320        }
321    }
322    else                            # Only one account logged in.
323    {
324
325        do_logout( ( keys %$connections )[0] );
326    }
327    return "";
328}
329
330sub cmd_jlist {
331    if ( !( scalar keys %$connections ) ) {
332        owl::error("You are not logged in to Jabber.");
333        return;
334    }
335    owl::popless_ztext( onGetBuddyList() );
336}
337
338sub cmd_jwrite {
339    if ( !connected() ) {
340        owl::error("You are not logged in to Jabber.");
341        return;
342    }
343
344    my $jwrite_to      = "";
345    my $jwrite_from    = "";
346    my $jwrite_thread  = "";
347    my $jwrite_subject = "";
348    my $jwrite_type    = "chat";
349
350    my @args = @_;
351    shift;
352    local @ARGV = @_;
353    my $gc;
354    GetOptions(
355        'thread=s'  => \$jwrite_thread,
356        'subject=s' => \$jwrite_subject,
357        'account=s' => \$jwrite_from,
358        'groupchat' => \$gc
359    );
360    $jwrite_type = 'groupchat' if $gc;
361
362    if ( scalar @ARGV != 1 ) {
363        owl::error(
364            "Usage: jwrite JID [-g] [-t thread] [-s 'subject'] [-a account]");
365        return;
366    }
367    else {
368        $jwrite_to = shift @ARGV;
369    }
370
371    if ( !$jwrite_from ) {
372        if ( connected() == 1 ) {
373            $jwrite_from = ( keys %$connections )[0];
374        }
375        else {
376            owl::error("Please specify an account with -a {jid}");
377            return;
378        }
379    }
380    else {
381        $jwrite_from = resolveJID($jwrite_from);
382        return unless $jwrite_from;
383    }
384
385    $vars{jwrite} = {
386        to      => $jwrite_to,
387        from    => $jwrite_from,
388        subject => $jwrite_subject,
389        thread  => $jwrite_thread,
390        type    => $jwrite_type
391    };
392
393    owl::message(
394"Type your message below.  End with a dot on a line by itself.  ^C will quit."
395    );
396    owl::start_edit_win( join( ' ', @args ), \&process_owl_jwrite );
397}
398
399sub cmd_jmuc {
400    die "You are not logged in to Jabber" unless connected();
401    my $ocmd = shift;
402    my $cmd  = shift;
403    if ( !$cmd ) {
404
405        #XXX TODO: Write general usage for jmuc command.
406        return;
407    }
408
409    my %jmuc_commands = (
410        join      => \&jmuc_join,
411        part      => \&jmuc_part,
412        invite    => \&jmuc_invite,
413        configure => \&jmuc_configure
414    );
415    my $func = $jmuc_commands{$cmd};
416    if ( !$func ) {
417        owl::error("jmuc: Unknown command: $cmd");
418        return;
419    }
420
421    {
422        local @ARGV = @_;
423        my $jid;
424        my $muc;
425        my $m = owl::getcurmsg();
426        if ( $m->is_jabber && $m->{jtype} eq 'groupchat' ) {
427            $muc = $m->{room};
428            $jid = $m->{to};
429        }
430
431        my $getopt = Getopt::Long::Parser->new;
432        $getopt->configure('pass_through');
433        $getopt->getoptions( 'account=s' => \$jid );
434        $jid ||= defaultJID();
435        if ($jid) {
436            $jid = resolveJID($jid);
437            return unless $jid;
438        }
439        else {
440            owl::error('You must specify an account with -a {jid}');
441        }
442        return $func->( $jid, $muc, @ARGV );
443    }
444}
445
446sub jmuc_join {
447    my ( $jid, $muc, @args ) = @_;
448    local @ARGV = @args;
449    my $password;
450    GetOptions( 'password=s' => \$password );
451
452    $muc = shift @ARGV
453      or die("Usage: jmuc join {muc} [-p password] [-a account]");
454
455    my $x = new XML::Stream::Node('x');
456    $x->put_attrib( xmlns => 'http://jabber.org/protocol/muc' );
457    $x->add_child('history')->put_attrib( maxchars => '0' );
458
459    if ($password) {
460        $x->add_child('password')->add_cdata($password);
461    }
462
463    my $presence = new Net::Jabber::Presence;
464    $presence->SetPresence( to => $muc );
465    $presence->AddX($x);
466    $connections->{$jid}->{client}->Send($presence);
467}
468
469sub jmuc_part {
470    my ( $jid, $muc, @args ) = @_;
471
472    $muc = shift @args if scalar @args;
473    die("Usage: jmuc part {muc} [-a account]") unless $muc;
474
475    $connections->{$jid}->{client}
476      ->PresenceSend( to => $muc, type => 'unavailable' );
477    queue_admin_msg("$jid has left $muc.");
478}
479
480sub jmuc_invite {
481    my ( $jid, $muc, @args ) = @_;
482
483    my $invite_jid = shift @args;
484    $muc = shift @args if scalar @args;
485
486    die('Usage: jmuc invite {jid} [muc] [-a account]')
487      unless $muc && $invite_jid;
488
489    my $x = new XML::Stream::Node('x');
490    $x->put_attrib( xmlns => 'http://jabber.org/protocol/muc#user' );
491    $x->add_child('invite')->put_attrib( to => $invite_jid );
492
493    my $message = new Net::Jabber::Message;
494    $message->SetTo($muc);
495    $message->AddX($x);
496    $connections->{$jid}->{client}->Send($message);
497    queue_admin_msg("$jid has invited $invite_jid to $muc.");
498}
499
500Net::Jabber::Namespaces::add_ns(
501    ns  => "http://jabber.org/protocol/muc#owner",
502    tag => 'query',
503);
504
505sub jmuc_configure {
506    my ( $jid, $muc, @args ) = @_;
507    $muc = shift @args if scalar @args;
508    die("Usage: jmuc configure [muc]") unless $muc;
509    my $iq = Net::Jabber::IQ->new();
510    $iq->SetTo($muc);
511    $iq->SetType('set');
512    my $query = $iq->NewQuery("http://jabber.org/protocol/muc#owner");
513    my $x     = $query->NewChild("jabber:x:data");
514    $x->SetType('submit');
515
516    $connections->{$jid}->{client}->Send($iq);
517    queue_admin_msg("Accepted default instant configuration for $muc");
518}
519
520################################################################################
521### Owl Callbacks
522sub process_owl_jwrite {
523    my $body = shift;
524
525    my $j = new Net::XMPP::Message;
526    $body =~ s/\n\z//;
527    $j->SetMessage(
528        to   => $vars{jwrite}{to},
529        from => $vars{jwrite}{from},
530        type => $vars{jwrite}{type},
531        body => $body
532    );
533    $j->SetThread( $vars{jwrite}{thread} )   if ( $vars{jwrite}{thread} );
534    $j->SetSubject( $vars{jwrite}{subject} ) if ( $vars{jwrite}{subject} );
535
536    my $m = j2o( $j, 'out' );
537    if ( $vars{jwrite}{type} ne 'groupchat' ) {
538
539        #XXX TODO: Check for displayoutgoing.
540        owl::queue_message($m);
541    }
542    $connections->{ $vars{jwrite}{from} }->{client}->Send($j);
543    delete $vars{jwrite};
544}
545
546### XMPP Callbacks
547
548sub process_incoming_chat_message {
549    my ( $session, $j ) = @_;
550    owl::queue_message( j2o( $j, 'in' ) );
551}
552
553sub process_incoming_error_message {
554    my ( $session, $j ) = @_;
555    my %jhash = j2hash( $j, 'in' );
556    $jhash{type} = 'admin';
557    owl::queue_message( owl::Message->new(%jhash) );
558}
559
560sub process_incoming_groupchat_message {
561    my ( $session, $j ) = @_;
562
563    # HACK IN PROGRESS (ignoring delayed messages)
564    return if ( $j->DefinedX('jabber:x:delay') && $j->GetX('jabber:x:delay') );
565    owl::queue_message( j2o( $j, 'in' ) );
566}
567
568sub process_incoming_headline_message {
569    my ( $session, $j ) = @_;
570    owl::queue_message( j2o( $j, 'in' ) );
571}
572
573sub process_incoming_normal_message {
574    my ( $session, $j ) = @_;
575    my %props = j2hash( $j, 'in' );
576
577    # XXX TODO: handle things such as MUC invites here.
578
579    #    if ($j->HasX('http://jabber.org/protocol/muc#user'))
580    #    {
581    #   my $x = $j->GetX('http://jabber.org/protocol/muc#user');
582    #   if ($x->HasChild('invite'))
583    #   {
584    #       $props
585    #   }
586    #    }
587    #
588    owl::queue_message( owl::Message->new(%props) );
589}
590
591sub process_muc_presence {
592    my ( $session, $p ) = @_;
593    return unless ( $p->HasX('http://jabber.org/protocol/muc#user') );
594
595}
596
597### Helper functions
598
599sub j2hash {
600    my $j   = shift;
601    my $dir = shift;
602
603    my %props = (
604        type      => 'jabber',
605        direction => $dir
606    );
607
608    my $jtype = $props{jtype} = $j->GetType();
609    my $from = $j->GetFrom('jid');
610    my $to   = $j->GetTo('jid');
611
612    $props{from} = $from->GetJID('full');
613    $props{to}   = $to->GetJID('full');
614
615    $props{recipient}  = $to->GetJID('base');
616    $props{sender}     = $from->GetJID('base');
617    $props{subject}    = $j->GetSubject() if ( $j->DefinedSubject() );
618    $props{thread}     = $j->GetThread() if ( $j->DefinedThread() );
619    $props{body}       = $j->GetBody() if ( $j->DefinedBody() );
620    $props{error}      = $j->GetError() if ( $j->DefinedError() );
621    $props{error_code} = $j->GetErrorCode() if ( $j->DefinedErrorCode() );
622    $props{xml}        = $j->GetXML();
623
624    if ( $jtype eq 'chat' ) {
625        $props{replycmd} =
626          "jwrite " . ( ( $dir eq 'in' ) ? $props{from} : $props{to} );
627        $props{replycmd} .=
628          " -a " . ( ( $dir eq 'out' ) ? $props{from} : $props{to} );
629        $props{isprivate} = 1;
630    }
631    elsif ( $jtype eq 'groupchat' ) {
632        my $nick = $props{nick} = $from->GetResource();
633        my $room = $props{room} = $from->GetJID('base');
634        $props{replycmd} = "jwrite -g $room";
635        $props{replycmd} .=
636          " -a " . ( ( $dir eq 'out' ) ? $props{from} : $props{to} );
637
638        $props{sender} = $nick || $room;
639        $props{recipient} = $room;
640
641        if ( $props{subject} && !$props{body} ) {
642            $props{body} =
643              '[' . $nick . " has set the topic to: " . $props{subject} . "]";
644        }
645    }
646    elsif ( $jtype eq 'normal' ) {
647        $props{replycmd}  = undef;
648        $props{isprivate} = 1;
649    }
650    elsif ( $jtype eq 'headline' ) {
651        $props{replycmd} = undef;
652    }
653    elsif ( $jtype eq 'error' ) {
654        $props{replycmd} = undef;
655        $props{body}     = "Error "
656          . $props{error_code}
657          . " sending to "
658          . $props{from} . "\n"
659          . $props{error};
660    }
661
662    $props{replysendercmd} = $props{replycmd};
663    return %props;
664}
665
666sub j2o {
667    return owl::Message->new( j2hash(@_) );
668}
669
670sub queue_admin_msg {
671    my $err = shift;
672    my $m   = owl::Message->new(
673        type      => 'admin',
674        direction => 'none',
675        body      => $err
676    );
677    owl::queue_message($m);
678}
679
680sub boldify($) {
681    my $str = shift;
682
683    return '@b(' . $str . ')' if ( $str !~ /\)/ );
684    return '@b<' . $str . '>' if ( $str !~ /\>/ );
685    return '@b{' . $str . '}' if ( $str !~ /\}/ );
686    return '@b[' . $str . ']' if ( $str !~ /\]/ );
687
688    my $txt = "\@b($str";
689    $txt =~ s/\)/\)\@b\[\)\]\@b\(/g;
690    return $txt . ')';
691}
692
693sub getServerFromJID {
694    my $jid = shift;
695    my $res = new Net::DNS::Resolver;
696    my $packet =
697      $res->search( '_xmpp-client._tcp.' . $jid->GetServer(), 'srv' );
698
699    if ($packet)    # Got srv record.
700    {
701        my @answer = $packet->answer;
702        return $answer[0]{target}, $answer[0]{port};
703    }
704
705    return $jid->GetServer(), 5222;
706}
707
708sub connected {
709    return scalar keys %$connections;
710}
711
712sub defaultJID {
713    return ( keys %$connections )[0] if ( connected() == 1 );
714    return;
715}
716
717sub resolveJID {
718    my $givenJidStr = shift;
719    my $givenJid    = new Net::XMPP::JID;
720    $givenJid->SetJID($givenJidStr);
721
722    # Account fully specified.
723    if ( $givenJid->GetResource() ) {
724
725        # Specified account exists
726        if ( defined $connections->{$givenJidStr} ) {
727            return $givenJidStr;
728        }
729        else    #Specified account doesn't exist
730        {
731            owl::error("Invalid account: $givenJidStr");
732        }
733    }
734
735    # Disambiguate.
736    else {
737        my $matchingJid = "";
738        my $errStr =
739          "Ambiguous account reference. Please specify a resource.\n";
740        my $ambiguous = 0;
741
742        foreach my $jid ( keys %$connections ) {
743            my $cJid = new Net::XMPP::JID;
744            $cJid->SetJID($jid);
745            if ( $givenJidStr eq $cJid->GetJID('base') ) {
746                $ambiguous = 1 if ( $matchingJid ne "" );
747                $matchingJid = $jid;
748                $errStr .= "\t$jid\n";
749            }
750        }
751
752        # Need further disambiguation.
753        if ($ambiguous) {
754            queue_admin_msg($errStr);
755        }
756
757        # Not one of ours.
758        elsif ( $matchingJid eq "" ) {
759            owl::error("Invalid account: $givenJidStr");
760        }
761
762        # Log out this one.
763        else {
764            return $matchingJid;
765        }
766    }
767    return "";
768}
Note: See TracBrowser for help on using the repository browser.