[263] in BarnOwl Developers
[D-O-H] r432 - in trunk: conf.asedeno/owl conf.asedeno/owl/modules owl
daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:04:16 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Mon, 30 Oct 2006 01:51:59 -0500 (EST)
Author: asedeno
Date: 2006-10-30 01:51:58 -0500 (Mon, 30 Oct 2006)
New Revision: 432
Modified:
trunk/conf.asedeno/owl/modules/jabber.pl
trunk/conf.asedeno/owl/owlconf.pl
trunk/owl/owl.c
trunk/owl/variable.c
Log:
1) Fix massive memory leak. I've removed the variable that held the
mainloop hook name, replacing the two references to it with the
hard-coded function "owl::mainloop_hook". We were discussing doing
this anyhow, and since leak was in getting the variable over and over
again, this was the easiest way to deal.
2) Updated owlconf.pl in light of (1). Update your local copy!
3) jabber - groupchat history is not requested, and is explicitly
ignored.
Modified: trunk/conf.asedeno/owl/modules/jabber.pl
===================================================================
--- trunk/conf.asedeno/owl/modules/jabber.pl 2006-10-30 01:40:36 UTC (rev 431)
+++ trunk/conf.asedeno/owl/modules/jabber.pl 2006-10-30 06:51:58 UTC (rev 432)
@@ -209,7 +209,16 @@
return;
}
- $client->PresenceSend(to=>$_[1]);
+ my $x = new XML::Stream::Node('x');
+ $x->put_attrib(xmlns => 'http://jabber.org/protocol/muc');
+ $x->add_child('history')->put_attrib(maxchars => '0');
+
+
+ my $presence = new Net::Jabber::Presence;
+ $presence->SetPresence(to => $_[1]);
+ $presence->AddX($x);
+
+ $client->Send($presence);
return "";
}
@@ -291,6 +300,8 @@
sub process_incoming_groupchat_message
{
my ($session, $j) = @_;
+ # HACK IN PROGRESS (ignoring delayed messages)
+ return if ($j->DefinedX('jabber:x:delay') && $j->GetX('jabber:x:delay'));
owl::queue_message(j2o($j, 'in'));
}
Modified: trunk/conf.asedeno/owl/owlconf.pl
===================================================================
--- trunk/conf.asedeno/owl/owlconf.pl 2006-10-30 01:40:36 UTC (rev 431)
+++ trunk/conf.asedeno/owl/owlconf.pl 2006-10-30 06:51:58 UTC (rev 432)
@@ -69,7 +69,7 @@
our $shutdown : shared;
$shutdown = 0;
-sub mainloop_hook
+sub owl::mainloop_hook
{
foreach (@onMainLoop)
{
@@ -100,7 +100,7 @@
# At this point I use owl::shutdown to tell any auxillary threads that they
# should terminate.
$shutdown = 1;
- mainloop_hook();
+ owl::mainloop_hook();
}
#Run this on start and reload. Adds modules and runs their startup functions.
@@ -127,8 +127,6 @@
&$_();
}
- owl::command(qq/set -q perl_mainloop_hook "mainloop_hook"/);
-
}
################################################################################
# Reload Code, taken from /afs/sipb/user/jdaniel/project/owl/perl
@@ -146,11 +144,9 @@
sub reload
{
- # Unhook ourselves from the mainloop.
- owl::command(qq/set -q perl_mainloop_hook NULL/);
# Shutdown existing threads.
$shutdown = 1;
- mainloop_hook();
+ owl::mainloop_hook();
$shutdown = 0;
@onMainLoop = ();
Modified: trunk/owl/owl.c
===================================================================
--- trunk/owl/owl.c 2006-10-30 01:40:36 UTC (rev 431)
+++ trunk/owl/owl.c 2006-10-30 06:51:58 UTC (rev 432)
@@ -71,7 +71,7 @@
int j, ret, initialsubs, debug, argcsave, followlast;
int newmsgs, zpendcount, nexttimediff;
struct sigaction sigact;
- char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE], *perl_mainloop_hook;
+ char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE];
owl_filter *f;
owl_style *s;
time_t nexttime, now;
@@ -91,7 +91,6 @@
tty=NULL;
debug=0;
initialsubs=1;
- perl_mainloop_hook = NULL;
if (argc>0) {
argv++;
argc--;
@@ -447,13 +446,10 @@
}
/* Hook perl into the loop */
- perl_mainloop_hook = owl_global_get_perl_mainloop_hook(&g);
- if (perl_mainloop_hook) {
- if (owl_perlconfig_is_function(perl_mainloop_hook)) {
- owl_function_debugmsg("startup: executing perl mainloop hook");
- perlout = owl_perlconfig_execute(perl_mainloop_hook);
- if (perlout) owl_free(perlout);
- }
+
+ if (owl_perlconfig_is_function("owl::mainloop_hook")) {
+ perlout = owl_perlconfig_execute("owl::mainloop_hook");
+ if (perlout) owl_free(perlout);
}
/* little hack */
Modified: trunk/owl/variable.c
===================================================================
--- trunk/owl/variable.c 2006-10-30 01:40:36 UTC (rev 431)
+++ trunk/owl/variable.c 2006-10-30 06:51:58 UTC (rev 432)
@@ -355,11 +355,6 @@
"Note that this is currently risky as you might accidentally\n"
"delete a message right as it came in.\n" ),
- OWLVAR_STRING( "perl_mainloop_hook" /* %OwlVarStub */, NULL,
- "mainloop hook to perl",
- "If this variable is set, owl will call to the perl function\n"
- "specified." ),
-
/* This MUST be last... */
{ NULL, 0, NULL, 0, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL }