[712] in BarnOwl Developers
[D-O-H] r765 - in branches/barnowl_sqlite: . owl owl/perl/modules/Jabber/lib/BarnOwl/Module owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber owl/perl/modules/Jabber/lib/Net/Jabber owl/perl/modules/Jabber/lib/XML
daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:08:56 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Wed, 19 Sep 2007 00:41:10 -0400 (EDT)
Author: nelhage
Date: 2007-09-19 00:41:09 -0400 (Wed, 19 Sep 2007)
New Revision: 765
Modified:
branches/barnowl_sqlite/
branches/barnowl_sqlite/owl/Makefile.in
branches/barnowl_sqlite/owl/configure.in
branches/barnowl_sqlite/owl/functions.c
branches/barnowl_sqlite/owl/owl.c
branches/barnowl_sqlite/owl/owl.h
branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/Net/Jabber/MUC.pm
branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/XML/Stream.pm
branches/barnowl_sqlite/owl/util.c
Log:
Merged revisions 755-764 via svnmerge from
svn+ssh://lunatique.mit.edu/mit/barnowl/src/svn/trunk
........
r756 | asedeno | 2007-08-17 12:48:37 -0400 (Fri, 17 Aug 2007) | 8 lines
Apply patch from:
http://rt.cpan.org/Public/Bug/Display.html?id=17484
Fixing problems with jabber servers keeping the same stream id when negotiating TLS.
Thanks to ghudson for tracking this down.
........
r757 | nelhage | 2007-08-17 17:26:44 -0400 (Fri, 17 Aug 2007) | 4 lines
When we're narrowing to an instance, properly include
un-instances. This fixes narrowing to any instance that starts with
``un-''
........
r758 | nelhage | 2007-08-27 19:17:20 -0400 (Mon, 27 Aug 2007) | 2 lines
Don't read before the start of the string for an instance
........
r759 | nelhage | 2007-09-07 00:13:45 -0400 (Fri, 07 Sep 2007) | 3 lines
Adding an explicit -f - to the tar commands for FreeBSD compatibility
(reported by ecprice)
........
r760 | ecprice | 2007-09-08 17:33:34 -0400 (Sat, 08 Sep 2007) | 3 lines
Fixes for FreeBSD.
........
r761 | nelhage | 2007-09-10 20:00:45 -0400 (Mon, 10 Sep 2007) | 3 lines
Use "" instead of `undef' as a default for messages with no reply
command to hopefully squelch perl warnings.
........
r762 | nelhage | 2007-09-12 21:37:41 -0400 (Wed, 12 Sep 2007) | 2 lines
Do ~-expansion in :loadsubs. closes #26
........
r763 | nelhage | 2007-09-12 21:54:51 -0400 (Wed, 12 Sep 2007) | 2 lines
Validate JIDs passed to jmuc join. closes #25
........
r764 | nelhage | 2007-09-12 22:46:17 -0400 (Wed, 12 Sep 2007) | 2 lines
Show full JIDs for users in non-anonymous JIDs in :jmuc presence. closes #24
........
Property changes on: branches/barnowl_sqlite
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-754
+ /trunk:1-764
Modified: branches/barnowl_sqlite/owl/Makefile.in
===================================================================
--- branches/barnowl_sqlite/owl/Makefile.in 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/Makefile.in 2007-09-19 04:41:09 UTC (rev 765)
@@ -126,7 +126,7 @@
${INSTALL_DATA} doc/owl.1 ${DESTDIR}${mandir}/man1/barnowl.1
${INSTALL} -d ${DESTDIR}${datadir}/lib
${INSTALL} -d ${DESTDIR}${datadir}/modules
- tar -C perl/lib --exclude .svn -c . | tar -C ${DESTDIR}${datadir}/lib -x
+ tar -C perl/lib --exclude .svn -cf - . | tar -C ${DESTDIR}${datadir}/lib -xf -
for i in $(PERL_MODULES); do \
${INSTALL_DATA} perl/modules/$$i/$$i.par ${DESTDIR}${datadir}/modules/$$i.par; \
done
Modified: branches/barnowl_sqlite/owl/configure.in
===================================================================
--- branches/barnowl_sqlite/owl/configure.in 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/configure.in 2007-09-19 04:41:09 UTC (rev 765)
@@ -30,11 +30,15 @@
fi
dnl Check for kerberosIV include
-AC_MSG_CHECKING(for /usr/include/kerberosIV)
+AC_MSG_CHECKING(for kerberosIV)
if test -d /usr/include/kerberosIV; then
CFLAGS=${CFLAGS}\ -I/usr/include/kerberosIV
CPPFLAGS=${CPPFLAGS}\ -I/usr/include/kerberosIV
AC_MSG_RESULT(yes)
+elif test -d /usr/local/include/kerberosIV; then
+ CFLAGS=${CFLAGS}\ -I/usr/local/include/kerberosIV
+ CPPFLAGS=${CPPFLAGS}\ -I/usr/local/include/kerberosIV
+ AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
@@ -99,15 +103,12 @@
XSUBPPFLAGS=""
fi
-dnl Add LDFLAGS for embeded perl
+dnl Add LDFLAGS for embedded perl
FOO=`perl -MExtUtils::Embed -e ldopts`
echo Adding perl LDFLAGS ${FOO}
LDFLAGS=${LDFLAGS}\ ${FOO}
dnl Checks for typedefs, structures, and compiler characteristics.
-AC_CHECK_FILE(/usr/share/terminfo, AC_DEFINE(TERMINFO, "/usr/share/terminfo", [Have terminfo]),
- AC_CHECK_FILE(/usr/share/lib/terminfo, AC_DEFINE(TERMINFO, "/usr/share/lib/terminfo", [Have terminfo]),
- AC_MSG_ERROR(No terminfo found for this system)))
AC_SUBST(XSUBPPDIR)
AC_SUBST(XSUBPPFLAGS)
Modified: branches/barnowl_sqlite/owl/functions.c
===================================================================
--- branches/barnowl_sqlite/owl/functions.c 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/functions.c 2007-09-19 04:41:09 UTC (rev 765)
@@ -848,12 +848,14 @@
void owl_function_loadsubs(char *file)
{
int ret, ret2;
- char *foo;
+ char *foo, *path;
if (file==NULL) {
ret=owl_zephyr_loadsubs(NULL, 0);
} else {
- ret=owl_zephyr_loadsubs(file, 1);
+ path = owl_util_makepath(file);
+ ret=owl_zephyr_loadsubs(path, 1);
+ free(path);
}
/* for backwards compatibility for now */
@@ -2624,7 +2626,7 @@
argbuff = owl_malloc(len);
sprintf(argbuff, "class ^(un)*%s(\\.d)*$", tmpclass);
if (tmpinstance) {
- sprintf(argbuff, "%s and ( instance ^%s(\\.d)*$ )", argbuff, tmpinstance);
+ sprintf(argbuff, "%s and ( instance ^(un)*%s(\\.d)*$ )", argbuff, tmpinstance);
}
owl_free(tmpclass);
if (tmpinstance) owl_free(tmpinstance);
Modified: branches/barnowl_sqlite/owl/owl.c
===================================================================
--- branches/barnowl_sqlite/owl/owl.c 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/owl.c 2007-09-19 04:41:09 UTC (rev 765)
@@ -176,9 +176,7 @@
/* screen init */
if (!getenv("TERMINFO")) {
- sprintf(buff, "TERMINFO=%s", TERMINFO);
- putenv(buff);
- owl_function_debugmsg("startup: setting TERMINFO to %s", TERMINFO);
+ owl_function_debugmsg("startup: Not setting TERMINFO");
} else {
owl_function_debugmsg("startup: leaving TERMINFO as %s from envrionment", getenv("TERMINFO"));
}
Modified: branches/barnowl_sqlite/owl/owl.h
===================================================================
--- branches/barnowl_sqlite/owl/owl.h 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/owl.h 2007-09-19 04:41:09 UTC (rev 765)
@@ -62,7 +62,10 @@
/* Perl and curses don't play nice. */
#ifdef OWL_PERL
typedef void WINDOW;
+/* logout is defined in FreeBSD. */
+#define logout logout_
#include <perl.h>
+#undef logout
#include "XSUB.h"
#else
typedef void SV;
Modified: branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm 2007-09-19 04:41:09 UTC (rev 765)
@@ -51,6 +51,9 @@
Leave a MUC. The MUC is specified in the same form as L</FindMUC>
+Returns true if successful, false if this connection was not in the
+named MUC.
+
=cut
sub MUCLeave {
@@ -60,6 +63,7 @@
$muc->Leave();
$self->{_BARNOWL_MUCS} = [grep {$_->BaseJID ne $muc->BaseJID} $self->MUCs];
+ return 1;
}
=head2 FindMUC ARGS
Modified: branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2007-09-19 04:41:09 UTC (rev 765)
@@ -580,15 +580,17 @@
$muc = shift @ARGV
or die("Usage: jmuc join MUC [-p password] [-a account]");
+ die("Error: Must specify a fully-qualified MUC name (e.g. barnowl\@conference.mit.edu)\n")
+ unless $muc =~ /@/;
$muc = Net::Jabber::JID->new($muc);
$jid = Net::Jabber::JID->new($jid);
$muc->SetResource($jid->GetJID('full')) unless length $muc->GetResource();
$conn->getConnectionFromJID($jid)->MUCJoin(JID => $muc,
- Password => $password,
- History => {
- MaxChars => 0
- });
+ Password => $password,
+ History => {
+ MaxChars => 0
+ });
return;
}
@@ -598,8 +600,11 @@
$muc = shift @args if scalar @args;
die("Usage: jmuc part MUC [-a account]") unless $muc;
- $conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc);
- queue_admin_msg("$jid has left $muc.");
+ if($conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc)) {
+ queue_admin_msg("$jid has left $muc.");
+ } else {
+ die("Error: Not joined to $muc");
+ }
}
sub jmuc_invite {
@@ -638,10 +643,27 @@
sub jmuc_presence_single {
my $m = shift;
my @jids = $m->Presence();
- return "JIDs present in " . $m->BaseJID . "\n\t"
- . join("\n\t", map {$_->GetResource}@jids) . "\n";
+
+ my $presence = "JIDs present in " . $m->BaseJID;
+ if($m->Anonymous) {
+ $presence .= " [anonymous MUC]";
+ }
+ $presence .= "\n\t";
+ $presence .= join("\n\t", map {pp_jid($m, $_);} @jids) . "\n";
+ return $presence;
}
+sub pp_jid {
+ my ($m, $jid) = @_;
+ my $nick = $jid->GetResource;
+ my $full = $m->GetFullJID($jid);
+ if($full && $full ne $nick) {
+ return "$nick ($full)";
+ } else {
+ return "$nick";
+ }
+}
+
sub jmuc_presence {
my ( $jid, $muc, @args ) = @_;
@@ -903,6 +925,7 @@
my %jhash = j2hash( $j, { direction => 'in',
sid => $sid } );
$jhash{type} = 'admin';
+
BarnOwl::queue_message( BarnOwl::Message->new(%jhash) );
}
@@ -1133,14 +1156,14 @@
}
}
elsif ( $jtype eq 'normal' ) {
- $props{replycmd} = undef;
+ $props{replycmd} = "";
$props{private} = 1;
}
elsif ( $jtype eq 'headline' ) {
- $props{replycmd} = undef;
+ $props{replycmd} = "";
}
elsif ( $jtype eq 'error' ) {
- $props{replycmd} = undef;
+ $props{replycmd} = "";
$props{body} = "Error "
. $props{error_code}
. " sending to "
Modified: branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/Net/Jabber/MUC.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/Net/Jabber/MUC.pm 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/Net/Jabber/MUC.pm 2007-09-19 04:41:09 UTC (rev 765)
@@ -63,6 +63,7 @@
$self->{CONNECTION} = $args{connection};
$self->{JID} = $args{jid};
$self->{PRESENCE} = { };
+ $self->{ANONYMOUS} = 1;
bless($self, $class);
@@ -187,7 +188,15 @@
if($type eq 'unavailable') {
delete $self->{PRESENCE}->{$from->GetJID('full')};
} elsif($type eq 'available') {
- $self->{PRESENCE}->{$from->GetJID('full')} = $from;
+ $self->{PRESENCE}->{$from->GetJID('full')} = {ROOMNICK => $from};
+ my $x = $presence->GetX('http://jabber.org/protocol/muc#user');
+ if($x && $x->DefinedItem()) {
+ my $item = $x->GetItem();
+ if($item->DefinedJID()) {
+ $self->{PRESENCE}->{$from->GetJID('full')}->{FULLJID} = $item->GetJID();
+ $self->{ANONYMOUS} = 0;
+ }
+ }
}
}
@@ -206,6 +215,24 @@
return exists $self->{PRESENCE}->{$jid};
}
+=head2 GetFullJID roomjid
+
+Given the roomnick of a user in the MUC, return their full NIC if the
+MUC makes it available. If the MUC is anonymous or the user does not
+exist in the MUC, return undef.
+
+=cut
+
+sub GetFullJID {
+ my $self = shift;
+ my $jid = shift;
+
+ $jid = $jid->GetJID('full') if UNIVERSAL::isa($jid, 'Net::Jabber::JID');
+ my $pres = $self->{PRESENCE}->{$jid};
+ return unless $pres;
+ return $pres->{FULLJID};
+}
+
=head2 Presence
Returns a list of JIDS in the MUC, as Net::Jabber::JID objects
@@ -214,7 +241,18 @@
sub Presence {
my $self = shift;
- return values %{$self->{PRESENCE}};
+ return map {$_->{ROOMNICK}} values %{$self->{PRESENCE}};
}
+=head2 Anonymous
+
+Returns true if the MUC is anonymous (hides participants real JIDs)
+
+=cut
+
+sub Anonymous {
+ my $self = shift;
+ return $self->{ANONYMOUS};
+}
+
1;
Modified: branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/XML/Stream.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/XML/Stream.pm 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/XML/Stream.pm 2007-09-19 04:41:09 UTC (rev 765)
@@ -1160,7 +1160,8 @@
$self->{SOCKETS}->{*STDIN} = $sid;
}
- delete($self->{SIDS}->{$currsid});
+ # 08.04.05(Fri) slipstream@yandex.ru for compapility with ejabberd since it reuses stream id
+ delete($self->{SIDS}->{$currsid}) unless ($currsid eq $sid);
if (exists($self->GetRoot($sid)->{version}) &&
($self->GetRoot($sid)->{version} ne ""))
Modified: branches/barnowl_sqlite/owl/util.c
===================================================================
--- branches/barnowl_sqlite/owl/util.c 2007-09-13 02:46:17 UTC (rev 764)
+++ branches/barnowl_sqlite/owl/util.c 2007-09-19 04:41:09 UTC (rev 765)
@@ -767,7 +767,7 @@
start = owl_strdup(start);
end = start + strlen(start) - 1;
- while(*end == 'd' && *(end-1) == '.') {
+ while(end > start && *end == 'd' && *(end-1) == '.') {
end -= 2;
}
*(end + 1) = 0;