[1049] in BarnOwl Developers
[D-O-H] r1033 - in branches/barnowl_unicode: . owl owl/perl/lib/BarnOwl owl/perl/modules/IRC/lib/BarnOwl/Module owl/perl/modules/IRC/lib/BarnOwl/Module/IRC owl/perl/modules/Jabber/lib/BarnOwl/Module owl/perl/modules/Jabber/lib/Net/Jabber
daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:12:29 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Sat, 3 May 2008 12:52:32 -0400 (EDT)
Author: asedeno
Date: 2008-05-03 12:52:32 -0400 (Sat, 03 May 2008)
New Revision: 1033
Added:
branches/barnowl_unicode/owl/owl_perl.h
Removed:
branches/barnowl_unicode/owl/stylefunc.c
Modified:
branches/barnowl_unicode/
branches/barnowl_unicode/owl/
branches/barnowl_unicode/owl/Makefile.in
branches/barnowl_unicode/owl/aim.c
branches/barnowl_unicode/owl/commands.c
branches/barnowl_unicode/owl/functions.c
branches/barnowl_unicode/owl/global.c
branches/barnowl_unicode/owl/keys.c
branches/barnowl_unicode/owl/owl.c
branches/barnowl_unicode/owl/owl.h
branches/barnowl_unicode/owl/perl/lib/BarnOwl/ModuleLoader.pm
branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/Data.pm
branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/Protocol.pm
branches/barnowl_unicode/owl/perlconfig.c
branches/barnowl_unicode/owl/perlglue.xs
branches/barnowl_unicode/owl/perlwrap.pm
branches/barnowl_unicode/owl/style.c
branches/barnowl_unicode/owl/svkversion
branches/barnowl_unicode/owl/variable.c
Log:
Merged revisions 983-1032 via svnmerge from
file:///afs/sipb.mit.edu/project/barnowl/src/svn/trunk
........
r985 | nelhage | 2008-03-11 12:38:20 -0400 (Tue, 11 Mar 2008) | 2 lines
Generate less ugly error spew if a module fails to load
........
r986 | geofft | 2008-03-13 15:56:20 -0400 (Thu, 13 Mar 2008) | 1 line
Added :webzephyr command with keybinding W.
........
r987 | asedeno | 2008-03-18 23:57:24 -0400 (Tue, 18 Mar 2008) | 2 lines
Fix a race condition in which zephyrs received during init
are not noticed until the next zephyr after entering the mainloop.
........
r988 | geofft | 2008-03-19 15:46:43 -0400 (Wed, 19 Mar 2008) | 6 lines
IRC: explicitly include the network (-a $alias) in reply commands.
This may be unnecessary because :irc-msg looks at getcurmsg() if it cannot
automatically determine the network.
........
r989 | geofft | 2008-03-21 14:47:51 -0400 (Fri, 21 Mar 2008) | 1 line
syntax error.
........
r990 | nelhage | 2008-03-26 02:24:26 -0400 (Wed, 26 Mar 2008) | 2 lines
Fix sending jabbers to JIDs beginning with `+'
........
r994 | nelhage | 2008-03-29 17:02:05 -0400 (Sat, 29 Mar 2008) | 3 lines
Compile zcrypt.c with -w so I don't get all these warnings in my
compile output whenever I change any headers
........
r998 | geofft | 2008-03-31 01:59:47 -0400 (Mon, 31 Mar 2008) | 1 line
Implement /me for outgoing IRC messages
........
r999 | geofft | 2008-03-31 09:58:56 -0400 (Mon, 31 Mar 2008) | 1 line
I think this fixes the resizing bug.
........
r1000 | nelhage | 2008-03-31 11:29:29 -0400 (Mon, 31 Mar 2008) | 2 lines
Make `svkversion' handle exported trees better
........
r1001 | nelhage | 2008-03-31 11:52:39 -0400 (Mon, 31 Mar 2008) | 2 lines
Add a makefile rule to support emacs flymake-mode
........
r1015 | nelhage | 2008-04-04 14:58:45 -0400 (Fri, 04 Apr 2008) | 3 lines
Bind the combinations the iPhone sends for arrow keys [probably other
terminals, too]
........
r1018 | shadow | 2008-04-08 13:57:49 -0400 (Tue, 08 Apr 2008) | 2 lines
avoid null pointer dereference if msg is NULL (or a 0 length is claimed)
........
r1019 | nelhage | 2008-04-09 18:08:26 -0400 (Wed, 09 Apr 2008) | 2 lines
Fix some stupid typos
........
r1020 | chmrr | 2008-04-09 18:16:02 -0400 (Wed, 09 Apr 2008) | 3 lines
r29300@kohr-ah: chmrr | 2008-04-09 18:14:37 -0400
* It's apparently a popular typo
........
r1022 | asedeno | 2008-04-16 17:05:36 -0400 (Wed, 16 Apr 2008) | 2 lines
Jabber reply bugfix.
Reported by several people, resolved by arolfe.
........
r1023 | nelhage | 2008-04-28 23:33:03 -0400 (Mon, 28 Apr 2008) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "735" from
svn+ssh://lunatique.mit.edu/mit/barnowl/src/svn/branches/barnowl_unicode
........
r1024 | nelhage | 2008-04-28 23:33:12 -0400 (Mon, 28 Apr 2008) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "735" from
svn+ssh://lunatique.mit.edu/mit/barnowl/src/svn/branches/barnowl_sqlite
........
r1025 | nelhage | 2008-04-29 01:21:12 -0400 (Tue, 29 Apr 2008) | 2 lines
Clone owl_perl from the sqlite branch because I'm about to make use of it.
........
r1026 | nelhage | 2008-04-29 01:21:13 -0400 (Tue, 29 Apr 2008) | 4 lines
Initial step of moving styles from the current mishmash of different
options to a unified object interface.
No backwards-compatibility support yet.
........
r1027 | nelhage | 2008-04-29 01:21:15 -0400 (Tue, 29 Apr 2008) | 2 lines
Implement back-compat with old-style owl::format_msg() styles
........
r1028 | nelhage | 2008-04-29 01:21:16 -0400 (Tue, 29 Apr 2008) | 2 lines
Remove nearly all references to the "basic" style.
........
r1029 | nelhage | 2008-04-29 01:21:17 -0400 (Tue, 29 Apr 2008) | 2 lines
Support the `style' command again. Note that it is deprecated.
........
r1031 | nelhage | 2008-04-30 13:29:45 -0400 (Wed, 30 Apr 2008) | 2 lines
Refactor default style code somewhat to be more easily extensible
........
Property changes on: branches/barnowl_unicode
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-982
+ /trunk:1-1032
Property changes on: branches/barnowl_unicode/owl
___________________________________________________________________
Name: svk:merge
- 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:2008
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:2008
8baf6839-b125-0410-9df9-922793c80423:/local/barnowl:29300
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_unicode/owl/Makefile.in
===================================================================
--- branches/barnowl_unicode/owl/Makefile.in 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/Makefile.in 2008-05-03 16:52:32 UTC (rev 1033)
@@ -24,7 +24,7 @@
perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \
regex.c history.c view.c dict.c variable.c filterelement.c pair.c \
keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c \
- aim.c buddy.c buddylist.c timer.c style.c stylefunc.c errqueue.c \
+ aim.c buddy.c buddylist.c timer.c style.c errqueue.c \
zbuddylist.c muxevents.c popexec.c obarray.c select.c wcwidth.c \
glib_compat.c
OWL_SRC = owl.c
@@ -47,15 +47,20 @@
HEADERS=$(GEN_H) owl.h config.h test.h
-%.o: %.c $(HEADERS)
- $(CC) -c $(CFLAGS) $< -o $@
-
$(EXE): $(AUTOGEN) $(OBJS) owl.o libfaim
$(ATHSTATIC) $(CC) -o $(EXE) owl.o $(OBJS) $(LDFLAGS) $(LIBS)
tester: $(AUTOGEN) $(OBJS) tester.o
$(ATHSTATIC) $(CC) -o tester tester.o $(OBJS) $(LDFLAGS) $(LIBS)
+%.o: %.c $(HEADERS)
+ $(CC) -c $(CFLAGS) $< -o $@
+
+# zcrypt is old crufty DES code I don't want to touch
+# Disable all warnings when compiling it
+zcrypt.o: zcrypt.c $(HEADERS)
+ $(CC) -c $(CFLAGS) $< -w -o $@
+
test: tester
./tester reg
@@ -99,15 +104,14 @@
mv -f owl_prototypes.h.new $@; }
#owl_prototypes.h:
-.PHONY: tags clean distclean proto test
+.PHONY: tags clean distclean proto test check-syntax
tags: TAGS
TAGS: $(BASE_SRCS) $(OWL_SRC) $(TESTER_SRC) $(GEN_C) owl.h $(GEN_H)
etags $(BASE_SRCS) $(OWL_SRC) $(TESTER_SRC) $(GEN_C) owl.h $(GEN_H)
-$(BASE_OBJS) varstubs.h:: owl.h config.h owl_prototypes.h
-#$(BASE_OBJS) varstubs.h:: owl.h config.h
+$(BASE_OBJS) varstubs.h: owl.h config.h owl_prototypes.h
libfaim: libfaim/libfaim.a
@@ -134,3 +138,7 @@
installdirs: mkinstalldirs
${srcdir}/mkinstalldirs ${DESTDIR}${bindir} ${DESTDIR}${mandir}/man1 ${DESTDIR}${datadir}
+
+# For emacs flymake-mode
+check-syntax: proto
+ $(CC) $(CFLAGS) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES)
Modified: branches/barnowl_unicode/owl/aim.c
===================================================================
--- branches/barnowl_unicode/owl/aim.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/aim.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -1451,7 +1451,8 @@
* containing Smart Quotes.
*
*/
- strncpy(realmsg, args->msg, sizeof(realmsg));
+ if (args->msg && args->msglen)
+ strncpy(realmsg, args->msg, sizeof(realmsg));
}
owl_function_debugmsg("faimtest_parse_incoming_im_chan1: message from: %s", userinfo->sn?userinfo->sn:"");
Modified: branches/barnowl_unicode/owl/commands.c
===================================================================
--- branches/barnowl_unicode/owl/commands.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/commands.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -101,14 +101,6 @@
"Use 'show keymaps' to see the existing keymaps.\n"
"Key sequences may be things like M-C-t or NPAGE.\n"),
- OWLCMD_ARGS("style", owl_command_style, OWL_CTX_ANY,
- "creates a new style",
- "style <name> perl <function_name>",
- "Creates a new style for formatting messages.\n"
- "A style named <name> will be created that will\n"
- "format messages using the perl function <function_name>.\n\n"
- "SEE ALSO: show styles, view -s, filter -s\n"),
-
OWLCMD_ARGS("zwrite", owl_command_zwrite, OWL_CTX_INTERACTIVE,
"send a zephyr",
"zwrite [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [<user> ...] [-m <message...>]",
@@ -179,7 +171,7 @@
"print a variable value",
"print <variable>\n"
"print",
- "Print the value of the named variable. If no arugments\n"
+ "Print the value of the named variable. If no arguments\n"
"are used print the value of all variables.\n"),
OWLCMD_ARGS("startup", owl_command_startup, OWL_CTX_ANY,
@@ -598,7 +590,7 @@
"view only messages similar to the current message",
"smartnarrow [-i | --instance]",
"If the curmsg is a personal message narrow\n"
- " to the converstaion with that user.\n"
+ " to the conversation with that user.\n"
"If the curmsg is a class message, instance foo, recip *\n"
" message, narrow to the class, inst.\n"
"If the curmsg is a class message then narrow\n"
@@ -610,7 +602,7 @@
"returns the name of a filter based on the current message",
"smartfilter [-i | --instance]",
"If the curmsg is a personal message, the filter is\n"
- " the converstaion with that user.\n"
+ " the conversation with that user.\n"
"If the curmsg is a class message, instance foo, recip *\n"
" message, the filter is the class, inst.\n"
"If the curmsg is a class message, the filter is that class.\n"
@@ -962,6 +954,8 @@
"exits the popless window",
"", ""),
+ OWLCMD_ALIAS("webzephyr", "zwrite daemon.webzephyr -c webzephyr -i"),
+
/* This line MUST be last! */
{ NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
@@ -1673,27 +1667,6 @@
return NULL;
}
-char *owl_command_style(int argc, char **argv, char *buff) {
- owl_style *s;
-
- /* Usage: style <name> perl <function> */
- if (argc != 4 || strcmp(argv[2], "perl")) {
- owl_function_makemsg("Usage: style <name> perl <function>");
- return NULL;
- }
- if (!owl_perlconfig_is_function(argv[3])) {
- owl_function_makemsg("Unable to create style '%s': no perl function '%s'",
- argv[1], argv[3]);
- return NULL;
- }
- s=owl_malloc(sizeof(owl_style));
- owl_style_create_perl(s, argv[1], argv[3], NULL);
- owl_global_add_style(&g, s);
-
- return NULL;
-}
-
-
void owl_command_quit()
{
owl_function_quit();
Modified: branches/barnowl_unicode/owl/functions.c
===================================================================
--- branches/barnowl_unicode/owl/functions.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/functions.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -257,7 +257,7 @@
/* check the arguments */
ret=owl_zwrite_create_from_line(&z, line);
if (ret) {
- owl_function_error("Error in zwrite arugments");
+ owl_function_error("Error in zwrite arguments");
owl_zwrite_free(&z);
return;
}
@@ -1924,7 +1924,7 @@
owl_fmtext_append_normal(&fm, OWL_VERSION_STRING);
owl_fmtext_append_normal(&fm, "\n");
- owl_fmtext_append_normal(&fm, " Startup Arugments: ");
+ owl_fmtext_append_normal(&fm, " Startup Arguments: ");
owl_fmtext_append_normal(&fm, owl_global_get_startupargs(&g));
owl_fmtext_append_normal(&fm, "\n");
Modified: branches/barnowl_unicode/owl/global.c
===================================================================
--- branches/barnowl_unicode/owl/global.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/global.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -452,6 +452,7 @@
owl_mainwin_redisplay(&(g->mw));
sepbar(NULL);
owl_editwin_redisplay(&(g->tw), 0);
+ owl_function_full_redisplay(&g);
/* TODO: this should handle other forms of popwins */
if (owl_popwin_is_active(owl_global_get_popwin(g))
Modified: branches/barnowl_unicode/owl/keys.c
===================================================================
--- branches/barnowl_unicode/owl/keys.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/keys.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -229,11 +229,15 @@
BIND_CMD("?", "start-command search -r ", "start a reverse search command");
BIND_CMD("LEFT", "recv:shiftleft", "");
+ BIND_CMD("M-[ D", "recv:shiftleft", "");
BIND_CMD("RIGHT", "recv:shiftright","");
+ BIND_CMD("M-[ C", "recv:shiftleft", "");
BIND_CMD("DOWN", "recv:next", "");
BIND_CMD("C-n", "recv:next", "");
+ BIND_CMD("M-[ B", "recv:next", "");
BIND_CMD("M-C-n", "recv:next --smart-filter", "move to next message matching the current one");
BIND_CMD("UP", "recv:prev", "");
+ BIND_CMD("M-[ A", "recv:prev", "");
BIND_CMD("n", "recv:next-notdel", "");
BIND_CMD("p", "recv:prev-notdel", "");
BIND_CMD("C-p", "recv:prev", "");
@@ -280,6 +284,8 @@
BIND_CMD("w", "openurl", "open a URL using a webbrowser");
+ BIND_CMD("W", "start-command webzephyr ", "start a webzephyr command");
+
BIND_CMD("C-c", "", "no effect in this mode");
BIND_CMD("C-g", "", "no effect in this mode");
Modified: branches/barnowl_unicode/owl/owl.c
===================================================================
--- branches/barnowl_unicode/owl/owl.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/owl.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -273,13 +273,6 @@
exit(1);
}
- /* setup the built-in styles */
- owl_function_debugmsg("startup: creating built-in styles");
-
- s=owl_malloc(sizeof(owl_style));
- owl_style_create_internal(s, "basic", &owl_stylefunc_basic, "Basic message formatting.");
- owl_global_add_style(&g, s);
-
/* setup the default filters */
/* the personal filter will need to change again when AIM chat's are
* included. Also, there should be an %aimme% */
@@ -408,12 +401,8 @@
owl_function_debugmsg("startup: setting startup and default style");
if (0 != strcmp(owl_global_get_default_style(&g), "__unspecified__")) {
/* the style was set by the user: leave it alone */
- } else if (owl_global_is_config_format(&g)) {
- owl_global_set_default_style(&g, "perl");
- } else if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) {
- owl_global_set_default_style(&g, "default");
} else {
- owl_global_set_default_style(&g, "basic");
+ owl_global_set_default_style(&g, "default");
}
/* zlog in if we need to */
@@ -435,6 +424,11 @@
nexttimediff=10;
nexttime=time(NULL);
+#ifdef HAVE_LIBZEPHYR
+ /* Check for any zephyrs that have come in while we've done init. */
+ owl_zephyr_process_events();
+#endif
+
owl_function_debugmsg("startup: entering main loop");
/* main loop */
while (1) {
@@ -594,7 +588,7 @@
if(owl_message_is_direction_in(m)) {
/* let perl know about it*/
- owl_perlconfig_getmsg(m, 0, NULL);
+ owl_perlconfig_getmsg(m, NULL);
/* do we need to autoreply? */
if (owl_global_is_zaway(&g) && !owl_message_get_attribute_value(m, "isauto")) {
Modified: branches/barnowl_unicode/owl/owl.h
===================================================================
--- branches/barnowl_unicode/owl/owl.h 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/owl.h 2008-05-03 16:52:32 UTC (rev 1033)
@@ -69,6 +69,7 @@
/* aim.h defines bool */
#define HAS_BOOL
#include <perl.h>
+#include "owl_perl.h"
#undef logout
#include "XSUB.h"
#else
@@ -162,9 +163,6 @@
#define OWL_SCROLLMODE_PAGED 4
#define OWL_SCROLLMODE_PAGEDCENTER 5
-#define OWL_STYLE_TYPE_INTERNAL 0
-#define OWL_STYLE_TYPE_PERL 1
-
#define OWL_TAB 3 /* This *HAS* to be the size of TABSTR below */
#define OWL_TABSTR " "
#define OWL_MSGTAB 7
@@ -385,10 +383,7 @@
typedef struct _owl_style {
char *name;
- char *description;
- int type;
- char *perlfuncname;
- void (*formatfunc) (owl_fmtext *fm, owl_message *m);
+ SV *perlobj;
} owl_style;
typedef struct _owl_mainwin {
Copied: branches/barnowl_unicode/owl/owl_perl.h (from rev 1031, trunk/owl/owl_perl.h)
===================================================================
--- branches/barnowl_unicode/owl/owl_perl.h (rev 0)
+++ branches/barnowl_unicode/owl/owl_perl.h 2008-05-03 16:52:32 UTC (rev 1033)
@@ -0,0 +1,55 @@
+#ifndef INC_OWL_PERL_H
+#define INC_OWL_PERL_H
+
+#define OWL_PERL_VOID_CALL (void)POPs;
+
+/*
+ * This macro defines a convenience wrapper around the boilerplate of
+ * calling a method on a perl object (SV*) from C.
+ *
+ * Arguments are
+ * * obj - the SV* to call the method on
+ * * meth - a char* method name
+ * * args - a code block responsible for pushing args (other than the object)
+ * * err - a string with a %s format specifier to log in case of error
+ * * fatalp - if true, perl errors terminate barnowl
+ * * ret - a code block executed if the call succeeded
+ *
+ * See also: `perldoc perlcall', `perldoc perlapi'
+ */
+#define OWL_PERL_CALL_METHOD(obj, meth, args, err, fatalp, ret) { \
+ int count; \
+ dSP; \
+ ENTER; \
+ SAVETMPS; \
+ PUSHMARK(SP); \
+ XPUSHs(obj); \
+ {args} \
+ PUTBACK; \
+ \
+ count = call_method(meth, G_SCALAR|G_EVAL); \
+ \
+ SPAGAIN; \
+ \
+ if(count != 1) { \
+ fprintf(stderr, "perl returned wrong count: %d\n", count); \
+ abort(); \
+ } \
+ if (SvTRUE(ERRSV)) { \
+ if(fatalp) { \
+ printf(err, SvPV_nolen(ERRSV)); \
+ exit(-1); \
+ } else { \
+ owl_function_error(err, SvPV_nolen(ERRSV)); \
+ (void)POPs; \
+ sv_setsv(ERRSV, &PL_sv_undef); \
+ } \
+ } else { \
+ ret; \
+ } \
+ PUTBACK; \
+ FREETMPS; \
+ LEAVE; \
+}
+
+#endif //INC_PERL_PERL_H
Modified: branches/barnowl_unicode/owl/perl/lib/BarnOwl/ModuleLoader.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/lib/BarnOwl/ModuleLoader.pm 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/perl/lib/BarnOwl/ModuleLoader.pm 2008-05-03 16:52:32 UTC (rev 1033)
@@ -39,7 +39,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: \n$@\n") if $@;
}
}
Modified: branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm 2008-05-03 16:52:32 UTC (rev 1033)
@@ -107,9 +107,9 @@
(notice => 'true') : (),
is_private($recipient) ?
(isprivate => 'true') : (channel => $recipient),
- replycmd => 'irc-msg ' .
+ replycmd => 'irc-msg -a ' . $self->alias . ' ' .
(is_private($recipient) ? $evt->nick : $recipient),
- replysendercmd => 'irc-msg ' . $evt->nick
+ replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick
);
BarnOwl::queue_message($msg);
@@ -157,6 +157,8 @@
my $msg = $self->new_message($evt,
loginout => 'login',
channel => $evt->to,
+ replycmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick,
+ replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick
);
BarnOwl::queue_message($msg);
}
@@ -166,6 +168,8 @@
my $msg = $self->new_message($evt,
loginout => 'logout',
channel => $evt->to,
+ replycmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick,
+ replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick
);
BarnOwl::queue_message($msg);
}
Modified: branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-05-03 16:52:32 UTC (rev 1033)
@@ -198,7 +198,7 @@
if(@_) {
process_msg($conn, $to, join(" ", @_));
} else {
- BarnOwl::start_edit_win("/msg $to -a " . $conn->alias, sub {process_msg($conn, $to, @_)});
+ BarnOwl::start_edit_win("/msg -a " . $conn->alias . " $to", sub {process_msg($conn, $to, @_)});
}
}
@@ -208,7 +208,12 @@
my $body = shift;
# Strip whitespace. In the future -- send one message/line?
$body =~ tr/\n\r/ /;
- $conn->conn->privmsg($to, $body);
+ if ($body =~ /^\/me (.*)/) {
+ $conn->conn->me($to, $1);
+ $body = BarnOwl::Style::boldify($conn->nick.' '.$1);
+ } else {
+ $conn->conn->privmsg($to, $body);
+ }
my $msg = BarnOwl::Message->new(
type => 'IRC',
direction => is_private($to) ? 'out' : 'in',
@@ -219,8 +224,8 @@
sender => $conn->nick,
is_private($to) ?
(isprivate => 'true') : (channel => $to),
- replycmd => "irc-msg $to",
- replysendercmd => "irc-msg $to"
+ replycmd => "irc-msg -a " . $conn->alias . " $to",
+ replysendercmd => "irc-msg -a " . $conn->alias . " $to"
);
BarnOwl::queue_message($msg);
}
Modified: branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2008-05-03 16:52:32 UTC (rev 1033)
@@ -24,6 +24,7 @@
use Net::Jabber::MUC;
use Net::DNS;
use Getopt::Long;
+Getopt::Long::Configure(qw(no_getopt_compat prefix_pattern=-|--));
use utf8;
@@ -478,7 +479,7 @@
'subject=s' => \$jwrite_subject,
'account=s' => \$from,
'id=s' => \$jwrite_sid,
- );
+ ) or die("Usage: jwrite JID [-t thread] [-s 'subject'] [-a account]\n");
$jwrite_type = 'groupchat' if $gc;
if ( scalar @ARGV != 1 ) {
@@ -569,7 +570,7 @@
}
my $getopt = Getopt::Long::Parser->new;
- $getopt->configure('pass_through');
+ $getopt->configure('pass_through', 'no_getopt_compat');
$getopt->getoptions( 'account=s' => \$jid );
$jid ||= defaultJID();
if ($jid) {
@@ -733,7 +734,7 @@
my @groups;
my $purgeGroups;
my $getopt = Getopt::Long::Parser->new;
- $getopt->configure('pass_through');
+ $getopt->configure('pass_through', 'no_getopt_compat');
$getopt->getoptions(
'account=s' => \$jid,
'group=s' => \@groups,
Modified: branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/Data.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/Data.pm 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/Data.pm 2008-05-03 16:52:32 UTC (rev 1033)
@@ -119,7 +119,7 @@
In an effort to make maintaining this document easier, I am not going
to go into full detail on each of these functions. Rather I will
present the functions in a list with a type in the first column to
-show what they return, or take as arugments. Here is the list of
+show what they return, or take as arguments. Here is the list of
types I will use:
string - just a string
Modified: branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/Protocol.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/Protocol.pm 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/Protocol.pm 2008-05-03 16:52:32 UTC (rev 1033)
@@ -939,7 +939,7 @@
if (!exists($funcHash{set}) && exists($funcHash{get}))
{
- croak("The DefineNamespace arugments have changed, and I cannot determine the\nnew values automatically for name($name). Please read the man page\nfor Net::Jabber::Namespaces. I apologize for this incompatability.\n");
+ croak("The DefineNamespace arguments have changed, and I cannot determine the\nnew values automatically for name($name). Please read the man page\nfor Net::Jabber::Namespaces. I apologize for this incompatability.\n");
}
if (exists($funcHash{type}) || exists($funcHash{path}) ||
Modified: branches/barnowl_unicode/owl/perlconfig.c
===================================================================
--- branches/barnowl_unicode/owl/perlconfig.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/perlconfig.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -410,34 +410,14 @@
return(out);
}
-char *owl_perlconfig_getmsg(owl_message *m, int mode, char *subname)
-{
- /* if mode==1 we are doing message formatting. The returned
- * formatted message needs to be freed by the caller.
- *
- * if mode==0 we are just doing the message-has-been-received
- * thing.
- */
- if (!owl_global_have_config(&g)) return(NULL);
-
- /* run the procedure corresponding to the mode */
- if (mode==1) {
- char *ret = NULL;
- ret = owl_perlconfig_call_with_message(subname?subname
- :"BarnOwl::_format_msg_legacy_wrap", m);
- if (!ret) {
- ret = owl_sprintf("@b([Perl Message Formatting Failed!])\n");
- }
- return ret;
- } else {
- char *ptr = NULL;
- if (owl_perlconfig_is_function("BarnOwl::Hooks::_receive_msg")) {
- ptr = owl_perlconfig_call_with_message(subname?subname
- :"BarnOwl::_receive_msg_legacy_wrap", m);
- }
- if (ptr) owl_free(ptr);
- return(NULL);
+void owl_perlconfig_getmsg(owl_message *m, char *subname)
+{
+ char *ptr = NULL;
+ if (owl_perlconfig_is_function("BarnOwl::Hooks::_receive_msg")) {
+ ptr = owl_perlconfig_call_with_message(subname?subname
+ :"BarnOwl::_receive_msg_legacy_wrap", m);
}
+ if (ptr) owl_free(ptr);
}
char *owl_perlconfig_perlcmd(owl_cmd *cmd, int argc, char **argv)
Modified: branches/barnowl_unicode/owl/perlglue.xs
===================================================================
--- branches/barnowl_unicode/owl/perlglue.xs 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/perlglue.xs 2008-05-03 16:52:32 UTC (rev 1033)
@@ -255,18 +255,15 @@
}
void
-_create_style(name, function, description)
+create_style(name, object)
char *name
- char *function
- char *description
+ SV *object
PREINIT:
- /* This is to allow us to bootstrap the default style before the
- command architecture has been initialized */
owl_style *s;
CODE:
{
s = owl_malloc(sizeof(owl_style));
- owl_style_create_perl(s, name, function, description);
+ owl_style_create_perl(s, name, object);
owl_global_add_style(&g, s);
}
Modified: branches/barnowl_unicode/owl/perlwrap.pm
===================================================================
--- branches/barnowl_unicode/owl/perlwrap.pm 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/perlwrap.pm 2008-05-03 16:52:32 UTC (rev 1033)
@@ -154,13 +154,6 @@
$configfile ||= $ENV{HOME}."/.owlconf";
# populate global variable space for legacy owlconf files
-sub _format_msg_legacy_wrap {
- my ($m) = @_;
- $m->legacy_populate_global();
- return &BarnOwl::format_msg($m);
-}
-
-# populate global variable space for legacy owlconf files
sub _receive_msg_legacy_wrap {
my ($m) = @_;
$m->legacy_populate_global();
@@ -691,6 +684,20 @@
# Internal startup/shutdown routines called by the C code
+sub _load_perl_commands {
+ # Load builtin perl commands
+ BarnOwl::new_command(style => \&BarnOwl::Style::style_command,
+ {
+ summary => "creates a new style",
+ usage => "style <name> perl <function_name>",
+ description =>
+ "A style named <name> will be created that will\n" .
+ "format messages using the perl function <function_name>.\n\n" .
+ "SEE ALSO: show styles, view -s, filter -s\n\n" .
+ "DEPRECATED in favor of BarnOwl::create_style(NAME, OBJECT)",
+ });
+}
+
sub _load_owlconf {
# load the config file
if ( -r $BarnOwl::configfile ) {
@@ -701,10 +708,12 @@
package BarnOwl;
if(*BarnOwl::format_msg{CODE}) {
# if the config defines a legacy formatting function, add 'perl' as a style
- BarnOwl::_create_style("perl", "BarnOwl::_format_msg_legacy_wrap",
- "User-defined perl style that calls BarnOwl::format_msg"
- . " with legacy global variable support");
- BarnOwl::set("-q default_style perl");
+ BarnOwl::create_style("perl", BarnOwl::Style::Legacy->new(
+ "BarnOwl::format_msg",
+ "User-defined perl style that calls BarnOwl::format_msg"
+ . " with legacy global variable support",
+ 1));
+ BarnOwl::set("-q default_style perl");
}
}
}
@@ -714,6 +723,7 @@
# with compatibility by calling the old, fixed-name hooks.
sub _startup {
+ _load_perl_commands();
_load_owlconf();
if(eval {require BarnOwl::ModuleLoader}) {
@@ -762,21 +772,33 @@
################################################################################
sub format_message($)
{
- my $m = shift;
+ my $self = shift;
+ my $m = shift;
+ my $fmt;
if ( $m->is_loginout) {
- return format_login($m);
+ $fmt = $self->format_login($m);
} elsif($m->is_ping && $m->is_personal) {
- return ( "\@b(PING) from \@b(" . $m->pretty_sender . ")\n" );
+ $fmt = $self->format_ping($m);
} elsif($m->is_admin) {
- return "\@bold(OWL ADMIN)\n" . indentBody($m);
+ $fmt = $self->format_admin($m);
} else {
- return format_chat($m);
+ $fmt = $self->format_chat($m);
}
+ $fmt = BarnOwl::Style::boldify($fmt) if $self->should_bold($m);
+ return $fmt;
}
-BarnOwl::_create_style("default", "BarnOwl::Style::Default::format_message", "Default style");
+sub should_bold {
+ my $self = shift;
+ my $m = shift;
+ return $m->is_personal && $m->direction eq "in";
+}
+sub description {"Default style";}
+
+BarnOwl::create_style("default", "BarnOwl::Style::Default");
+
################################################################################
sub time_hhmm {
@@ -786,6 +808,7 @@
}
sub format_login($) {
+ my $self = shift;
my $m = shift;
return sprintf(
'@b<%s%s> for @b(%s) (%s) %s',
@@ -797,8 +820,28 @@
);
}
+sub format_ping {
+ my $self = shift;
+ my $m = shift;
+ return "\@b(PING) from \@b(" . $m->pretty_sender . ")\n";
+}
+
+sub format_admin {
+ my $self = shift;
+ my $m = shift;
+ return "\@bold(OWL ADMIN)\n" . $self->indent_body($m);
+}
+
sub format_chat($) {
+ my $self = shift;
my $m = shift;
+ my $header = $self->chat_header($m);
+ return $header . "\n". $self->indent_body($m);
+}
+
+sub chat_header {
+ my $self = shift;
+ my $m = shift;
my $header;
if ( $m->is_personal ) {
if ( $m->direction eq "out" ) {
@@ -818,19 +861,21 @@
$header .= " [" . $m->opcode . "]";
}
$header .= " " . time_hhmm($m);
+ $header .= $self->format_sender($m);
+ return $header;
+}
+
+sub format_sender {
+ my $self = shift;
+ my $m = shift;
my $sender = $m->long_sender;
$sender =~ s/\n.*$//s;
- $header .= " " x (4 - ((length $header) % 4));
- $header .= "(" . $sender . '@color[default]' . ")";
- my $message = $header . "\n". indentBody($m);
- if($m->is_personal && $m->direction eq "in") {
- $message = BarnOwl::Style::boldify($message);
- }
- return $message;
+ return " (" . $sender . '@color[default]' . ")";
}
-sub indentBody($)
+sub indent_body($)
{
+ my $self = shift;
my $m = shift;
my $body = $m->body;
@@ -845,36 +890,27 @@
return " ".$body;
}
+package BarnOwl::Style::Basic;
+our @ISA=qw(BarnOwl::Style::Default);
+
+sub description {"Compatability alias for the default style";}
+
+BarnOwl::create_style("basic", "BarnOwl::Style::Basic");
+
package BarnOwl::Style::OneLine;
-################################################################################
-# Branching point for various formatting functions in this style.
-################################################################################
+# Inherit format_message to dispatch
+our @ISA = qw(BarnOwl::Style::Default);
+
use constant BASE_FORMAT => '%s %-13.13s %-11.11s %-12.12s ';
-sub format_message($) {
- my $m = shift;
-# if ( $m->is_zephyr ) {
-# return format_zephyr($m);
-# }
- if ( $m->is_loginout ) {
- return format_login($m);
- }
- elsif ( $m->is_ping) {
- return format_ping($m);
- }
- elsif ( $m->is_admin || $m->is_loopback) {
- return format_local($m);
- }
- else {
- return format_chat($m);
- }
-}
+sub description {"Formats for one-line-per-message"}
-BarnOwl::_create_style("oneline", "BarnOwl::Style::OneLine::format_message", "Formats for one-line-per-message");
+BarnOwl::create_style("oneline", "BarnOwl::Style::OneLine");
################################################################################
sub format_login($) {
+ my $self = shift;
my $m = shift;
return sprintf(
BASE_FORMAT,
@@ -897,6 +933,7 @@
sub format_chat($)
{
+ my $self = shift;
my $m = shift;
my $dir = lc($m->{direction});
my $dirsym = '-';
@@ -910,36 +947,35 @@
my $line;
if ($m->is_personal) {
$line= sprintf(BASE_FORMAT,
- $dirsym,
- $m->type,
- '',
- ($dir eq 'out'
- ? $m->pretty_recipient
- : $m->pretty_sender));
+ $dirsym,
+ $m->type,
+ '',
+ ($dir eq 'out'
+ ? $m->pretty_recipient
+ : $m->pretty_sender));
}
else {
$line = sprintf(BASE_FORMAT,
- $dirsym,
- $m->context,
- $m->subcontext,
- ($dir eq 'out'
- ? $m->pretty_recipient
- : $m->pretty_sender));
+ $dirsym,
+ $m->context,
+ $m->subcontext,
+ ($dir eq 'out'
+ ? $m->pretty_recipient
+ : $m->pretty_sender));
}
my $body = $m->{body};
$body =~ tr/\n/ /;
$line .= $body;
- $line = BarnOwl::Style::boldify($line) if ($m->is_personal && lc($m->direction) eq 'in');
return $line;
}
-# Format locally generated messages
-sub format_local($)
+# Format owl admin messages
+sub format_admin($)
{
+ my $self = shift;
my $m = shift;
- my $type = uc($m->{type});
- my $line = sprintf(BASE_FORMAT, '<', $type, '', '');
+ my $line = sprintf(BASE_FORMAT, '<', 'ADMIN', '', '');
my $body = $m->{body};
$body =~ tr/\n/ /;
return $line.$body;
@@ -967,7 +1003,52 @@
}
}
+sub style_command {
+ my $command = shift;
+ if(scalar @_ != 3 || $_[1] ne 'perl') {
+ die("Usage: style <name> perl <function>\n");
+ }
+ my $name = shift;
+ my $perl = shift;
+ my $fn = shift;
+ {
+ no strict 'refs';
+ unless(*{$fn}{CODE}) {
+ die("Unable to create style '$name': no perl function '$fn'\n");
+ }
+ }
+ BarnOwl::create_style($name, BarnOwl::Style::Legacy->new($fn));
+}
+package BarnOwl::Style::Legacy;
+
+sub new {
+ my $class = shift;
+ my $func = shift;
+ my $desc = shift;
+ my $useglobals = shift;
+ $useglobals = 0 unless defined($useglobals);
+ return bless {function => $func,
+ description => $desc,
+ useglobals => $useglobals}, $class;
+}
+
+sub description {
+ my $self = shift;
+ return $self->{description} ||
+ ("User-defined perl style that calls " . $self->{function});
+};
+
+sub format_message {
+ my $self = shift;
+ if($self->{useglobals}) {
+ $_[0]->legacy_populate_global();
+ }
+ no strict 'refs';
+ goto \&{$self->{function}};
+}
+
+
# switch to package main when we're done
package main;
Modified: branches/barnowl_unicode/owl/style.c
===================================================================
--- branches/barnowl_unicode/owl/style.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/style.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -1,3 +1,4 @@
+#define OWL_PERL
#include "owl.h"
static const char fileIdent[] = "$Id$";
@@ -2,29 +3,8 @@
-void owl_style_create_internal(owl_style *s, char *name, void (*formatfunc) (owl_fmtext *fm, owl_message *m), char *description)
+void owl_style_create_perl(owl_style *s, char *name, SV *obj)
{
- s->type=OWL_STYLE_TYPE_INTERNAL;
s->name=owl_strdup(name);
- if (description) {
- s->description=owl_strdup(description);
- } else {
- s->description=owl_sprintf("Owl internal style %s", name);
- }
- s->perlfuncname=NULL;
- s->formatfunc=formatfunc;
+ s->perlobj = SvREFCNT_inc(obj);
}
-void owl_style_create_perl(owl_style *s, char *name, char *perlfuncname, char *description)
-{
- s->type=OWL_STYLE_TYPE_PERL;
- s->name=owl_strdup(name);
- s->perlfuncname=owl_strdup(perlfuncname);
- if (description) {
- s->description=owl_strdup(description);
- } else {
- s->description=owl_sprintf("User-defined perl style that calls %s",
- perlfuncname);
- }
- s->formatfunc=NULL;
-}
-
int owl_style_matches_name(owl_style *s, char *name)
@@ -42,7 +22,19 @@
char *owl_style_get_description(owl_style *s)
{
- return(s->description);
+ SV *sv = NULL;
+ OWL_PERL_CALL_METHOD(s->perlobj,
+ "description",
+ /* no args */,
+ "Error in style_get_description: %s",
+ 0,
+ sv = SvREFCNT_inc(POPs);
+ );
+ if(sv) {
+ return SvPV_nolen(sv_2mortal(sv));
+ } else {
+ return "[error getting description]";
+ }
}
/* Use style 's' to format message 'm' into fmtext 'fm'.
@@ -50,55 +42,52 @@
*/
void owl_style_get_formattext(owl_style *s, owl_fmtext *fm, owl_message *m)
{
- if (s->type==OWL_STYLE_TYPE_INTERNAL) {
- (* s->formatfunc)(fm, m);
- } else if (s->type==OWL_STYLE_TYPE_PERL) {
- char *body, *indent;
- int curlen;
+ char *body, *indent;
+ int curlen;
- /* run the perl function */
- body=owl_perlconfig_getmsg(m, 1, s->perlfuncname);
- if (!strcmp(body, "")) {
- owl_free(body);
- body=owl_strdup("<unformatted message>");
- }
-
- /* indent and ensure ends with a newline */
- indent=owl_malloc(strlen(body)+(owl_text_num_lines(body))*OWL_TAB+10);
- owl_text_indent(indent, body, OWL_TAB);
- curlen = strlen(indent);
- if (curlen==0 || indent[curlen-1] != '\n') {
- indent[curlen] = '\n';
- indent[curlen+1] = '\0';
- }
+ SV *sv = NULL;
+
+ /* Call the perl object */
+ OWL_PERL_CALL_METHOD(s->perlobj,
+ "format_message",
+ XPUSHs(owl_perlconfig_message2hashref(m));,
+ "Error in format_message: %s",
+ 0,
+ sv = SvREFCNT_inc(POPs);
+ );
- /* fmtext_append. This needs to change */
- owl_fmtext_append_ztext(fm, indent);
-
- owl_free(indent);
- owl_free(body);
+ if(sv) {
+ body = SvPV_nolen(sv);
+ } else {
+ body = "<unformatted message>";
}
+
+ /* indent and ensure ends with a newline */
+ indent=owl_malloc(strlen(body)+(owl_text_num_lines(body))*OWL_TAB+10);
+ owl_text_indent(indent, body, OWL_TAB);
+ curlen = strlen(indent);
+ if (curlen==0 || indent[curlen-1] != '\n') {
+ indent[curlen] = '\n';
+ indent[curlen+1] = '\0';
+ }
+
+ /* fmtext_append. This needs to change */
+ owl_fmtext_append_ztext(fm, indent);
+
+ owl_free(indent);
+ if(sv)
+ SvREFCNT_dec(body);
}
int owl_style_validate(owl_style *s) {
- if (!s) {
+ if (!s || !s->perlobj || !SvOK(s->perlobj)) {
return -1;
- } else if (s->type==OWL_STYLE_TYPE_INTERNAL) {
- return 0;
- } else if (s->type==OWL_STYLE_TYPE_PERL
- && s->perlfuncname
- && owl_perlconfig_is_function(s->perlfuncname)) {
- return 0;
- } else {
- return -1;
}
+ return 0;
}
void owl_style_free(owl_style *s)
{
if (s->name) owl_free(s->name);
- if (s->description) owl_free(s->description);
- if (s->type==OWL_STYLE_TYPE_PERL && s->perlfuncname) {
- owl_free(s->perlfuncname);
- }
+ SvREFCNT_dec(s->perlobj);
}
Deleted: branches/barnowl_unicode/owl/stylefunc.c
===================================================================
--- branches/barnowl_unicode/owl/stylefunc.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/stylefunc.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -1,221 +0,0 @@
-#include "owl.h"
-
-static const char fileIdent[] = "$Id$";
-
-/* In all of these functions, 'fm' is expected to already be
- * initialized.
- */
-
-void owl_style_basic_format_body(owl_fmtext *fm, owl_message *m) {
- char *indent, *body;
- owl_filter *f;
- int wrap = 0;
-
- /* get the body */
- body=owl_strdup(owl_message_get_body(m));
-
- f = owl_global_get_filter(&g, "wordwrap");
- if(f && owl_filter_message_match(f, m))
- wrap = 1;
-
- if(wrap) {
- int cols, i, width, word;
- char *tab, *tok, *ws = " \t\n\r";
- cols = owl_global_get_cols(&g) - OWL_MSGTAB - 1;
-
- tab = owl_malloc(OWL_MSGTAB+1);
- for(i = 0; i < OWL_MSGTAB; i++) {
- tab[i] = ' ';
- }
- tab[OWL_MSGTAB] = 0;
-
- tok = strtok(body, ws);
- tab[OWL_MSGTAB-1] = 0;
- owl_fmtext_append_normal(fm, tab);
- tab[OWL_MSGTAB-1] = ' ';
- width = 0;
-
- while(tok) {
- word = strlen(tok);
- if(word + width + 1 < cols) {
- owl_fmtext_append_normal(fm, " ");
- owl_fmtext_append_normal(fm, tok);
- width += word + 1;
- } else {
- owl_fmtext_append_normal(fm, "\n");
- owl_fmtext_append_normal(fm, tab);
- owl_fmtext_append_normal(fm, tok);
- width = word;
- }
- tok = strtok(NULL, ws);
- }
- owl_fmtext_append_normal(fm, "\n");
-
- owl_free(tab);
- } else {
- /* do the indenting into indent */
- indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10);
- owl_text_indent(indent, body, OWL_MSGTAB);
- owl_fmtext_append_ztext(fm, indent);
- if(body[strlen(body)-1] != '\n')
- owl_fmtext_append_ztext(fm, "\n");
- owl_free(indent);
- }
-
- owl_free(body);
-}
-
-void owl_stylefunc_basic(owl_fmtext *fm, owl_message *m)
-{
-#ifdef HAVE_LIBZEPHYR
- char *ptr, *zsigbuff, frombuff[LINE];
- ZNotice_t *n;
-#endif
-
- if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
-#ifdef HAVE_LIBZEPHYR
- n=owl_message_get_notice(m);
-
- /* edit the from addr for printing */
- strcpy(frombuff, owl_message_get_sender(m));
- ptr=strchr(frombuff, '@');
- if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
- *ptr='\0';
- }
-
- /* set the message for printing */
- owl_fmtext_append_normal(fm, OWL_TABSTR);
-
- if (owl_message_is_ping(m)) {
- owl_fmtext_append_bold(fm, "PING");
- owl_fmtext_append_normal(fm, " from ");
- owl_fmtext_append_bold(fm, frombuff);
- owl_fmtext_append_normal(fm, "\n");
- } else if (owl_message_is_loginout(m)) {
- char *host, *tty;
-
- host=owl_message_get_attribute_value(m, "loginhost");
- tty=owl_message_get_attribute_value(m, "logintty");
-
- if (owl_message_is_login(m)) {
- owl_fmtext_append_bold(fm, "LOGIN");
- } else if (owl_message_is_logout(m)) {
- owl_fmtext_append_bold(fm, "LOGOUT");
- }
- if (owl_message_is_pseudo(m)) {
- owl_fmtext_append_bold(fm, " (PSEUDO)");
- }
- owl_fmtext_append_normal(fm, " for ");
- ptr=short_zuser(owl_message_get_instance(m));
- owl_fmtext_append_bold(fm, ptr);
- owl_free(ptr);
- owl_fmtext_append_normal(fm, " at ");
- owl_fmtext_append_normal(fm, host ? host : "");
- owl_fmtext_append_normal(fm, " ");
- owl_fmtext_append_normal(fm, tty ? tty : "");
- owl_fmtext_append_normal(fm, "\n");
- } else {
- owl_fmtext_append_normal(fm, "From: ");
- if (strcasecmp(owl_message_get_class(m), "message")) {
- owl_fmtext_append_normal(fm, "Class ");
- owl_fmtext_append_normal(fm, owl_message_get_class(m));
- owl_fmtext_append_normal(fm, " / Instance ");
- owl_fmtext_append_normal(fm, owl_message_get_instance(m));
- owl_fmtext_append_normal(fm, " / ");
- }
- owl_fmtext_append_normal(fm, frombuff);
- if (strcasecmp(owl_message_get_realm(m), owl_zephyr_get_realm())) {
- owl_fmtext_append_normal(fm, " {");
- owl_fmtext_append_normal(fm, owl_message_get_realm(m));
- owl_fmtext_append_normal(fm, "} ");
- }
-
- /* stick on the zsig */
- zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30);
- owl_message_pretty_zsig(m, zsigbuff);
- owl_fmtext_append_normal(fm, " (");
- owl_fmtext_append_ztext(fm, zsigbuff);
- owl_fmtext_append_normal(fm, ")");
- owl_fmtext_append_normal(fm, "\n");
- owl_free(zsigbuff);
-
- /* then the indented message */
- owl_style_basic_format_body(fm, m);
-
- /* 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(fm, OWL_FMTEXT_ATTR_BOLD);
- }
- }
- }
-
-#endif
- } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) {
- char *zsigbuff, *foo;
- owl_fmtext_append_normal(fm, OWL_TABSTR);
- owl_fmtext_append_normal(fm, "To: ");
- foo=short_zuser(owl_message_get_recipient(m));
- owl_fmtext_append_normal(fm, foo);
- owl_free(foo);
- owl_fmtext_append_normal(fm, " (Zsig: ");
-
- zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30);
- owl_message_pretty_zsig(m, zsigbuff);
- owl_fmtext_append_ztext(fm, zsigbuff);
- owl_free(zsigbuff);
-
- owl_fmtext_append_normal(fm, ")");
- owl_fmtext_append_normal(fm, "\n");
- owl_style_basic_format_body(fm, m);
- } else if (owl_message_is_type_aim(m)) {
- if (owl_message_is_loginout(m)) {
- owl_fmtext_append_normal(fm, OWL_TABSTR);
- if (owl_message_is_login(m)) {
- owl_fmtext_append_bold(fm, "AIM LOGIN");
- } else {
- owl_fmtext_append_bold(fm, "AIM LOGOUT");
- }
- owl_fmtext_append_normal(fm, " for ");
- owl_fmtext_append_normal(fm, owl_message_get_sender(m));
- owl_fmtext_append_normal(fm, "\n");
- } else if (owl_message_is_direction_in(m)) {
- owl_fmtext_append_bold(fm, OWL_TABSTR);
- owl_fmtext_append_bold(fm, "AIM from ");
- owl_fmtext_append_bold(fm, owl_message_get_sender(m));
- owl_fmtext_append_bold(fm, "\n");
- owl_style_basic_format_body(fm, m);
- } else if (owl_message_is_direction_out(m)) {
- owl_fmtext_append_normal(fm, OWL_TABSTR);
- owl_fmtext_append_normal(fm, "AIM sent to ");
- owl_fmtext_append_normal(fm, owl_message_get_recipient(m));
- owl_fmtext_append_normal(fm, "\n");
- owl_style_basic_format_body(fm, m);
- }
- } else if (owl_message_is_type_admin(m)) {
- char *text, *header;
-
- text=owl_message_get_body(m);
- header=owl_message_get_attribute_value(m, "adminheader");
-
- owl_fmtext_append_normal(fm, OWL_TABSTR);
- owl_fmtext_append_bold(fm, "OWL ADMIN ");
- owl_fmtext_append_ztext(fm, header);
- owl_fmtext_append_normal(fm, "\n");
- owl_style_basic_format_body(fm, m);
- } else {
- char *header;
-
- header=owl_sprintf("%s from: %s to: %s",
- owl_message_get_type(m),
- owl_message_get_sender(m),
- owl_message_get_recipient(m));
-
- owl_fmtext_append_normal(fm, OWL_TABSTR);
- owl_fmtext_append_normal(fm, header);
- owl_fmtext_append_normal(fm, "\n");
- owl_style_basic_format_body(fm, m);
-
- owl_free(header);
- }
-}
Modified: branches/barnowl_unicode/owl/svkversion
===================================================================
--- branches/barnowl_unicode/owl/svkversion 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/svkversion 2008-05-03 16:52:32 UTC (rev 1033)
@@ -14,7 +14,11 @@
my $p = shift @ARGV;
$p ||= ".";
-my @lines = `svk info $p`;
+my @lines = `svk info $p 2>&1`;
+if($! || $lines[0] =~ "not a checkout path") {
+ print "exported$newline";
+ exit;
+}
my @merged = grep {/^Merged From: /} @lines;
unless (@merged) {
Modified: branches/barnowl_unicode/owl/variable.c
===================================================================
--- branches/barnowl_unicode/owl/variable.c 2008-05-02 20:17:10 UTC (rev 1032)
+++ branches/barnowl_unicode/owl/variable.c 2008-05-03 16:52:32 UTC (rev 1033)
@@ -272,7 +272,6 @@
"Styles may be created with the 'style' command.\n"
"Some built-in styles include:\n"
" default - the default owl formatting\n"
- " basic - simple formatting\n"
" oneline - one line per-message\n"
" perl - legacy perl interface\n"
"\nSEE ALSO: style, show styles, view -s <style>\n"