Changeset 60986b2 for perl/modules/jabber.pl
- Timestamp:
- Jan 11, 2007, 4:02:37 PM (18 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 004caa5
- Parents:
- 12e5f17
- git-author:
- Nelson Elhage <nelhage@mit.edu> (01/11/07 15:59:46)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (01/11/07 16:02:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/jabber.pl
r5551208 r60986b2 1 1 # -*- mode: cperl; cperl-indent-level: 4; indent-tabs-mode: nil -*- 2 package owl_jabber;2 package BarnOwl::Jabber; 3 3 use warnings; 4 4 use strict; … … 22 22 # Implementing formatting and logging callbacks for C 23 23 # Appropriate callbacks for presence subscription messages. 24 # * Current behavior is auto-accept (default for Net::Jabber)25 24 # 26 25 ################################################################################ … … 29 28 ################################################################################ 30 29 ################################################################################ 31 package owl_jabber::ConnectionManager;30 package BarnOwl::Jabber::ConnectionManager; 32 31 sub new { 33 32 my $class = shift; … … 123 122 package owl_jabber; 124 123 125 our $conn = new owl_jabber::ConnectionManager unless $conn;;124 our $conn = new BarnOwl::Jabber::ConnectionManager unless $conn;; 126 125 our %vars; 127 126 … … 129 128 if ( *BarnOwl::queue_message{CODE} ) { 130 129 register_owl_commands(); 131 push @::onMainLoop, sub { owl_jabber::onMainLoop(@_) };132 push @::onGetBuddyList, sub { owl_jabber::onGetBuddyList(@_) };130 push @::onMainLoop, sub { BarnOwl::Jabber::onMainLoop(@_) }; 131 push @::onGetBuddyList, sub { BarnOwl::Jabber::onGetBuddyList(@_) }; 133 132 } else { 134 133 # Our owl doesn't support queue_message. Unfortunately, this … … 138 137 } 139 138 140 push @::onStartSubs, sub { owl_jabber::onStart(@_) };139 push @::onStartSubs, sub { BarnOwl::Jabber::onStart(@_) }; 141 140 142 141 sub onMainLoop { … … 329 328 #XXX Todo: Add more callbacks. 330 329 # * MUC presence handlers 330 # We use the anonymous subrefs in order to have the correct behavior 331 # when we reload 331 332 $client->SetMessageCallBacks( 332 chat => sub { owl_jabber::process_incoming_chat_message(@_) },333 error => sub { owl_jabber::process_incoming_error_message(@_) },334 groupchat => sub { owl_jabber::process_incoming_groupchat_message(@_) },335 headline => sub { owl_jabber::process_incoming_headline_message(@_) },336 normal => sub { owl_jabber::process_incoming_normal_message(@_) }333 chat => sub { BarnOwl::Jabber::process_incoming_chat_message(@_) }, 334 error => sub { BarnOwl::Jabber::process_incoming_error_message(@_) }, 335 groupchat => sub { BarnOwl::Jabber::process_incoming_groupchat_message(@_) }, 336 headline => sub { BarnOwl::Jabber::process_incoming_headline_message(@_) }, 337 normal => sub { BarnOwl::Jabber::process_incoming_normal_message(@_) } 337 338 ); 338 339 $client->SetPresenceCallBacks( 339 # available => sub { owl_jabber::process_presence_available(@_) },340 # unavailable => sub { owl_jabber::process_presence_available(@_) },341 subscribe => sub { owl_jabber::process_presence_subscribe(@_) },342 subscribed => sub { owl_jabber::process_presence_subscribed(@_) },343 unsubscribe => sub { owl_jabber::process_presence_unsubscribe(@_) },344 unsubscribed => sub { owl_jabber::process_presence_unsubscribed(@_) },345 error => sub { owl_jabber::process_presence_error(@_) });340 available => sub { BarnOwl::Jabber::process_presence_available(@_) }, 341 # unavailable => sub { BarnOwl::Jabber::process_presence_available(@_) }, 342 subscribe => sub { BarnOwl::Jabber::process_presence_subscribe(@_) }, 343 subscribed => sub { BarnOwl::Jabber::process_presence_subscribed(@_) }, 344 unsubscribe => sub { BarnOwl::Jabber::process_presence_unsubscribe(@_) }, 345 unsubscribed => sub { BarnOwl::Jabber::process_presence_unsubscribed(@_) }, 346 error => sub { BarnOwl::Jabber::process_presence_error(@_) }); 346 347 347 348 my $status = $client->Connect( %{ $vars{jlogin_connhash} } ); … … 544 545 545 546 $muc = shift @ARGV 546 or die("Usage: jmuc join {muc}[-p password] [-a account]");547 or die("Usage: jmuc join MUC [-p password] [-a account]"); 547 548 548 549 my $presence = new Net::Jabber::Presence; … … 561 562 562 563 $muc = shift @args if scalar @args; 563 die("Usage: jmuc part {muc}[-a account]") unless $muc;564 die("Usage: jmuc part MUC [-a account]") unless $muc; 564 565 565 566 $conn->getConnectionFromJidStr($jid)->PresenceSend( to => $muc, type => 'unavailable' ); … … 573 574 $muc = shift @args if scalar @args; 574 575 575 die('Usage: jmuc invite {jid}[muc] [-a account]')576 die('Usage: jmuc invite JID [muc] [-a account]') 576 577 unless $muc && $invite_jid; 577 578
Note: See TracChangeset
for help on using the changeset viewer.