[845] in BarnOwl Developers
[D-O-H] r835 - in branches/barnowl_sqlite: . conf.alexmv/modules conf.alexmv/sql owl owl/debian owl/perl/lib/BarnOwl owl/perl/modules
daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:10:20 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: Fri, 11 Jan 2008 21:32:02 -0500 (EST)
Author: nelhage
Date: 2008-01-11 21:32:01 -0500 (Fri, 11 Jan 2008)
New Revision: 835
Added:
branches/barnowl_sqlite/owl/perl/modules/IRC/
Modified:
branches/barnowl_sqlite/
branches/barnowl_sqlite/conf.alexmv/modules/owlconf-dbi
branches/barnowl_sqlite/conf.alexmv/sql/zephyr_log.sql
branches/barnowl_sqlite/owl/
branches/barnowl_sqlite/owl/commands.c
branches/barnowl_sqlite/owl/debian/control
branches/barnowl_sqlite/owl/functions.c
branches/barnowl_sqlite/owl/global.c
branches/barnowl_sqlite/owl/keys.c
branches/barnowl_sqlite/owl/message.c
branches/barnowl_sqlite/owl/owl.c
branches/barnowl_sqlite/owl/perl/lib/BarnOwl/ModuleLoader.pm
branches/barnowl_sqlite/owl/perlglue.xs
branches/barnowl_sqlite/owl/perlwrap.pm
branches/barnowl_sqlite/owl/stylefunc.c
branches/barnowl_sqlite/owl/util.c
branches/barnowl_sqlite/owl/variable.c
branches/barnowl_sqlite/owl/zephyr.c
Log:
Merged revisions 765-834 via svnmerge from
svn+ssh://lunatique.mit.edu/mit/barnowl/src/svn/trunk
........
r766 | nelhage | 2007-10-02 00:38:49 -0400 (Tue, 02 Oct 2007) | 3 lines
Don't crash if we hit `i' on iso-8859-*. This is not the right
solution, but at least it doesn't SEGV.
........
r767 | asedeno | 2007-10-10 15:21:13 -0400 (Wed, 10 Oct 2007) | 1 line
Fixing a typo pointed out by kchen.
........
r768 | matt | 2007-10-14 17:16:35 -0400 (Sun, 14 Oct 2007) | 1 line
added -m flag to aimwrite
........
r769 | austein | 2007-10-14 18:16:44 -0400 (Sun, 14 Oct 2007) | 1 line
aimwrite -m displays according to displayoutgoing
........
r770 | asedeno | 2007-12-06 14:38:05 -0500 (Thu, 06 Dec 2007) | 3 lines
Making usleep call more reasonable.
Responsiveness seems okay on linerva, no-knife, and darkmatter, and reported good
on zephyr.
........
r771 | nelhage | 2007-12-10 21:34:46 -0500 (Mon, 10 Dec 2007) | 2 lines
Add zip as build-depends
........
r772 | nelhage | 2007-12-10 21:36:25 -0500 (Mon, 10 Dec 2007) | 2 lines
We're not ktools
........
r773 | nelhage | 2007-12-23 11:32:02 -0500 (Sun, 23 Dec 2007) | 2 lines
bind END in popless windows. closes.#41
........
r774 | chmrr | 2007-12-23 15:16:26 -0500 (Sun, 23 Dec 2007) | 3 lines
r1805@utwig: chmrr | 2007-12-23 15:15:33 -0500
* Allow C-r on outgoing messages (useful for CCs)
........
r775 | chmrr | 2007-12-23 15:16:29 -0500 (Sun, 23 Dec 2007) | 3 lines
r1806@utwig: chmrr | 2007-12-23 15:15:50 -0500
* Identify ourselves as barnowl in a couple more places
........
r778 | asedeno | 2007-12-23 21:18:36 -0500 (Sun, 23 Dec 2007) | 1 line
Moving owl_get_datadir to util.c so make test'' works again.
........
r783 | asedeno | 2007-12-27 10:55:12 -0500 (Thu, 27 Dec 2007) | 1 line
Fixing a bug I noticed in the unicode branch.
........
r789 | chmrr | 2007-12-30 20:53:07 -0500 (Sun, 30 Dec 2007) | 5 lines
r1823@utwig: chmrr | 2007-12-30 20:52:12 -0500
* Don't conceal subscription errors with the "ok, we added it to the
.zephyr.subs file" message, by not doing the latter if the former
fails.
........
r790 | chmrr | 2007-12-30 22:54:39 -0500 (Sun, 30 Dec 2007) | 1 line
* Canonicalize class and sender, add base_class
........
r799 | nelhage | 2008-01-07 20:13:17 -0500 (Mon, 07 Jan 2008) | 1 line
Committing a partial IRC plugin
........
r801 | asedeno | 2008-01-08 00:10:30 -0500 (Tue, 08 Jan 2008) | 2 lines
Fixing a personal pet peeve:
resizing should not leave the current message off screen.
........
r805 | geofft | 2008-01-08 23:24:09 -0500 (Tue, 08 Jan 2008) | 5 lines
Added support for channels in IRC. After you :irc-connect to a server, you can
:irc-join #channel, and then :irc-msg either a user or a #channel. Replies,
isprivate, and context should work vaguely as expected.
........
r806 | nelhage | 2008-01-09 00:25:32 -0500 (Wed, 09 Jan 2008) | 1 line
........
r807 | nelhage | 2008-01-09 00:25:56 -0500 (Wed, 09 Jan 2008) | 1 line
........
r808 | nelhage | 2008-01-09 00:26:15 -0500 (Wed, 09 Jan 2008) | 3 lines
r27173@lunatique: nelhage | 2008-01-09 00:25:13 -0500
Implement smartnarrow on channels
........
r809 | nelhage | 2008-01-09 01:26:19 -0500 (Wed, 09 Jan 2008) | 4 lines
r27177@lunatique: nelhage | 2008-01-09 01:23:14 -0500
import is_private from ::Connection
........
r810 | nelhage | 2008-01-09 02:23:31 -0500 (Wed, 09 Jan 2008) | 3 lines
r27179@lunatique: nelhage | 2008-01-09 02:22:05 -0500
Implement irc-nick
........
r814 | nelhage | 2008-01-09 23:14:20 -0500 (Wed, 09 Jan 2008) | 3 lines
r27181@lunatique: nelhage | 2008-01-09 23:13:52 -0500
Implement /part and /names. We don't parse the /names response yet
........
r815 | nelhage | 2008-01-10 00:12:52 -0500 (Thu, 10 Jan 2008) | 1 line
Show PART and JOIN messages
........
r816 | nelhage | 2008-01-10 00:13:11 -0500 (Thu, 10 Jan 2008) | 2 lines
Show the channel in LOG{IN,OUT} messages
........
r817 | geofft | 2008-01-10 00:32:44 -0500 (Thu, 10 Jan 2008) | 6 lines
A (broken) attempt at handling motds and other IRC admin messages
Export owl_function_beep() to Perl, and ring the bell on receiving a message
containing your nick (on that network)
........
r818 | nelhage | 2008-01-10 01:01:32 -0500 (Thu, 10 Jan 2008) | 2 lines
Document the IRC variables
........
r819 | nelhage | 2008-01-10 01:02:06 -0500 (Thu, 10 Jan 2008) | 3 lines
Handle recreation of an existing variable better. Copy over the
default and docstrings, but preserve the old value.
........
r820 | nelhage | 2008-01-10 01:16:33 -0500 (Thu, 10 Jan 2008) | 2 lines
Handle zephyrs to users on non -c message better (fixes.#39)
........
r821 | nelhage | 2008-01-10 01:28:59 -0500 (Thu, 10 Jan 2008) | 2 lines
sprintf -> snprintf
........
r822 | nelhage | 2008-01-10 01:43:11 -0500 (Thu, 10 Jan 2008) | 2 lines
Make :reload-modules work correctly with PARs
........
r823 | nelhage | 2008-01-10 15:47:00 -0500 (Thu, 10 Jan 2008) | 1 line
Require 'isprivate' to be a literal 'true', not merely present for a message to be considered private
........
r824 | nelhage | 2008-01-10 15:48:00 -0500 (Thu, 10 Jan 2008) | 2 lines
Document (nearly) every public function in the BarnOwl:: namespace
........
r825 | nelhage | 2008-01-10 15:49:27 -0500 (Thu, 10 Jan 2008) | 2 lines
`beep' is already a barnowl command, so this binding is superfluous
........
r826 | nelhage | 2008-01-10 15:58:49 -0500 (Thu, 10 Jan 2008) | 1 line
strip IRC coloring from IRC messages
........
r827 | nelhage | 2008-01-10 17:22:46 -0500 (Thu, 10 Jan 2008) | 2 lines
Document ::Hook and ::Hooks
........
r828 | geofft | 2008-01-10 21:01:27 -0500 (Thu, 10 Jan 2008) | 1 line
Move comment around so that perlglue.xs compiles.
........
r829 | nelhage | 2008-01-10 23:25:27 -0500 (Thu, 10 Jan 2008) | 1 line
doc nits
........
r830 | nelhage | 2008-01-11 01:38:50 -0500 (Fri, 11 Jan 2008) | 2 lines
Handle `nickinuse' errors and disconnects
........
r834 | chmrr | 2008-01-11 17:11:00 -0500 (Fri, 11 Jan 2008) | 3 lines
r1876@utwig: chmrr | 2008-01-11 17:08:47 -0500
* Default connections on a per-channel-name basis
........
Property changes on: branches/barnowl_sqlite
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-764
+ /trunk:1-834
Modified: branches/barnowl_sqlite/conf.alexmv/modules/owlconf-dbi
===================================================================
--- branches/barnowl_sqlite/conf.alexmv/modules/owlconf-dbi 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/conf.alexmv/modules/owlconf-dbi 2008-01-12 02:32:01 UTC (rev 835)
@@ -10,7 +10,7 @@
return if $owl::dbh and $owl::dbh->ping;
$owl::dbh = DBI->connect("DBI:mysql:database=zephyr_log",
"owl", "", {RaiseError => 1});
- $owl::sth = $owl::dbh->prepare("INSERT INTO messages(sender, class, instance, opcode, sent, received, host, zsig, body) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
+ $owl::sth = $owl::dbh->prepare(q{INSERT INTO messages(sender, class, base_class, instance, opcode, sent, received, host, zsig, body) VALUES (trim(trailing '@ATHENA.MIT.EDU' from ?), ?, trim(leading 'un' from trim(trailing '.d' from ?)), ?, ?, ?, ?, ?, ?, ?)});
}
sub owl::receive_msg {
@@ -19,7 +19,8 @@
my $sent = $owl::strp->parse_datetime($msg->time);
owl::db_connect();
$owl::sth->execute($msg->sender,
- $msg->class,
+ lc $msg->class,
+ lc $msg->class,
$msg->instance,
$msg->opcode ? $msg->opcode : undef,
$sent->datetime,
Modified: branches/barnowl_sqlite/conf.alexmv/sql/zephyr_log.sql
===================================================================
--- branches/barnowl_sqlite/conf.alexmv/sql/zephyr_log.sql 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/conf.alexmv/sql/zephyr_log.sql 2008-01-12 02:32:01 UTC (rev 835)
@@ -31,6 +31,7 @@
`host` varchar(200) NOT NULL default '',
`zsig` text NOT NULL,
`body` text,
+ `base_class` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `index_class` (`class`),
KEY `index_instance` (`instance`),
@@ -40,8 +41,11 @@
KEY `index_sender` (`sender`),
KEY `index_host` (`host`),
KEY `index_sent` (`sent`),
- FULLTEXT KEY `index_body` (`body`)
-) ENGINE=MyISAM AUTO_INCREMENT=1517065 DEFAULT CHARSET=utf8;
+ KEY `index_base_class` (`base_class`),
+ FULLTEXT KEY `index_body` (`body`),
+ FULLTEXT KEY `index_zsig` (`zsig`),
+ FULLTEXT KEY `index_body_zsig` (`body`,`zsig`)
+) ENGINE=MyISAM AUTO_INCREMENT=2181045 DEFAULT CHARSET=utf8;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
Property changes on: branches/barnowl_sqlite/owl
___________________________________________________________________
Name: svk:merge
- 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1614
8baf6839-b125-0410-9df9-922793c80423:/local/barnowl:20981
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/branches/par:19594
fe09232e-8620-0410-8e36-e6b4839e121d:/branches/par:688
+ 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1876
8baf6839-b125-0410-9df9-922793c80423:/local/barnowl:20981
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/branches/par:19594
fe09232e-8620-0410-8e36-e6b4839e121d:/branches/par:688
Modified: branches/barnowl_sqlite/owl/commands.c
===================================================================
--- branches/barnowl_sqlite/owl/commands.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/commands.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -131,8 +131,10 @@
OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE,
"send an AIM message",
- "aimzwrite <user>",
- "Send an aim message to a user.\n"),
+ "aimwrite <user> [-m <message...>]",
+ "Send an aim message to a user.\n\n"
+ "The following options are available:\n\n"
+ "-m Specifies a message to send without prompting.\n"),
OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE,
"send a loopback message",
@@ -1765,6 +1767,7 @@
{
char *recip="";
int temp=0;
+ int ret=0;
if (argc<3) {
owl_function_makemsg("Not enough arguments to the subscribe command");
@@ -1794,8 +1797,8 @@
recip=argv[2];
}
- owl_function_subscribe(argv[0], argv[1], recip);
- if (!temp) {
+ ret = owl_function_subscribe(argv[0], argv[1], recip);
+ if (!temp && !ret) {
owl_zephyr_addsub(NULL, argv[0], argv[1], recip);
}
return(NULL);
@@ -1885,8 +1888,9 @@
char *owl_command_aimwrite(int argc, char **argv, char *buff)
{
- char *newbuff;
- int i, j;
+ char *newbuff, *recip, **myargv;
+ int i, j, myargc;
+ owl_message *m;
if (!owl_global_is_aimloggedin(&g)) {
owl_function_makemsg("You are not logged in to AIM.");
@@ -1898,6 +1902,56 @@
return(NULL);
}
+ myargv=argv;
+ if (argc<0) {
+ owl_function_error("Unbalanced quotes in aimwrite");
+ return(NULL);
+ }
+ myargc=argc;
+ if (myargc && *(myargv[0])!='-') {
+ myargc--;
+ myargv++;
+ }
+ while (myargc) {
+ if (!strcmp(myargv[0], "-m")) {
+ if (myargc<2) {
+ break;
+ }
+
+ /* Once we have -m, gobble up everything else on the line */
+ myargv++;
+ myargc--;
+ newbuff=owl_malloc(1);
+ newbuff=owl_strdup("");
+ while (myargc) {
+ newbuff=realloc(newbuff, strlen(newbuff)+strlen(myargv[0])+5);
+ strcat(newbuff, myargv[0]);
+ strcat(newbuff, " ");
+ myargc--;
+ myargv++;
+ }
+ newbuff[strlen(newbuff)-1]='\0'; /* remove last space */
+
+ recip=owl_malloc(strlen(argv[0])+5);
+ sprintf(recip, "%s ", argv[1]);
+ owl_aim_send_im(recip, newbuff);
+ m=owl_function_make_outgoing_aim(newbuff, recip);
+ if (m) {
+ owl_global_messagequeue_addmsg(&g, m);
+ } else {
+ owl_function_error("Could not create outgoing AIM message");
+ }
+
+ owl_free(recip);
+ owl_free(newbuff);
+ return(NULL);
+ } else {
+ /* we don't care */
+ myargv++;
+ myargc--;
+ }
+ }
+
/* squish arguments together to make one screenname w/o spaces for now */
newbuff=owl_malloc(strlen(buff)+5);
sprintf(newbuff, "%s ", argv[0]);
Modified: branches/barnowl_sqlite/owl/debian/control
===================================================================
--- branches/barnowl_sqlite/owl/debian/control 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/debian/control 2008-01-12 02:32:01 UTC (rev 835)
@@ -2,7 +2,7 @@
Section: net
Priority: optional
Maintainer: Sam Hartman <hartmans@debian.org>
-Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev
+Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev, zip
Standards-Version: 3.5.2
Package: barnowl
@@ -11,8 +11,8 @@
Recommends: zephyr-clients
Description: A curses-based tty Jabber and Zephyr client.
An alternative standalone (doesn't use zwgc) Zephyr (instant
- messaging) client. Also supports Jabber.
+ messaging) client. Also supports AIM and Jabber.
Much of the functionality is written in Perl, which is supported as
an extension language.
.
- ktools software -- The 'k' is for Quality!
+ This is a fork of ktools software's owl Zephyr/AIM client
Modified: branches/barnowl_sqlite/owl/functions.c
===================================================================
--- branches/barnowl_sqlite/owl/functions.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/functions.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -1337,7 +1337,7 @@
}
}
-void owl_function_subscribe(char *class, char *inst, char *recip)
+int owl_function_subscribe(char *class, char *inst, char *recip)
{
int ret;
@@ -1347,6 +1347,7 @@
} else {
owl_function_makemsg("Subscribed.");
}
+ return(ret);
}
void owl_function_unsubscribe(char *class, char *inst, char *recip)
@@ -2059,80 +2060,79 @@
if (owl_message_is_type_zephyr(m)) {
/* if it's a zephyr we sent, send it out the same way again */
if (owl_message_is_direction_out(m)) {
- owl_function_zwrite_setup(owl_message_get_zwriteline(m));
- owl_global_set_buffercommand(&g, owl_message_get_zwriteline(m));
- return;
- }
+ buff = owl_strdup(owl_message_get_zwriteline(m));
+ } else {
- /* Special case a personal reply to a webzephyr user on a class */
- if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) {
- class=OWL_WEBZEPHYR_CLASS;
- inst=owl_message_get_sender(m);
- to=OWL_WEBZEPHYR_PRINCIPAL;
- } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) {
- /* Special case LOGIN/LOGOUT notifications on class "webzephyr" */
- class=OWL_WEBZEPHYR_CLASS;
- inst=owl_message_get_instance(m);
- to=OWL_WEBZEPHYR_PRINCIPAL;
- } else if (owl_message_is_loginout(m)) {
- /* Normal LOGIN/LOGOUT messages */
- class="MESSAGE";
- inst="PERSONAL";
- to=owl_message_get_sender(m);
- } else if (type==1) {
- /* Personal reply */
- class="MESSAGE";
- inst="PERSONAL";
- to=owl_message_get_sender(m);
- } else {
- /* General reply */
- class=owl_message_get_class(m);
- inst=owl_message_get_instance(m);
- to=owl_message_get_recipient(m);
- cc=owl_message_get_cc_without_recipient(m);
- if (!strcmp(to, "") || !strcmp(to, "*")) {
- to="";
- } else if (to[0]=='@') {
- /* leave it, to get the realm */
- } else {
- to=owl_message_get_sender(m);
- }
+ /* Special case a personal reply to a webzephyr user on a class */
+ if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) {
+ class=OWL_WEBZEPHYR_CLASS;
+ inst=owl_message_get_sender(m);
+ to=OWL_WEBZEPHYR_PRINCIPAL;
+ } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) {
+ /* Special case LOGIN/LOGOUT notifications on class "webzephyr" */
+ class=OWL_WEBZEPHYR_CLASS;
+ inst=owl_message_get_instance(m);
+ to=OWL_WEBZEPHYR_PRINCIPAL;
+ } else if (owl_message_is_loginout(m)) {
+ /* Normal LOGIN/LOGOUT messages */
+ class="MESSAGE";
+ inst="PERSONAL";
+ to=owl_message_get_sender(m);
+ } else if (type==1) {
+ /* Personal reply */
+ class="MESSAGE";
+ inst="PERSONAL";
+ to=owl_message_get_sender(m);
+ } else {
+ /* General reply */
+ class=owl_message_get_class(m);
+ inst=owl_message_get_instance(m);
+ to=owl_message_get_recipient(m);
+ cc=owl_message_get_cc_without_recipient(m);
+ if (!strcmp(to, "") || !strcmp(to, "*")) {
+ to="";
+ } else if (to[0]=='@') {
+ /* leave it, to get the realm */
+ } else {
+ to=owl_message_get_sender(m);
+ }
+ }
+
+ /* create the command line */
+ if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) {
+ buff=owl_strdup("zcrypt");
+ } else {
+ buff = owl_strdup("zwrite");
+ }
+ if (strcasecmp(class, "message")) {
+ buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class));
+ owl_free(oldbuff);
+ }
+ if (strcasecmp(inst, "personal")) {
+ buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst));
+ owl_free(oldbuff);
+ }
+ if (*to != '\0') {
+ char *tmp, *oldtmp, *tmp2;
+ tmp=short_zuser(to);
+ if (cc) {
+ tmp = owl_util_uniq(oldtmp=tmp, cc, "-");
+ owl_free(oldtmp);
+ buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp);
+ owl_free(oldbuff);
+ } else {
+ if (owl_global_is_smartstrip(&g)) {
+ tmp2=tmp;
+ tmp=owl_zephyr_smartstripped_user(tmp2);
+ owl_free(tmp2);
+ }
+ buff = owl_sprintf("%s %s", oldbuff=buff, tmp);
+ owl_free(oldbuff);
+ }
+ owl_free(tmp);
+ }
+ if (cc) owl_free(cc);
}
-
- /* create the command line */
- if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) {
- buff=owl_strdup("zcrypt");
- } else {
- buff = owl_strdup("zwrite");
- }
- if (strcasecmp(class, "message")) {
- buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class));
- owl_free(oldbuff);
- }
- if (strcasecmp(inst, "personal")) {
- buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst));
- owl_free(oldbuff);
- }
- if (*to != '\0') {
- char *tmp, *oldtmp, *tmp2;
- tmp=short_zuser(to);
- if (cc) {
- tmp = owl_util_uniq(oldtmp=tmp, cc, "-");
- owl_free(oldtmp);
- buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp);
- owl_free(oldbuff);
- } else {
- if (owl_global_is_smartstrip(&g)) {
- tmp2=tmp;
- tmp=owl_zephyr_smartstripped_user(tmp2);
- owl_free(tmp2);
- }
- buff = owl_sprintf("%s %s", oldbuff=buff, tmp);
- owl_free(oldbuff);
- }
- owl_free(tmp);
- }
- if (cc) owl_free(cc);
} else if (owl_message_is_type_aim(m)) {
/* aim */
if (owl_message_is_direction_out(m)) {
Modified: branches/barnowl_sqlite/owl/global.c
===================================================================
--- branches/barnowl_sqlite/owl/global.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/global.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -434,6 +434,10 @@
/* in case any styles rely on the current width */
owl_messagelist_invalidate_formats(owl_global_get_msglist(g));
+ /* recalculate the topmsg to make sure the current message is on
+ * screen */
+ owl_function_calculate_topmsg(OWL_DIRECTION_NONE);
+
/* refresh stuff */
g->needrefresh=1;
owl_mainwin_redisplay(&(g->mw));
Modified: branches/barnowl_sqlite/owl/keys.c
===================================================================
--- branches/barnowl_sqlite/owl/keys.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/keys.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -179,6 +179,7 @@
BIND_CMD("<", "popless:scroll-to-top", "");
BIND_CMD("M-<", "popless:scroll-to-top", "");
+ BIND_CMD("END", "popless:scroll-to-bottom", "");
BIND_CMD(">", "popless:scroll-to-bottom", "");
BIND_CMD("M->", "popless:scroll-to-bottom", "");
Modified: branches/barnowl_sqlite/owl/message.c
===================================================================
--- branches/barnowl_sqlite/owl/message.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/message.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -120,6 +120,11 @@
for (i=0; i<j; i++) {
p=owl_list_get_element(&(m->attributes), i);
buff=owl_sprintf(" %-15.15s: %-35.35s\n", owl_pair_get_key(p), owl_pair_get_value(p));
+ if(buff == NULL) {
+ buff=owl_sprintf(" %-15.15s: %-35.35s\n", owl_pair_get_key(p), "<error>");
+ if(buff == NULL)
+ buff=owl_strdup(" <error>\n");
+ }
owl_fmtext_append_normal(fm, buff);
owl_free(buff);
}
@@ -324,7 +329,7 @@
res=owl_message_get_attribute_value(m, "isprivate");
if (!res) return(0);
- return(1);
+ return !strcmp(res, "true");
}
char *owl_message_get_timestr(owl_message *m)
Modified: branches/barnowl_sqlite/owl/owl.c
===================================================================
--- branches/barnowl_sqlite/owl/owl.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/owl.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -63,13 +63,6 @@
owl_global g;
-char * owl_get_datadir() {
- char * datadir = getenv("BARNOWL_DATA_DIR");
- if(datadir != NULL)
- return strchr(datadir, '=') + 1;
- return DATADIR;
-}
-
int main(int argc, char **argv, char **env)
{
WINDOW *recwin, *sepwin, *typwin, *msgwin;
@@ -144,7 +137,7 @@
argv++;
argc--;
} else if (!strcmp(argv[0], "-v")) {
- printf("This is owl version %s\n", OWL_VERSION_STRING);
+ printf("This is barnowl version %s\n", OWL_VERSION_STRING);
exit(0);
} else {
fprintf(stderr, "Uknown argument\n");
@@ -546,7 +539,7 @@
* as quickly as possbile */
j=wgetch(typwin);
if (j==ERR) {
- usleep(10);
+ usleep(10000);
} else {
owl_global_update_lastinputtime(&g);
/* find and activate the current keymap.
@@ -713,12 +706,12 @@
void usage()
{
- fprintf(stderr, "Owl version %s\n", OWL_VERSION_STRING);
- fprintf(stderr, "Usage: owl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n");
+ fprintf(stderr, "Barnowl version %s\n", OWL_VERSION_STRING);
+ fprintf(stderr, "Usage: barnowl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n");
fprintf(stderr, " -n don't load zephyr subscriptions\n");
fprintf(stderr, " -d enable debugging\n");
fprintf(stderr, " -D enable debugging and delete previous debug file\n");
- fprintf(stderr, " -v print the Owl version number and exit\n");
+ fprintf(stderr, " -v print the Barnowl version number and exit\n");
fprintf(stderr, " -h print this help message\n");
fprintf(stderr, " -c specify an alternate config file\n");
fprintf(stderr, " -s specify an alternate config dir (default ~/.owl)\n");
Modified: branches/barnowl_sqlite/owl/perl/lib/BarnOwl/ModuleLoader.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/lib/BarnOwl/ModuleLoader.pm 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/perl/lib/BarnOwl/ModuleLoader.pm 2008-01-12 02:32:01 UTC (rev 835)
@@ -8,6 +8,7 @@
use PAR (BarnOwl::get_config_dir() . "/modules/*.par");
sub load_all {
+ PAR::reload_libs();
my %modules;
my @modules;
@@ -35,7 +36,7 @@
}
for my $class (keys %modules) {
if(!defined eval "use BarnOwl::Module::$class") {
- BarnOwl::error("Unable to load module $class: $!") if $!;
+ # BarnOwl::error("Unable to load module $class: $!") if $!;
BarnOwl::error("Unable to load module $class: $@") if $@;
}
}
@@ -46,7 +47,7 @@
sub register_keybindings {
BarnOwl::new_command('reload-modules', sub {BarnOwl::ModuleLoader->reload}, {
summary => 'Reload all modules',
- usage => 'reload',
+ usage => 'reload-modules',
description => q{Reloads all modules located in ~/.owl/modules and the system modules directory}
});
}
Copied: branches/barnowl_sqlite/owl/perl/modules/IRC (from rev 834, trunk/owl/perl/modules/IRC)
Modified: branches/barnowl_sqlite/owl/perlglue.xs
===================================================================
--- branches/barnowl_sqlite/owl/perlglue.xs 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/perlglue.xs 2008-01-12 02:32:01 UTC (rev 835)
@@ -12,8 +12,25 @@
#define SV_IS_CODEREF(sv) (SvROK((sv)) && SvTYPE(SvRV((sv))) == SVt_PVCV)
-MODULE = BarnOwl PACKAGE = BarnOwl
+ /*************************************************************
+ * NOTE
+ *************************************************************
+ * These functions, when they are intended to be user-visible,
+ * are document in perlwrap.pm. If you add functions to this
+ * file, add the appropriate documentation there!
+ *
+ * If the function is simple enough, we simply define its
+ * entire functionality here in XS. If, however, it needs
+ * complex argument processing or something, we define a
+ * simple version here that takes arguments in as flat a
+ * manner as possible, to simplify the XS code, with a name
+ * with a trailing `_internal', and write a perl wrapper in
+ * perlwrap.pm that munges the arguments as appropriate and
+ * calls the internal version.
+ */
+MODULE = BarnOwl PACKAGE = BarnOwl
+
char *
command(cmd)
char *cmd
Modified: branches/barnowl_sqlite/owl/perlwrap.pm
===================================================================
--- branches/barnowl_sqlite/owl/perlwrap.pm 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/perlwrap.pm 2008-01-12 02:32:01 UTC (rev 835)
@@ -14,6 +14,117 @@
package BarnOwl;
+=head1 NAME
+
+BarnOwl
+
+=head1 DESCRIPTION
+
+The BarnOwl module contains the core of BarnOwl's perl
+bindings. Source in this module is also run at startup to bootstrap
+barnowl by defining things like the default style.
+
+=for NOTE
+These following functions are defined in perlglue.xs. Keep the
+documentation here in sync with the user-visible commands defined
+there!
+
+=head2 command STRING
+
+Executes a BarnOwl command in the same manner as if the user had
+executed it at the BarnOwl command prompt. If the command returns a
+value, return it as a string, otherwise return undef.
+
+=head2 getcurmsg
+
+Returns the current message as a C<BarnOwl::Message> subclass, or
+undef if there is no message selected
+
+=head2 getnumcols
+
+Returns the width of the display window BarnOwl is currently using
+
+=head2 getidletime
+
+Returns the length of time since the user has pressed a key, in
+seconds.
+
+=head2 zephyr_getrealm
+
+Returns the zephyr realm barnowl is running in
+
+=head2 zephyr_getsender
+
+Returns the fully-qualified name of the zephyr sender barnowl is
+running as, e.g. C<nelhage@ATHENA.MIT.EDU>
+
+=head2 zephyr_zwrite COMMAND MESSAGE
+
+Sends a zephyr programmatically. C<COMMAND> should be a C<zwrite>
+command line, and C<MESSAGE> is the zephyr body to send.
+
+=head2 ztext_stylestrip STRING
+
+Strips zephyr formatting from a string and returns the result
+
+=head2 queue_message MESSAGE
+
+Enqueue a message in the BarnOwl message list, logging it and
+processing it appropriately. C<MESSAGE> should be an instance of
+BarnOwl::Message or a subclass.
+
+=head2 admin_message HEADER BODY
+
+Display a BarnOwl B<Admin> message, with the given header and body.
+
+=head2 start_question PROMPT CALLBACK
+
+Displays C<PROMPT> on the screen and lets the user enter a line of
+text, and calls C<CALLBACK>, which must be a perl subroutine
+reference, with the text the user entered
+
+=head2 start_password PROMPT CALLBACK
+
+Like C<start_question>, but echoes the user's input as C<*>s when they
+input.
+
+=head2 start_editwin PROMPT CALLBACK
+
+Like C<start_question>, but displays C<PROMPT> on a line of its own
+and opens the editwin. If the user cancels the edit win, C<CALLBACK>
+is not invoked.
+
+=head2 get_data_dir
+
+Returns the BarnOwl system data directory, where system libraries and
+modules are stored
+
+=head2 get_config_dir
+
+Returns the BarnOwl user configuration directory, where user modules
+and configuration are stored (by default, C<$HOME/.owl>)
+
+=head2 popless_text TEXT
+
+Show a popup window containing the given C<TEXT>
+
+=head2 popless_ztext TEXT
+
+Show a popup window containing the provided zephyr-formatted C<TEXT>
+
+=head2 error STRING
+
+Reports an error and log it in `show errors'. Note that in any
+callback or hook called in perl code from BarnOwl, a C<die> will be
+caught and passed to C<error>.
+
+=head2 getnumcolors
+
+Returns the number of colors this BarnOwl is capable of displaying
+
+=cut
+
+
BEGIN {
# bootstrap in C bindings and glue
*owl:: = \*BarnOwl::;
@@ -46,6 +157,26 @@
return &BarnOwl::Hooks::_receive_msg($m);
}
+=head2 AUTOLOAD
+
+BarnOwl.pm has a C<AUTOLOAD> method that translates unused names in
+the BarnOwl:: namespace to a call to BarnOwl::command() with that
+command. Underscores are also translated to C<->s, so you can do
+e.g. C<BarnOwl::start_command()> and it will be translated into
+C<start-command>.
+
+So, if you're looking for functionality that you can't find in the
+perl interface, check C<:show commands> or C<commands.c> in the
+BarnOwl source tree -- there's a good chance it exists as a BarnOwl
+command.
+
+=head3 BUGS
+
+There are horrible quoting issues here. The AUTOLOAD simple joins your
+commands with spaces and passes them unmodified to C<::command>
+
+=cut
+
# make BarnOwl::<command>("foo") be aliases to BarnOwl::command("<command> foo");
sub AUTOLOAD {
our $AUTOLOAD;
@@ -62,8 +193,25 @@
first argument.
ARGS should be a hashref containing any or all of C<summary>,
-C<usage>, or C<description> keys.
+C<usage>, or C<description> keys:
+=over 4
+
+=item summary
+
+A one-line summary of the purpose of the command
+
+=item usage
+
+A one-line usage synopsis, showing available options and syntax
+
+=item description
+
+A longer description of the syntax and semantics of the command,
+explaining usage and options
+
+=back
+
=cut
sub new_command {
@@ -409,17 +557,44 @@
package BarnOwl::Hook;
+=head1 BarnOwl::Hook
+
+=head1 DESCRIPTION
+
+A C<BarnOwl::Hook> represents a list of functions to be triggered on
+some event. C<BarnOwl> exports a default set of these (see
+C<BarnOwl::Hooks>), but can also be created and used by module code.
+
+=head2 new
+
+Creates a new Hook object
+
+=cut
+
sub new {
my $class = shift;
return bless [], $class;
}
+=head2 run [ARGS]
+
+Calls each of the functions registered with this hook with the given
+arguments.
+
+=cut
+
sub run {
my $self = shift;
my @args = @_;
return map {$_->(@args)} @$self;
}
+=head2 add SUBREF
+
+Registers a given subroutine with this hook
+
+=cut
+
sub add {
my $self = shift;
my $func = shift;
@@ -427,6 +602,12 @@
push @$self, $func;
}
+=head2 clear
+
+Remove all functions registered with this hook.
+
+=cut
+
sub clear {
my $self = shift;
@$self = ();
@@ -434,6 +615,56 @@
package BarnOwl::Hooks;
+=head1 BarnOwl::Hooks
+
+=head1 DESCRIPTION
+
+C<BarnOwl::Hooks> exports a set of C<BarnOwl::Hook> objects made
+available by BarnOwl internally.
+
+=head2 USAGE
+
+Modules wishing to respond to events in BarnOwl should register
+functions with these hooks.
+
+=head2 EXPORTS
+
+None by default. Either import the hooks you need explicitly, or refer
+to them with fully-qualified names. Available hooks are:
+
+=over 4
+
+=item $startup
+
+Called on BarnOwl startup, and whenever modules are
+reloaded. Functions registered with the C<$startup> hook get a true
+argument if this is a reload, and false if this is a true startup
+
+=item $shutdown
+
+Called before BarnOwl shutdown
+
+=item $receiveMessage
+
+Called with a C<BarnOwl::Message> object every time BarnOwl appends a
+new message to its message list
+
+=item $mainLoop
+
+Called on B<every pass> through the C<BarnOwl> main loop. Any
+functions with this hook should be very cheap, as they are very
+frequently by the runtime.
+
+=item $getBuddyList
+
+Called to display buddy lists for all protocol handlers. The result
+from every function registered with this hook will be appended and
+displayed in a popup window, with zephyr formatting parsed.
+
+=back
+
+=cut
+
use Exporter;
our @EXPORT_OK = qw($startup $shutdown
@@ -468,6 +699,10 @@
}
}
+# These are the internal hooks called by the barnowl C code, which
+# take care of dispatching to the appropriate perl hooks, and deal
+# with compatibility by calling the old, fixed-name hooks.
+
sub _startup {
_load_owlconf();
Modified: branches/barnowl_sqlite/owl/stylefunc.c
===================================================================
--- branches/barnowl_sqlite/owl/stylefunc.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/stylefunc.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -145,7 +145,7 @@
/* make personal messages bold for smaat users */
if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) {
if (owl_message_is_personal(m)) {
- owl_fmtext_addattr((&m->fmtext), OWL_FMTEXT_ATTR_BOLD);
+ owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
}
}
}
@@ -308,7 +308,7 @@
/* make private messages bold for smaat users */
if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) {
if (owl_message_is_personal(m)) {
- owl_fmtext_addattr((&m->fmtext), OWL_FMTEXT_ATTR_BOLD);
+ owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
}
}
}
@@ -626,7 +626,7 @@
/* make private messages bold for smaat users */
if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) {
if (owl_message_is_personal(m)) {
- owl_fmtext_addattr((&m->fmtext), OWL_FMTEXT_ATTR_BOLD);
+ owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
}
}
}
Modified: branches/barnowl_sqlite/owl/util.c
===================================================================
--- branches/barnowl_sqlite/owl/util.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/util.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -775,6 +775,13 @@
return start;
}
+char * owl_get_datadir() {
+ char * datadir = getenv("BARNOWL_DATA_DIR");
+ if(datadir != NULL)
+ return strchr(datadir, '=') + 1;
+ return DATADIR;
+}
+
/**************************************************************************/
/************************* REGRESSION TESTS *******************************/
/**************************************************************************/
Modified: branches/barnowl_sqlite/owl/variable.c
===================================================================
--- branches/barnowl_sqlite/owl/variable.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/variable.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -454,9 +454,11 @@
/**************************************************************************/
int owl_variable_dict_setup(owl_vardict *vd) {
- owl_variable *cur;
+ owl_variable *var, *cur;
if (owl_dict_create(vd)) return(-1);
- for (cur = variables_to_init; cur->name != NULL; cur++) {
+ for (var = variables_to_init; var->name != NULL; var++) {
+ cur = owl_malloc(sizeof(owl_variable));
+ memcpy(cur, var, sizeof(owl_variable));
switch (cur->type) {
case OWL_VARIABLE_OTHER:
cur->set_fn(cur, cur->pval_default);
@@ -519,7 +521,7 @@
void owl_variable_dict_add_variable(owl_vardict * vardict,
owl_variable * var) {
- owl_dict_insert_element(vardict, var->name, (void*)var, NULL);
+ owl_dict_insert_element(vardict, var->name, (void*)var, (void(*)(void*))owl_variable_free);
}
owl_variable * owl_variable_newvar(char *name, char *summary, char * description) {
@@ -531,47 +533,73 @@
return var;
}
+void owl_variable_update(owl_variable *var, char *summary, char *desc) {
+ if(var->summary) owl_free(var->summary);
+ var->summary = owl_strdup(summary);
+ if(var->description) owl_free(var->description);
+ var->description = owl_strdup(desc);
+}
+
void owl_variable_dict_newvar_string(owl_vardict * vd, char *name, char *summ, char * desc, char * initval) {
- owl_variable * var = owl_variable_newvar(name, summ, desc);
- var->type = OWL_VARIABLE_STRING;
- var->pval_default = owl_strdup(initval);
- var->set_fn = owl_variable_string_set_default;
- var->set_fromstring_fn = owl_variable_string_set_fromstring_default;
- var->get_fn = owl_variable_get_default;
- var->get_tostring_fn = owl_variable_string_get_tostring_default;
- var->free_fn = owl_variable_free_default;
- var->set_fn(var, initval);
- owl_variable_dict_add_variable(vd, var);
+ owl_variable *old = owl_variable_get_var(vd, name, OWL_VARIABLE_STRING);
+ if(old) {
+ owl_variable_update(old, summ, desc);
+ if(old->pval_default) owl_free(old->pval_default);
+ old->pval_default = owl_strdup(initval);
+ } else {
+ owl_variable * var = owl_variable_newvar(name, summ, desc);
+ var->type = OWL_VARIABLE_STRING;
+ var->pval_default = owl_strdup(initval);
+ var->set_fn = owl_variable_string_set_default;
+ var->set_fromstring_fn = owl_variable_string_set_fromstring_default;
+ var->get_fn = owl_variable_get_default;
+ var->get_tostring_fn = owl_variable_string_get_tostring_default;
+ var->free_fn = owl_variable_free_default;
+ var->set_fn(var, initval);
+ owl_variable_dict_add_variable(vd, var);
+ }
}
void owl_variable_dict_newvar_int(owl_vardict * vd, char *name, char *summ, char * desc, int initval) {
- owl_variable * var = owl_variable_newvar(name, summ, desc);
- var->type = OWL_VARIABLE_INT;
- var->ival_default = initval;
- var->validate_fn = owl_variable_int_validate_default;
- var->set_fn = owl_variable_int_set_default;
- var->set_fromstring_fn = owl_variable_int_set_fromstring_default;
- var->get_fn = owl_variable_get_default;
- var->get_tostring_fn = owl_variable_int_get_tostring_default;
- var->free_fn = owl_variable_free_default;
- var->val = owl_malloc(sizeof(int));
- var->set_fn(var, &initval);
- owl_variable_dict_add_variable(vd, var);
+ owl_variable *old = owl_variable_get_var(vd, name, OWL_VARIABLE_INT);
+ if(old) {
+ owl_variable_update(old, summ, desc);
+ old->ival_default = initval;
+ } else {
+ owl_variable * var = owl_variable_newvar(name, summ, desc);
+ var->type = OWL_VARIABLE_INT;
+ var->ival_default = initval;
+ var->validate_fn = owl_variable_int_validate_default;
+ var->set_fn = owl_variable_int_set_default;
+ var->set_fromstring_fn = owl_variable_int_set_fromstring_default;
+ var->get_fn = owl_variable_get_default;
+ var->get_tostring_fn = owl_variable_int_get_tostring_default;
+ var->free_fn = owl_variable_free_default;
+ var->val = owl_malloc(sizeof(int));
+ var->set_fn(var, &initval);
+ owl_variable_dict_add_variable(vd, var);
+ }
}
void owl_variable_dict_newvar_bool(owl_vardict * vd, char *name, char *summ, char * desc, int initval) {
- owl_variable * var = owl_variable_newvar(name, summ, desc);
- var->type = OWL_VARIABLE_BOOL;
- var->ival_default = initval;
- var->validate_fn = owl_variable_bool_validate_default;
- var->set_fn = owl_variable_bool_set_default;
- var->set_fromstring_fn = owl_variable_bool_set_fromstring_default;
- var->get_fn = owl_variable_get_default;
- var->get_tostring_fn = owl_variable_bool_get_tostring_default;
- var->free_fn = owl_variable_free_default;
- var->val = owl_malloc(sizeof(int));
- var->set_fn(var, &initval);
- owl_variable_dict_add_variable(vd, var);
+ owl_variable *old = owl_variable_get_var(vd, name, OWL_VARIABLE_BOOL);
+ if(old) {
+ owl_variable_update(old, summ, desc);
+ old->ival_default = initval;
+ } else {
+ owl_variable * var = owl_variable_newvar(name, summ, desc);
+ var->type = OWL_VARIABLE_BOOL;
+ var->ival_default = initval;
+ var->validate_fn = owl_variable_bool_validate_default;
+ var->set_fn = owl_variable_bool_set_default;
+ var->set_fromstring_fn = owl_variable_bool_set_fromstring_default;
+ var->get_fn = owl_variable_get_default;
+ var->get_tostring_fn = owl_variable_bool_get_tostring_default;
+ var->free_fn = owl_variable_free_default;
+ var->val = owl_malloc(sizeof(int));
+ var->set_fn(var, &initval);
+ owl_variable_dict_add_variable(vd, var);
+ }
}
void owl_variable_dict_free(owl_vardict *d) {
@@ -589,6 +617,7 @@
void owl_variable_free(owl_variable *v) {
if (v->free_fn) v->free_fn(v);
+ owl_free(v);
}
@@ -686,12 +715,18 @@
}
}
-/* returns a reference */
-void *owl_variable_get(owl_vardict *d, char *name, int require_type) {
+owl_variable *owl_variable_get_var(owl_vardict *d, char *name, int require_type) {
owl_variable *v;
if (!name) return(NULL);
v = owl_dict_find_element(d, name);
if (v == NULL || !v->get_fn || v->type != require_type) return(NULL);
+ return v;
+}
+
+/* returns a reference */
+void *owl_variable_get(owl_vardict *d, char *name, int require_type) {
+ owl_variable *v = owl_variable_get_var(d, name, require_type);
+ if(v == NULL) return NULL;
return v->get_fn(v);
}
Modified: branches/barnowl_sqlite/owl/zephyr.c
===================================================================
--- branches/barnowl_sqlite/owl/zephyr.c 2008-01-11 22:11:00 UTC (rev 834)
+++ branches/barnowl_sqlite/owl/zephyr.c 2008-01-12 02:32:01 UTC (rev 835)
@@ -562,16 +562,28 @@
owl_function_makemsg("Message sent to -c %s -i %s\n", retnotice->z_class, retnotice->z_class_inst);
}
} else if (!strcmp(retnotice->z_message, ZSRVACK_NOTSENT)) {
- if (strcasecmp(retnotice->z_class, "message")) {
- char buff[1024];
- owl_function_error("No one subscribed to class class %s", retnotice->z_class);
- sprintf(buff, "Could not send message to class %s: no one subscribed.\n", retnotice->z_class);
+ #define BUFFLEN 1024
+ if (retnotice->z_recipient == NULL
+ || *retnotice->z_recipient == NULL
+ || *retnotice->z_recipient == '@') {
+ char buff[BUFFLEN];
+ owl_function_error("No one subscribed to class %s", retnotice->z_class);
+ snprintf(buff, BUFFLEN, "Could not send message to class %s: no one subscribed.\n", retnotice->z_class);
owl_function_adminmsg("", buff);
} else {
- char buff[1024];
+ char buff[BUFFLEN];
tmp = short_zuser(retnotice->z_recipient);
- owl_function_error("%s: Not logged in or subscribing to messages.", tmp);
- sprintf(buff, "Could not send message to %s: not logged in or subscribing to messages.\n", tmp);
+ owl_function_error("%s: Not logged in or subscribing.", tmp);
+ snprintf(buff, BUFFLEN, "Could not send message to %s: not logged in or subscribing to", tmp);
+ if(strcmp(retnotice->z_class, "message")) {
+ snprintf(buff, BUFFLEN,
+ "%s class %s, instance %s.\n", buff,
+ retnotice->z_class,
+ retnotice->z_class_inst);
+ } else {
+ snprintf(buff, BUFFLEN,
+ "%s messages.\n", buff);
+ }
owl_function_adminmsg("", buff);
owl_log_outgoing_zephyr_error(tmp, buff);
owl_free(tmp);