[466] in BarnOwl Developers
[D-O-H] r595 - in trunk/owl: . perl/modules
daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:06:28 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: Sat, 10 Feb 2007 22:30:12 -0500 (EST)
Author: asedeno
Date: 2007-02-10 22:30:11 -0500 (Sat, 10 Feb 2007)
New Revision: 595
Modified:
trunk/owl/perl/modules/jabber.pl
trunk/owl/perlglue.xs
Log:
Export owl_function_add_message and owl_function_queue_message to perl.
Use them in jabber.pl.
Modified: trunk/owl/perl/modules/jabber.pl
===================================================================
--- trunk/owl/perl/modules/jabber.pl 2007-02-11 03:29:09 UTC (rev 594)
+++ trunk/owl/perl/modules/jabber.pl 2007-02-11 03:30:11 UTC (rev 595)
@@ -1010,8 +1010,8 @@
$j->SetSubject( $vars{jwrite}{subject} ) if ( $vars{jwrite}{subject} );
my $m = j2o( $j, { direction => 'out' } );
- if ( $vars{jwrite}{type} ne 'groupchat' && BarnOwl::getvar('displayoutgoing') eq 'on') {
- BarnOwl::queue_message($m);
+ if ( $vars{jwrite}{type} ne 'groupchat') {
+ BarnOwl::add_message($m);
}
$j->RemoveFrom(); # Kludge to get around gtalk's random bits after the resource.
@@ -1291,12 +1291,7 @@
sub queue_admin_msg {
my $err = shift;
- my $m = BarnOwl::Message->new(
- type => 'admin',
- direction => 'none',
- body => $err
- );
- BarnOwl::queue_message($m);
+ BarnOwl::admin_message("jabber.pl", $err);
}
sub boldify($) {
Modified: trunk/owl/perlglue.xs
===================================================================
--- trunk/owl/perlglue.xs 2007-02-11 03:29:09 UTC (rev 594)
+++ trunk/owl/perlglue.xs 2007-02-11 03:30:11 UTC (rev 595)
@@ -128,6 +128,32 @@
owl_global_messagequeue_addmsg(&g, m);
}
+void add_message(msg)
+ SV *msg
+ PREINIT:
+ owl_message *m;
+ CODE:
+ {
+ if(!SvROK(msg) || SvTYPE(SvRV(msg)) != SVt_PVHV) {
+ croak("Usage: owl::add_message($message)");
+ }
+
+ if (owl_global_is_displayoutgoing(&g)) {
+ m = owl_perlconfig_hashref2message(msg);
+ owl_function_add_message(m);
+ }
+ }
+
+void admin_message(header, body)
+ char *header
+ char *body
+ PREINIT:
+ owl_message *m;
+ CODE:
+ {
+ owl_function_adminmsg(header, body);
+ }
+
void start_question(line, callback)
char *line
SV *callback