projects
/
MQR.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9cfa48d
)
simplify code and key names
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 7 Sep 2010 13:41:14 +0000
(13:41 +0000)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 7 Sep 2010 13:50:21 +0000
(13:50 +0000)
scripts/mqr-xmpp-client.pl
patch
|
blob
|
history
diff --git
a/scripts/mqr-xmpp-client.pl
b/scripts/mqr-xmpp-client.pl
index
00f3ebd
..
489ef83
100755
(executable)
--- a/
scripts/mqr-xmpp-client.pl
+++ b/
scripts/mqr-xmpp-client.pl
@@
-43,11
+43,11
@@
warn "# jid:$jid root:$room subscribe:$subscribe\n";
our $contacts;
our $muc_rooms;
our $contacts;
our $muc_rooms;
-our $redis = MQR::Redis->redis;
-
sub publish;
sub publish;
-MQR::Redis->redis->psubscribe( "MSG $subscribe", sub {
+sub redis { MQR::Redis->redis }
+
+redis->psubscribe( "MSG $subscribe", sub {
my ( $body, $channel ) = @_;
warn "<<<< ", dump( $channel, $body );
Encode::_utf8_on($body);
my ( $body, $channel ) = @_;
warn "<<<< ", dump( $channel, $body );
Encode::_utf8_on($body);
@@
-63,7
+63,7
@@
MQR::Redis->redis->psubscribe( "MSG $subscribe", sub {
}
}) if $subscribe;
}
}) if $subscribe;
-
MQR::Redis->
redis->psubscribe( "SEND $jid *", sub {
+redis->psubscribe( "SEND $jid *", sub {
my ( $body, $channel ) = @_;
warn "<<<< ",dump( $channel, $body );
Encode::_utf8_on($body);
my ( $body, $channel ) = @_;
warn "<<<< ",dump( $channel, $body );
Encode::_utf8_on($body);
@@
-91,7
+91,7
@@
$cl->reg_cb (
my ($cl, $room, $msg, $is_echo) = @_;
my $room_jid = $room->nick_jid;
$muc_rooms->{ $room_jid }++;
my ($cl, $room, $msg, $is_echo) = @_;
my $room_jid = $room->nick_jid;
$muc_rooms->{ $room_jid }++;
-
$redis->sadd( "presence/xmpp/muc
$jid" => $room_jid );
+
redis->sadd( "presence/rooms
$jid" => $room_jid );
warn "# MUC message ",dump( $room_jid, $msg->any_body, $is_echo );
return if $is_echo;
warn "# MUC message ",dump( $room_jid, $msg->any_body, $is_echo );
return if $is_echo;
@@
-151,8
+151,8
@@
warn "# MUC message ",dump( $room_jid, $msg->any_body, $is_echo );
my ($con,$account,$roster) = @_;
warn "XXXXX", ref($account), " | ", ref($roster);
foreach my $contact ( $roster->get_contacts ) {
my ($con,$account,$roster) = @_;
warn "XXXXX", ref($account), " | ", ref($roster);
foreach my $contact ( $roster->get_contacts ) {
- $contacts->{ $contact->
{jid}
}++;
-
$redis->sadd( "presence/xmpp/contacts $jid" => $contact->{jid}
);
+ $contacts->{ $contact->
jid
}++;
+
redis->sadd( "presence/contacts $jid" => $contact->jid
);
warn "# contacts ",dump($contacts);
}
warn "# contacts ",dump($contacts);
warn "# contacts ",dump($contacts);
}
warn "# contacts ",dump($contacts);