[937] in BarnOwl Developers
[D-O-H] r924 - in branches/barnowl_unicode: . owl owl/perl/modules/IRC/lib/BarnOwl/Module owl/perl/modules/Jabber/lib/BarnOwl/Module
daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:11:19 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: Sun, 3 Feb 2008 01:08:12 -0500 (EST)
Author: asedeno
Date: 2008-02-03 01:08:11 -0500 (Sun, 03 Feb 2008)
New Revision: 924
Modified:
branches/barnowl_unicode/
branches/barnowl_unicode/owl/dict.c
branches/barnowl_unicode/owl/editwin.c
branches/barnowl_unicode/owl/filter.c
branches/barnowl_unicode/owl/filterelement.c
branches/barnowl_unicode/owl/fmtext.c
branches/barnowl_unicode/owl/functions.c
branches/barnowl_unicode/owl/logging.c
branches/barnowl_unicode/owl/obarray.c
branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
branches/barnowl_unicode/owl/perlconfig.c
branches/barnowl_unicode/owl/util.c
branches/barnowl_unicode/owl/variable.c
Log:
Merged revisions 909-923 via svnmerge from
file:///afs/sipb.mit.edu/project/barnowl/src/svn/trunk
........
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.
........
Property changes on: branches/barnowl_unicode
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-908
+ /trunk:1-923
Modified: branches/barnowl_unicode/owl/dict.c
===================================================================
--- branches/barnowl_unicode/owl/dict.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/dict.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -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_unicode/owl/editwin.c
===================================================================
--- branches/barnowl_unicode/owl/editwin.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/editwin.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -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_unicode/owl/filter.c
===================================================================
--- branches/barnowl_unicode/owl/filter.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/filter.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -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_unicode/owl/filterelement.c
===================================================================
--- branches/barnowl_unicode/owl/filterelement.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/filterelement.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -123,7 +123,7 @@
return !owl_filterelement_match(fe->left, m);
}
-// Print methods
+/* Print methods */
static void owl_filterelement_print_true(owl_filterelement *fe, char *buf)
{
@@ -181,7 +181,7 @@
owl_filterelement_print(fe->left, buf);
}
-// Constructors
+/* Constructors */
void owl_filterelement_create(owl_filterelement *fe) {
fe->field = NULL;
Modified: branches/barnowl_unicode/owl/fmtext.c
===================================================================
--- branches/barnowl_unicode/owl/fmtext.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/fmtext.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -792,11 +792,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));
@@ -822,7 +822,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;
@@ -843,6 +843,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;
@@ -852,26 +856,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_unicode/owl/functions.c
===================================================================
--- branches/barnowl_unicode/owl/functions.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/functions.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -1371,7 +1371,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_unicode/owl/logging.c
===================================================================
--- branches/barnowl_unicode/owl/logging.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/logging.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -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, " ");
@@ -325,8 +325,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_unicode/owl/obarray.c
===================================================================
--- branches/barnowl_unicode/owl/obarray.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/obarray.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -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_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-02-03 06:08:11 UTC (rev 924)
@@ -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_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2008-02-03 06:08:11 UTC (rev 924)
@@ -136,6 +136,8 @@
}
}
+our $showOffline = 0;
+
sub blist_listBuddy {
my $roster = shift;
my $buddy = shift;
@@ -151,10 +153,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]";
}
@@ -197,6 +199,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_unicode/owl/perlconfig.c
===================================================================
--- branches/barnowl_unicode/owl/perlconfig.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/perlconfig.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -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_unicode/owl/util.c
===================================================================
--- branches/barnowl_unicode/owl/util.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/util.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -887,7 +887,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_unicode/owl/variable.c
===================================================================
--- branches/barnowl_unicode/owl/variable.c 2008-02-03 06:01:07 UTC (rev 923)
+++ branches/barnowl_unicode/owl/variable.c 2008-02-03 06:08:11 UTC (rev 924)
@@ -1082,7 +1082,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);
}