[946] in BarnOwl Developers
[D-O-H] r933 - in branches/barnowl_sqlite: . owl owl/perl/modules/IRC/lib/BarnOwl/Module owl/perl/modules/Jabber/lib/BarnOwl/Module
daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:11:26 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: nelhage@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Fri, 8 Feb 2008 16:09:44 -0500 (EST)
Author: nelhage
Date: 2008-02-08 16:09:43 -0500 (Fri, 08 Feb 2008)
New Revision: 933
Modified:
branches/barnowl_sqlite/
branches/barnowl_sqlite/owl/dict.c
branches/barnowl_sqlite/owl/editwin.c
branches/barnowl_sqlite/owl/filter.c
branches/barnowl_sqlite/owl/filterelement.c
branches/barnowl_sqlite/owl/fmtext.c
branches/barnowl_sqlite/owl/functions.c
branches/barnowl_sqlite/owl/logging.c
branches/barnowl_sqlite/owl/obarray.c
branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
branches/barnowl_sqlite/owl/perlconfig.c
branches/barnowl_sqlite/owl/util.c
branches/barnowl_sqlite/owl/variable.c
branches/barnowl_sqlite/owl/zephyr.c
Log:
Merged revisions 899-932 via svnmerge from
svn+ssh://lunatique.mit.edu/mit/barnowl/src/svn/trunk
........
r900 | nelhage | 2008-01-23 23:20:12 -0500 (Wed, 23 Jan 2008) | 3 lines
Fix the error messages sending to users who don't exist or aren't
signed on.
........
r910 | nelhage | 2008-01-29 20:47:41 -0500 (Tue, 29 Jan 2008) | 1 line
Fix IRC -- I forgot to add one ->conn in the last patch
........
r911 | asedeno | 2008-01-30 15:49:35 -0500 (Wed, 30 Jan 2008) | 5 lines
Jabber Buddy Lists:
* Query the jabber:show_offline_buddies once when invoking onGetBuddyList()
* Don't bold online roster entries when hiding offline ones
........
r922 | asedeno | 2008-02-03 00:49:46 -0500 (Sun, 03 Feb 2008) | 1 line
Bounds checking.
........
r923 | asedeno | 2008-02-03 01:01:07 -0500 (Sun, 03 Feb 2008) | 1 line
Portability - removing C++ style comments.
........
r926 | geofft | 2008-02-04 18:20:08 -0500 (Mon, 04 Feb 2008) | 2 lines
Add the variable 'zsender' to customize the outgoing Zephyr username.
........
r927 | asedeno | 2008-02-04 20:11:37 -0500 (Mon, 04 Feb 2008) | 1 line
bufflen should be initialized on copy.
........
Property changes on: branches/barnowl_sqlite
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-898
+ /trunk:1-932
Modified: branches/barnowl_sqlite/owl/dict.c
===================================================================
--- branches/barnowl_sqlite/owl/dict.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/dict.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -178,7 +178,7 @@
owl_list_free_all(&l, owl_free);
owl_dict_free_all(&d, NULL);
- // if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");
+ /* if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n"); */
printf("# END testing owl_dict (%d failures)\n", numfailed);
return(numfailed);
}
Modified: branches/barnowl_sqlite/owl/editwin.c
===================================================================
--- branches/barnowl_sqlite/owl/editwin.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/editwin.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -35,9 +35,9 @@
e->dotsend=0;
e->echochar='\0';
+ /* We get initialized multiple times, but we need to hold on to
+ the callbacks, so we can't NULL them here. */
/*
- // We get initialized multiple times, but we need to hold on to
- // the callbacks, so we can't NULL them here.
e->command = NULL;
e->callback = NULL;
e->cbdata = NULL;
@@ -115,7 +115,7 @@
if(!cb) {
owl_function_error("Internal error: No editwin callback!");
} else {
- // owl_function_error("text: |%s|", owl_editwin_get_text(e));
+ /* owl_function_error("text: |%s|", owl_editwin_get_text(e)); */
cb(e);
}
}
Modified: branches/barnowl_sqlite/owl/filter.c
===================================================================
--- branches/barnowl_sqlite/owl/filter.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/filter.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -340,7 +340,7 @@
TEST_FILTER("class owl and instance tester", 1);
TEST_FILTER("type ^zephyr$ and direction ^in$ and ( class ^owl$ or instance ^owl$ )", 1);
- // Order of operations and precedence
+ /* Order of operations and precedence */
TEST_FILTER("not true or false", 0);
TEST_FILTER("true or true and false", 0);
TEST_FILTER("true and true and false or true", 1);
@@ -351,10 +351,10 @@
owl_global_add_filter(&g, &f1);
TEST_FILTER("filter f1", 1);
- // Test recursion prevention
+ /* Test recursion prevention */
FAIL_UNLESS("self reference", owl_filter_init_fromstring(&f2, "test", "filter test"));
- // mutual recursion
+ /* mutual recursion */
owl_filter_init_fromstring(&f3, "f3", "filter f4");
owl_global_add_filter(&g, &f3);
FAIL_UNLESS("mutual recursion", owl_filter_init_fromstring(&f4, "f4", "filter f3"));
Modified: branches/barnowl_sqlite/owl/filterelement.c
===================================================================
--- branches/barnowl_sqlite/owl/filterelement.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/filterelement.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -115,7 +115,7 @@
return !owl_filterelement_match(fe->left, m);
}
-// Print methods
+/* Print methods */
static void owl_filterelement_print_true(owl_filterelement *fe, char *buf)
{
@@ -173,7 +173,7 @@
owl_filterelement_print(fe->left, buf);
}
-// Constructors
+/* Constructors */
void owl_filterelement_create(owl_filterelement *fe) {
fe->field = NULL;
Modified: branches/barnowl_sqlite/owl/fmtext.c
===================================================================
--- branches/barnowl_sqlite/owl/fmtext.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/fmtext.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -398,6 +398,7 @@
mallocsize=src->textlen+2;
}
dst->textlen=src->textlen;
+ dst->bufflen=mallocsize;
dst->textbuff=owl_malloc(mallocsize);
dst->fmbuff=owl_malloc(mallocsize);
dst->fgcolorbuff=owl_malloc(mallocsize * sizeof(short));
@@ -688,11 +689,11 @@
/*** Color Pair manager ***/
void owl_fmtext_init_colorpair_mgr(owl_colorpair_mgr *cpmgr)
{
- // This could be a bitarray if we wanted to save memory.
+ /* This could be a bitarray if we wanted to save memory. */
short i, j;
cpmgr->next = 8;
- // The test is <= because we allocate COLORS+1 entries.
+ /* The test is <= because we allocate COLORS+1 entries. */
cpmgr->pairs = owl_malloc((COLORS+1) * sizeof(short*));
for(i = 0; i <= COLORS; i++) {
cpmgr->pairs[i] = owl_malloc((COLORS+1) * sizeof(short));
@@ -718,7 +719,7 @@
owl_colorpair_mgr *cpmgr = owl_global_get_colorpair_mgr(&g);
cpmgr->next = 8;
- // The test is <= because we allocated COLORS+1 entries.
+ /* The test is <= because we allocated COLORS+1 entries. */
for(i = 0; i <= COLORS; i++) {
for(j = 0; j <= COLORS; j++) {
cpmgr->pairs[i][j] = -1;
@@ -739,6 +740,10 @@
owl_colorpair_mgr *cpmgr;
short pair, default_bg;
+ /* Sanity (Bounds) Check */
+ if (fg > COLORS || fg < OWL_COLOR_DEFAULT) fg = OWL_COLOR_DEFAULT;
+ if (bg > COLORS || bg < OWL_COLOR_DEFAULT) bg = OWL_COLOR_DEFAULT;
+
#ifdef HAVE_USE_DEFAULT_COLORS
if (fg == OWL_COLOR_DEFAULT) fg = -1;
default_bg = OWL_COLOR_DEFAULT;
@@ -748,26 +753,25 @@
default_bg = COLOR_BLACK;
#endif
- // looking for a pair we already set up for this draw.
+ /* looking for a pair we already set up for this draw. */
cpmgr = owl_global_get_colorpair_mgr(&g);
pair = cpmgr->pairs[fg+1][bg+1];
if (!(pair != -1 && pair < cpmgr->next)) {
-/* owl_global_set_needrefresh(&g);*/
- // If we didn't find a pair, search for a free one to assign.
+ /* If we didn't find a pair, search for a free one to assign. */
pair = (cpmgr->next < COLOR_PAIRS) ? cpmgr->next : -1;
if (pair != -1) {
- // We found a free pair, initialize it.
+ /* We found a free pair, initialize it. */
init_pair(pair, fg, bg);
cpmgr->pairs[fg+1][bg+1] = pair;
cpmgr->next++;
}
else if (bg != OWL_COLOR_DEFAULT) {
- // We still don't have a pair, drop the background color. Too bad.
+ /* We still don't have a pair, drop the background color. Too bad. */
owl_function_debugmsg("colorpairs: color shortage - dropping background color.");
pair = owl_fmtext_get_colorpair(fg, OWL_COLOR_DEFAULT);
}
else {
- // We still don't have a pair, defaults all around.
+ /* We still don't have a pair, defaults all around. */
owl_function_debugmsg("colorpairs: color shortage - dropping foreground and background color.");
pair = 0;
}
Modified: branches/barnowl_sqlite/owl/functions.c
===================================================================
--- branches/barnowl_sqlite/owl/functions.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/functions.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -1370,7 +1370,7 @@
{
redrawwin(owl_global_get_curs_recwin(&g));
redrawwin(owl_global_get_curs_sepwin(&g));
- // Work around curses segfualts with windows off the screen
+ /* Work around curses segfualts with windows off the screen */
if (g.lines >= owl_global_get_typwin_lines(&g)+2)
redrawwin(owl_global_get_curs_typwin(&g));
if (g.lines >= 2)
Modified: branches/barnowl_sqlite/owl/logging.c
===================================================================
--- branches/barnowl_sqlite/owl/logging.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/logging.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -138,7 +138,7 @@
/* Figure out what path to log to */
if (owl_message_is_type_zephyr(m)) {
- // If this has CC's, do all but the "recipient" which we'll do below
+ /* If this has CC's, do all but the "recipient" which we'll do below */
to = owl_message_get_cc_without_recipient(m);
if (to != NULL) {
temp = strtok(to, " ");
@@ -316,8 +316,9 @@
owl_log_append(m, filename);
if (personal && owl_message_is_type_zephyr(m)) {
- // We want to log to all of the CC'd people who were not us, or
- // the sender, as well.
+ /* We want to log to all of the CC'd people who were not us, or
+ * the sender, as well.
+ */
char *cc, *temp;
cc = owl_message_get_cc_without_recipient(m);
if (cc != NULL) {
Modified: branches/barnowl_sqlite/owl/obarray.c
===================================================================
--- branches/barnowl_sqlite/owl/obarray.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/obarray.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -9,9 +9,10 @@
* rare)
*/
-// Helper method: Lookup a key in the obarray. If the key exists,
-// return its index, and the interned value in *val. Otherwise, return
-// the index it should be inserted at.
+/* Helper method: Lookup a key in the obarray. If the key exists,
+ * return its index, and the interned value in *val. Otherwise, return
+ * the index it should be inserted at.
+ */
int owl_obarray_lookup(owl_obarray *oa, char * key, char ** val) /*noproto*/
{
int first, last, mid;
@@ -38,7 +39,7 @@
return mid;
}
-// Returns NULL if the string doesn't exist in the obarray
+/* Returns NULL if the string doesn't exist in the obarray */
char * owl_obarray_find(owl_obarray *oa, char * string)
{
char *v;
@@ -46,7 +47,7 @@
return v;
}
-// Inserts the string into the obarray if it doesn't exist
+/* Inserts the string into the obarray if it doesn't exist */
char * owl_obarray_insert(owl_obarray *oa, char * string)
{
char *v;
Modified: branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-02-08 21:09:43 UTC (rev 933)
@@ -161,7 +161,7 @@
SSL => $ssl
);
- if ($conn->connected) {
+ if ($conn->conn->connected) {
BarnOwl::admin_message("IRC", "Connected to $alias as $nick");
$ircnets{$alias} = $conn;
} else {
Modified: branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2008-02-08 21:09:43 UTC (rev 933)
@@ -134,6 +134,8 @@
}
}
+our $showOffline = 0;
+
sub blist_listBuddy {
my $roster = shift;
my $buddy = shift;
@@ -149,10 +151,10 @@
my %rq = $roster->resourceQuery( $buddy, $res );
$blistStr .= " [" . ( $rq{show} ? $rq{show} : 'online' ) . "]";
$blistStr .= " " . $rq{status} if $rq{status};
- $blistStr = BarnOwl::Style::boldify($blistStr);
+ $blistStr = BarnOwl::Style::boldify($blistStr) if $showOffline;
}
else {
- return '' if (BarnOwl::getvar('jabber:show_offline_buddies') eq 'off');
+ return '' unless $showOffline;
if ($jq{ask}) {
$blistStr .= " [pending]";
}
@@ -195,6 +197,7 @@
}
sub onGetBuddyList {
+ $showOffline = BarnOwl::getvar('jabber:show_offline_buddies') eq 'on';
my $blist = "";
foreach my $jid ($conn->getJIDs()) {
$blist .= getSingleBuddyList($jid);
Modified: branches/barnowl_sqlite/owl/perlconfig.c
===================================================================
--- branches/barnowl_sqlite/owl/perlconfig.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/perlconfig.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -13,7 +13,7 @@
extern XS(boot_BarnOwl);
extern XS(boot_DynaLoader);
-// extern XS(boot_DBI);
+/* extern XS(boot_DBI); */
static void owl_perl_xs_init(pTHX)
{
Modified: branches/barnowl_sqlite/owl/util.c
===================================================================
--- branches/barnowl_sqlite/owl/util.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/util.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -816,7 +816,7 @@
FAIL_UNLESS("owl_util_uniq 3",
!strcmp("meep foo bar", owl_util_uniq("meep foo", "bar foo meep", "-")));
- // if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");
+ /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */
printf("# END testing owl_util (%d failures)\n", numfailed);
return(numfailed);
}
Modified: branches/barnowl_sqlite/owl/variable.c
===================================================================
--- branches/barnowl_sqlite/owl/variable.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/variable.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -208,6 +208,13 @@
"messages. It will not be run again until the first\n"
"instance exits"),
+ OWLVAR_STRING( "zsender" /* %OwlVarStub */, "",
+ "zephyr sender name",
+ "Allows you to customize the outgoing username in\n"
+ "zephyrs. If this is unset, it will use your Kerberos\n"
+ "principal. Note that customizing the sender name will\n"
+ "cause your zephyrs to be sent unauthenticated."),
+
OWLVAR_STRING( "zsig" /* %OwlVarStub */, "",
"zephyr signature",
"If 'zsigproc' is not set, this string will be used\n"
@@ -1082,7 +1089,7 @@
owl_variable_dict_free(&vd);
- // if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");
+ /* if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n"); */
printf("# END testing owl_variable (%d failures)\n", numfailed);
return(numfailed);
}
Modified: branches/barnowl_sqlite/owl/zephyr.c
===================================================================
--- branches/barnowl_sqlite/owl/zephyr.c 2008-02-07 19:01:23 UTC (rev 932)
+++ branches/barnowl_sqlite/owl/zephyr.c 2008-02-08 21:09:43 UTC (rev 933)
@@ -500,7 +500,10 @@
notice.z_recipient=recipient;
}
notice.z_default_format="Class $class, Instance $instance:\nTo: @bold($recipient) at $time $date\nFrom: @bold{$1 <$sender>}\n\n$2";
- notice.z_sender=NULL;
+ if (*owl_global_get_zsender(&g))
+ notice.z_sender=owl_global_get_zsender(&g);
+ else
+ notice.z_sender=NULL;
if (opcode) notice.z_opcode=opcode;
notice.z_message_len=strlen(zsig)+1+strlen(message);
@@ -574,15 +577,18 @@
char buff[BUFFLEN];
tmp = short_zuser(retnotice->z_recipient);
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,
+ "Could not send message to %s: "
+ "not logged in or subscribing to class %s, instance %s.\n",
+ tmp,
retnotice->z_class,
retnotice->z_class_inst);
} else {
snprintf(buff, BUFFLEN,
- "%s messages.\n", buff);
+ "Could not send message to %s: "
+ "not logged in or subscribing to messages.\n",
+ tmp);
}
owl_function_adminmsg("", buff);
owl_log_outgoing_zephyr_error(tmp, buff);