Changeset 93ee554


Ignore:
Timestamp:
Dec 23, 2007, 7:52:17 PM (13 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
5bc0f68
Parents:
34509d5 (diff), 78667f3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merged revisions 734-776 via svnmerge from 
file:///afs/sipb.mit.edu/project/barnowl/src/svn/trunk

........
  r738 | nelhage | 2007-07-07 17:42:45 -0400 (Sat, 07 Jul 2007) | 3 lines
  
  Make the built-in regression tests output TAP and add a perl wrapper
  to call it.
........
  r739 | nelhage | 2007-07-07 17:43:22 -0400 (Sat, 07 Jul 2007) | 2 lines
  
  Forgot these in the last commit; Make all the tests output TAP
........
  r740 | nelhage | 2007-07-07 19:46:16 -0400 (Sat, 07 Jul 2007) | 2 lines
  
  Clean up an unused var warning.
........
  r741 | nelhage | 2007-07-08 15:37:43 -0400 (Sun, 08 Jul 2007) | 2 lines
  
  Adding a -s switch to change the location of the config dir (~/.owl)
........
  r742 | nelhage | 2007-07-08 15:39:57 -0400 (Sun, 08 Jul 2007) | 2 lines
  
  I don't understand why this didn't commit last time. I blame psvn.
........
  r743 | nelhage | 2007-07-11 22:37:16 -0400 (Wed, 11 Jul 2007) | 3 lines
  
  Don't allow you to go off the end of an empty message list. [fixes:
  #9]
........
  r744 | nelhage | 2007-07-30 18:47:39 -0400 (Mon, 30 Jul 2007) | 2 lines
  
  Fix sending to -c message -i personal
........
  r745 | chmrr | 2007-07-30 20:21:18 -0400 (Mon, 30 Jul 2007) | 3 lines
  
   r20981@zoq-fot-pik:  chmrr | 2007-07-30 20:20:44 -0400
    * message length 0 means no fields
........
  r746 | nelhage | 2007-07-30 20:25:59 -0400 (Mon, 30 Jul 2007) | 4 lines
  
  * zero-len message means no fields
  * Actually use owl_zephyr_get_zsig to get the zsig, which handles 0-
    and 1- field zephyrs correctly.
........
  r747 | nelhage | 2007-07-30 20:29:36 -0400 (Mon, 30 Jul 2007) | 2 lines
  
  Making that last patch actually compile. Bad me.
........
  r748 | nelhage | 2007-08-01 01:42:53 -0400 (Wed, 01 Aug 2007) | 3 lines
  
  owl_message_get_text needs to make sure there's text to return before
  returning it. fixes: #15
........
  r749 | nelhage | 2007-08-01 01:52:08 -0400 (Wed, 01 Aug 2007) | 5 lines
  
  zephyr smartnarrow now uses the ``personal'' filter to decide whether
  to narrow to user or not, and the zephyr-user filter now checks for
  `filter personal' instead of <message,personal,*>.
  closes #2
........
  r750 | nelhage | 2007-08-01 02:27:30 -0400 (Wed, 01 Aug 2007) | 5 lines
  
  Changing the default personal filter to <message,personal,*> for
  zephyr.
  
  refs 2
........
  r751 | nelhage | 2007-08-01 22:58:31 -0400 (Wed, 01 Aug 2007) | 2 lines
  
  Display opcodes with the default style
........
  r752 | nelhage | 2007-08-08 18:01:51 -0400 (Wed, 08 Aug 2007) | 2 lines
  
  Applying ctl's variable shuffling patch for better ANSI C-ness. closes #18
........
  r753 | nelhage | 2007-08-11 01:04:07 -0400 (Sat, 11 Aug 2007) | 3 lines
  
  Implement :punt and :unpunt to punt arbitrary filters, rather than
  just z-triplets. closes #6
........
  r754 | nelhage | 2007-08-11 01:18:37 -0400 (Sat, 11 Aug 2007) | 2 lines
  
  Show non-personal pings like stock owl does. closes #12
........
  r756 | asedeno | 2007-08-17 12:48:37 -0400 (Fri, 17 Aug 2007) | 8 lines
  
  Apply patch from:
  http://rt.cpan.org/Public/Bug/Display.html?id=17484
  
  Fixing problems with jabber servers keeping the same stream id when negotiating TLS.
  
  Thanks to ghudson for tracking this down.
........
  r757 | nelhage | 2007-08-17 17:26:44 -0400 (Fri, 17 Aug 2007) | 4 lines
  
  When we're narrowing to an instance, properly include
  un-instances. This fixes narrowing to any instance that starts with
  ``un-''
........
  r758 | nelhage | 2007-08-27 19:17:20 -0400 (Mon, 27 Aug 2007) | 2 lines
  
  Don't read before the start of the string for an instance
........
  r759 | nelhage | 2007-09-07 00:13:45 -0400 (Fri, 07 Sep 2007) | 3 lines
  
  Adding an explicit -f - to the tar commands for FreeBSD compatibility
  (reported by ecprice)
........
  r760 | ecprice | 2007-09-08 17:33:34 -0400 (Sat, 08 Sep 2007) | 3 lines
  
  Fixes for FreeBSD.
........
  r761 | nelhage | 2007-09-10 20:00:45 -0400 (Mon, 10 Sep 2007) | 3 lines
  
  Use "" instead of `undef' as a default for messages with no reply
  command to hopefully squelch perl warnings.
........
  r762 | nelhage | 2007-09-12 21:37:41 -0400 (Wed, 12 Sep 2007) | 2 lines
  
  Do ~-expansion in :loadsubs. closes #26
........
  r763 | nelhage | 2007-09-12 21:54:51 -0400 (Wed, 12 Sep 2007) | 2 lines
  
  Validate JIDs passed to jmuc join. closes #25
........
  r764 | nelhage | 2007-09-12 22:46:17 -0400 (Wed, 12 Sep 2007) | 2 lines
  
  Show full JIDs for users in non-anonymous JIDs in :jmuc presence. closes #24
........
  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
........
Files:
1 added
31 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    r702aee7 r2bdfed9  
    4545#AUTOGEN=$(GEN_C)
    4646
    47 HEADERS=$(GEN_H) owl.h config.h
     47HEADERS=$(GEN_H) owl.h config.h test.h
    4848
    4949%.o: %.c $(HEADERS)
     
    127127        ${INSTALL} -d ${DESTDIR}${datadir}/lib
    128128        ${INSTALL} -d ${DESTDIR}${datadir}/modules
    129         tar -C perl/lib --exclude .svn -c . | tar -C ${DESTDIR}${datadir}/lib -x
     129        tar -C perl/lib --exclude .svn -cf - . | tar -C ${DESTDIR}${datadir}/lib -xf -
    130130        for i in $(PERL_MODULES); do \
    131131                ${INSTALL_DATA} perl/modules/$$i/$$i.par ${DESTDIR}${datadir}/modules/$$i.par; \
  • commands.c

    r987ff51 rfa4f9c3  
    132132  OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE,
    133133              "send an AIM message",
    134               "aimzwrite <user>",
    135               "Send an aim message to a user.\n"),
     134              "aimwrite <user> [-m <message...>]",
     135              "Send an aim message to a user.\n\n"
     136              "The following options are available:\n\n"
     137              "-m    Specifies a message to send without prompting.\n"),
    136138
    137139  OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE,
     
    280282              "suppressed to be received again.\n\n"
    281283              "SEE ALSO:  zpunt, show zpunts\n"),
     284
     285  OWLCMD_ARGS("punt", owl_command_punt, OWL_CTX_ANY,
     286              "suppress an arbitrary filter",
     287              "punt <filter-name>",
     288              "punt <filter-text (multiple words)>\n"
     289              "The punt command will supress message to the specified\n"
     290              "filter\n\n"
     291              "SEE ALSO:  unpunt, zpunt, show zpunts\n"),
     292
     293  OWLCMD_ARGS("unpunt", owl_command_unpunt, OWL_CTX_ANY,
     294              "remove an entry from the punt list",
     295              "zpunt <filter-name>\n"
     296              "zpunt <filter-text>\n"
     297              "zpunt <number>\n",
     298              "The unpunt command will remove an entry from the puntlist.\n"
     299              "The first two forms correspond to the first two forms of the :punt\n"
     300              "command. The latter allows you to remove a specific entry from the\n"
     301              "the list (see :show zpunts)\n\n"
     302              "SEE ALSO:  punt, zpunt, zunpunt, show zpunts\n"),
    282303
    283304  OWLCMD_VOID("info", owl_command_info, OWL_CTX_INTERACTIVE,
     
    18671888char *owl_command_aimwrite(int argc, char **argv, char *buff)
    18681889{
    1869   char *newbuff;
    1870   int i, j;
     1890  char *newbuff, *recip, **myargv;
     1891  int i, j, myargc;
     1892  owl_message *m;
    18711893 
    18721894  if (!owl_global_is_aimloggedin(&g)) {
     
    18781900    owl_function_makemsg("Not enough arguments to the aimwrite command.");
    18791901    return(NULL);
     1902  }
     1903
     1904  myargv=argv;
     1905  if (argc<0) {
     1906    owl_function_error("Unbalanced quotes in aimwrite");
     1907    return(NULL);
     1908  }
     1909  myargc=argc;
     1910  if (myargc && *(myargv[0])!='-') {
     1911    myargc--;
     1912    myargv++;
     1913  }
     1914  while (myargc) {
     1915    if (!strcmp(myargv[0], "-m")) {
     1916      if (myargc<2) {
     1917        break;
     1918      }
     1919
     1920      /* Once we have -m, gobble up everything else on the line */
     1921      myargv++;
     1922      myargc--;
     1923      newbuff=owl_malloc(1);
     1924      newbuff=owl_strdup("");
     1925      while (myargc) {
     1926        newbuff=realloc(newbuff, strlen(newbuff)+strlen(myargv[0])+5);
     1927        strcat(newbuff, myargv[0]);
     1928        strcat(newbuff, " ");
     1929        myargc--;
     1930        myargv++;
     1931      }
     1932      newbuff[strlen(newbuff)-1]='\0'; /* remove last space */
     1933
     1934      recip=owl_malloc(strlen(argv[0])+5);
     1935      sprintf(recip, "%s ", argv[1]);
     1936      owl_aim_send_im(recip, newbuff);
     1937      m=owl_function_make_outgoing_aim(newbuff, recip);
     1938      if (m) {
     1939          owl_global_messagequeue_addmsg(&g, m);
     1940      } else {
     1941          owl_function_error("Could not create outgoing AIM message");
     1942      }
     1943
     1944      owl_free(recip);
     1945      owl_free(newbuff);
     1946      return(NULL);
     1947    } else {
     1948      /* we don't care */
     1949      myargv++;
     1950      myargc--;
     1951    }
    18801952  }
    18811953
     
    21422214    char *filename;
    21432215   
    2144     filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
     2216    filename=owl_global_get_startupfile(&g);
    21452217    owl_function_popless_file(filename);
    2146     owl_free(filename);
    21472218  } else if (!strcmp(argv[1], "errors")) {
    21482219    owl_function_showerrs();
     
    22942365  return NULL;
    22952366}
    2296 
    22972367
    22982368void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type)
     
    23452415}
    23462416
     2417char *owl_command_punt(int argc, char **argv, char *buff)
     2418{
     2419  owl_command_punt_unpunt(argc, argv, buff, 0);
     2420  return NULL;
     2421}
     2422
     2423char *owl_command_unpunt(int argc, char **argv, char *buff)
     2424{
     2425  owl_command_punt_unpunt(argc, argv, buff, 1);
     2426  return NULL;
     2427}
     2428
     2429void owl_command_punt_unpunt(int argc, char ** argv, char *buff, int unpunt)
     2430{
     2431  owl_list * fl;
     2432  owl_filter * f;
     2433  char * text;
     2434  int i;
     2435
     2436  fl = owl_global_get_puntlist(&g);
     2437  if(argc == 1) {
     2438    owl_function_show_zpunts();
     2439  }
     2440
     2441  if(argc == 2) {
     2442    /* Handle :unpunt <number> */
     2443    if(unpunt && (i=atoi(argv[1])) !=0) {
     2444      i--;      /* Accept 1-based indexing */
     2445      if(i < owl_list_get_size(fl)) {
     2446        f = (owl_filter*)owl_list_get_element(fl, i);
     2447        owl_list_remove_element(fl, i);
     2448        owl_filter_free(f);
     2449        return;
     2450      } else {
     2451        owl_function_error("No such filter number: %d", i+1);
     2452      }
     2453    }
     2454    text = owl_sprintf("filter %s", argv[1]);
     2455  } else {
     2456    text = skiptokens(buff, 1);
     2457  }
     2458
     2459  owl_function_punt(text, unpunt);
     2460}
     2461
     2462
    23472463char *owl_command_getview(int argc, char **argv, char *buff)
    23482464{
     
    24692585  owl_message *m;
    24702586  owl_view *v;
     2587  char *cmd;
    24712588
    24722589  v = owl_global_get_current_view(&g);
     
    24872604    return;
    24882605  }
    2489   char * cmd = owl_message_get_attribute_value(m, "yescommand");
     2606  cmd = owl_message_get_attribute_value(m, "yescommand");
    24902607  if(!cmd) {
    24912608    owl_function_error("No yes command!");
     
    25022619  owl_message *m;
    25032620  owl_view *v;
     2621  char *cmd;
    25042622
    25052623  v = owl_global_get_current_view(&g);
     
    25202638    return;
    25212639  }
    2522   char * cmd = owl_message_get_attribute_value(m, "nocommand");
     2640  cmd = owl_message_get_attribute_value(m, "nocommand");
    25232641  if(!cmd) {
    25242642    owl_function_error("No no command!");
  • configure.in

    r34509d5 r93ee554  
    3333
    3434dnl Check for kerberosIV include
    35 AC_MSG_CHECKING(for /usr/include/kerberosIV)
     35AC_MSG_CHECKING(for kerberosIV)
    3636if test -d /usr/include/kerberosIV; then
    3737        CFLAGS=${CFLAGS}\ -I/usr/include/kerberosIV
    3838        CPPFLAGS=${CPPFLAGS}\ -I/usr/include/kerberosIV
     39        AC_MSG_RESULT(yes)
     40elif test -d /usr/local/include/kerberosIV; then
     41        CFLAGS=${CFLAGS}\ -I/usr/local/include/kerberosIV
     42        CPPFLAGS=${CPPFLAGS}\ -I/usr/local/include/kerberosIV
    3943        AC_MSG_RESULT(yes)
    4044else
     
    102106fi
    103107
    104 dnl Add LDFLAGS for embeded perl
     108dnl Add LDFLAGS for embedded perl
    105109FOO=`perl -MExtUtils::Embed -e ldopts`
    106110echo Adding perl LDFLAGS ${FOO}
     
    117121
    118122dnl Checks for typedefs, structures, and compiler characteristics.
    119 AC_CHECK_FILE(/usr/share/terminfo, AC_DEFINE(TERMINFO, "/usr/share/terminfo", [Have terminfo]),
    120   AC_CHECK_FILE(/usr/share/lib/terminfo, AC_DEFINE(TERMINFO, "/usr/share/lib/terminfo", [Have terminfo]),
    121   AC_MSG_ERROR(No terminfo found for this system)))
    122123
    123124AC_SUBST(XSUBPPDIR)
  • debian/control

    r8d1a33f rc7172b3  
    33Priority: optional
    44Maintainer: Sam Hartman <hartmans@debian.org>
    5 Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev
     5Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev, zip
    66Standards-Version: 3.5.2
    77
     
    1212Description: A curses-based tty Jabber and Zephyr client.
    1313 An alternative standalone (doesn't use zwgc) Zephyr (instant
    14  messaging) client.  Also supports Jabber.
     14 messaging) client.  Also supports AIM and Jabber.
    1515 Much of the functionality is written in Perl, which is supported as
    1616 an extension language.
    1717 .
    18  ktools software -- The 'k' is for Quality!
     18 This is a fork of ktools software's owl Zephyr/AIM client
  • dict.c

    r0138478 r1cf3f8d3  
    152152  char *av="aval", *bv="bval", *cv="cval", *dv="dval";
    153153
    154   printf("BEGIN testing owl_dict\n");
     154  printf("# BEGIN testing owl_dict\n");
    155155  FAIL_UNLESS("create", 0==owl_dict_create(&d));
    156156  FAIL_UNLESS("insert b", 0==owl_dict_insert_element(&d, "b", (void*)bv, owl_dict_noop_free));
     
    179179  owl_dict_free_all(&d, NULL);
    180180
    181   if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");
    182   printf("END testing owl_dict (%d failures)\n", numfailed);
     181  //  if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");
     182  printf("# END testing owl_dict (%d failures)\n", numfailed);
    183183  return(numfailed);
    184184}
  • filter.c

    rd791cdb rad15610  
    6363static owl_filterelement * owl_filter_parse_primitive_expression(int argc, char **argv, int *next)
    6464{
     65  owl_filterelement *fe, *op;
     66  int i = 0, skip;
     67
    6568  if(!argc) return NULL;
    6669
    67   owl_filterelement * fe = owl_malloc(sizeof(owl_filterelement));
    68   owl_filterelement *op;
    69 
     70  fe = owl_malloc(sizeof(owl_filterelement));
    7071  owl_filterelement_create(fe);
    71   int i = 0, skip;
    7272
    7373  if(!strcasecmp(argv[i], "(")) {
     
    118118{
    119119  int i = 0, skip;
    120   owl_filterelement * op1 = NULL, * op2 = NULL;
     120  owl_filterelement * op1 = NULL, * op2 = NULL, *tmp;
    121121
    122122  op1 = owl_filter_parse_primitive_expression(argc-i, argv+i, &skip);
     
    129129    op2 = owl_filter_parse_primitive_expression(argc-i-1, argv+i+1, &skip);
    130130    if(!op2) goto err;
    131     owl_filterelement * tmp = owl_malloc(sizeof(owl_filterelement));
     131    tmp = owl_malloc(sizeof(owl_filterelement));
    132132    if(!strcasecmp(argv[i], "and")) {
    133133      owl_filterelement_create_and(tmp, op1, op2);
     
    204204int owl_filter_message_match(owl_filter *f, owl_message *m)
    205205{
     206  int ret;
    206207  if(!f->root) return 0;
    207   int ret = owl_filterelement_match(f->root, m);
     208  ret = owl_filterelement_match(f->root, m);
    208209  if(f->polarity) ret = !ret;
    209210  return ret;
     
    283284  int failed = 0;
    284285  if(owl_filter_init_fromstring(&f, "test-filter", filt)) {
    285     printf("\tFAIL: parse %s\n", filt);
     286    printf("not ok can't parse %s\n", filt);
    286287    failed = 1;
    287288    goto out;
     
    289290  ok = owl_filter_message_match(&f, m);
    290291  if((shouldmatch && !ok) || (!shouldmatch && ok)) {
    291     printf("\tFAIL: match %s (got %d, expected %d)\n", filt, ok, shouldmatch);
     292    printf("not ok match %s (got %d, expected %d)\n", filt, ok, shouldmatch);
    292293    failed = 1;
    293294  }
     
    295296  owl_filter_free(&f);
    296297  if(!failed) {
    297     printf("\tok  : %s %s\n", shouldmatch ? "matches" : "doesn't match", filt);
     298    printf("ok %s %s\n", shouldmatch ? "matches" : "doesn't match", filt);
    298299  }
    299300  return failed;
     
    305306
    306307int owl_filter_regtest(void) {
    307   owl_list_create(&(g.filterlist));
    308308  int numfailed=0;
    309309  owl_message m;
     310  owl_filter f1, f2, f3, f4;
     311
     312  owl_list_create(&(g.filterlist));
    310313  owl_message_init(&m);
    311314  owl_message_set_type_zephyr(&m);
     
    345348  TEST_FILTER("true and false or false", 0);
    346349
    347   owl_filter f1, f2, f3, f4;
    348 
    349350  owl_filter_init_fromstring(&f1, "f1", "class owl");
    350351  owl_global_add_filter(&g, &f1);
  • functions.c

    r34509d5 r93ee554  
    580580
    581581  if (i>owl_view_get_size(v)-1) i=owl_view_get_size(v)-1;
     582  if (i<0) i=0;
    582583
    583584  if (!found) {
     
    848849{
    849850  int ret, ret2;
    850   char *foo;
     851  char *foo, *path;
    851852
    852853  if (file==NULL) {
    853854    ret=owl_zephyr_loadsubs(NULL, 0);
    854855  } else {
    855     ret=owl_zephyr_loadsubs(file, 1);
     856    path = owl_util_makepath(file);
     857    ret=owl_zephyr_loadsubs(path, 1);
     858    free(path);
    856859  }
    857860
     
    20572060      /* if it's a zephyr we sent, send it out the same way again */
    20582061      if (owl_message_is_direction_out(m)) {
    2059         owl_function_zwrite_setup(owl_message_get_zwriteline(m));
    2060         owl_global_set_buffercommand(&g, owl_message_get_zwriteline(m));
    2061         return;
     2062          buff = owl_strdup(owl_message_get_zwriteline(m));
     2063      } else {
     2064
     2065        /* Special case a personal reply to a webzephyr user on a class */
     2066        if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) {
     2067          class=OWL_WEBZEPHYR_CLASS;
     2068          inst=owl_message_get_sender(m);
     2069          to=OWL_WEBZEPHYR_PRINCIPAL;
     2070        } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) {
     2071          /* Special case LOGIN/LOGOUT notifications on class "webzephyr" */
     2072          class=OWL_WEBZEPHYR_CLASS;
     2073          inst=owl_message_get_instance(m);
     2074          to=OWL_WEBZEPHYR_PRINCIPAL;
     2075        } else if (owl_message_is_loginout(m)) {
     2076          /* Normal LOGIN/LOGOUT messages */
     2077          class="MESSAGE";
     2078          inst="PERSONAL";
     2079          to=owl_message_get_sender(m);
     2080        } else if (type==1) {
     2081          /* Personal reply */
     2082          class="MESSAGE";
     2083          inst="PERSONAL";
     2084          to=owl_message_get_sender(m);
     2085        } else {
     2086          /* General reply */
     2087          class=owl_message_get_class(m);
     2088          inst=owl_message_get_instance(m);
     2089          to=owl_message_get_recipient(m);
     2090          cc=owl_message_get_cc_without_recipient(m);
     2091          if (!strcmp(to, "") || !strcmp(to, "*")) {
     2092            to="";
     2093          } else if (to[0]=='@') {
     2094            /* leave it, to get the realm */
     2095          } else {
     2096            to=owl_message_get_sender(m);
     2097          }
     2098        }
     2099
     2100        /* create the command line */
     2101        if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) {
     2102          buff=owl_strdup("zcrypt");
     2103        } else {
     2104          buff = owl_strdup("zwrite");
     2105        }
     2106        if (strcasecmp(class, "message")) {
     2107          buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class));
     2108          owl_free(oldbuff);
     2109        }
     2110        if (strcasecmp(inst, "personal")) {
     2111          buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst));
     2112          owl_free(oldbuff);
     2113        }
     2114        if (*to != '\0') {
     2115          char *tmp, *oldtmp, *tmp2;
     2116          tmp=short_zuser(to);
     2117          if (cc) {
     2118            tmp = owl_util_uniq(oldtmp=tmp, cc, "-");
     2119            owl_free(oldtmp);
     2120            buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp);
     2121            owl_free(oldbuff);
     2122          } else {
     2123            if (owl_global_is_smartstrip(&g)) {
     2124              tmp2=tmp;
     2125              tmp=owl_zephyr_smartstripped_user(tmp2);
     2126              owl_free(tmp2);
     2127            }
     2128            buff = owl_sprintf("%s %s", oldbuff=buff, tmp);
     2129            owl_free(oldbuff);
     2130          }
     2131          owl_free(tmp);
     2132        }
     2133        if (cc) owl_free(cc);
    20622134      }
    2063 
    2064       /* Special case a personal reply to a webzephyr user on a class */
    2065       if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) {
    2066         class=OWL_WEBZEPHYR_CLASS;
    2067         inst=owl_message_get_sender(m);
    2068         to=OWL_WEBZEPHYR_PRINCIPAL;
    2069       } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) {
    2070         /* Special case LOGIN/LOGOUT notifications on class "webzephyr" */
    2071         class=OWL_WEBZEPHYR_CLASS;
    2072         inst=owl_message_get_instance(m);
    2073         to=OWL_WEBZEPHYR_PRINCIPAL;
    2074       } else if (owl_message_is_loginout(m)) {
    2075         /* Normal LOGIN/LOGOUT messages */
    2076         class="MESSAGE";
    2077         inst="PERSONAL";
    2078         to=owl_message_get_sender(m);
    2079       } else if (type==1) {
    2080         /* Personal reply */
    2081         class="MESSAGE";
    2082         inst="PERSONAL";
    2083         to=owl_message_get_sender(m);
    2084       } else {
    2085         /* General reply */
    2086         class=owl_message_get_class(m);
    2087         inst=owl_message_get_instance(m);
    2088         to=owl_message_get_recipient(m);
    2089         cc=owl_message_get_cc_without_recipient(m);
    2090         if (!strcmp(to, "") || !strcmp(to, "*")) {
    2091           to="";
    2092         } else if (to[0]=='@') {
    2093           /* leave it, to get the realm */
    2094         } else {
    2095           to=owl_message_get_sender(m);
    2096         }
    2097       }
    2098        
    2099       /* create the command line */
    2100       if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) {
    2101         buff=owl_strdup("zcrypt");
    2102       } else {
    2103         buff = owl_strdup("zwrite");
    2104       }
    2105       if (strcasecmp(class, "message")) {
    2106         buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class));
    2107         owl_free(oldbuff);
    2108       }
    2109       if (strcasecmp(inst, "personal")) {
    2110         buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst));
    2111         owl_free(oldbuff);
    2112       }
    2113       if (*to != '\0') {
    2114         char *tmp, *oldtmp, *tmp2;
    2115         tmp=short_zuser(to);
    2116         if (cc) {
    2117           tmp = owl_util_uniq(oldtmp=tmp, cc, "-");
    2118           owl_free(oldtmp);
    2119           buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp);
    2120           owl_free(oldbuff);
    2121         } else {
    2122           if (owl_global_is_smartstrip(&g)) {
    2123             tmp2=tmp;
    2124             tmp=owl_zephyr_smartstripped_user(tmp2);
    2125             owl_free(tmp2);
    2126           }
    2127           buff = owl_sprintf("%s %s", oldbuff=buff, tmp);
    2128           owl_free(oldbuff);
    2129         }
    2130         owl_free(tmp);
    2131       }
    2132       if (cc) owl_free(cc);
    21332135    } else if (owl_message_is_type_aim(m)) {
    21342136      /* aim */
     
    25572559  for (i=0; i<j; i++) {
    25582560    f=owl_list_get_element(fl, i);
     2561    snprintf(buff, sizeof(buff), "[% 2d] ", i+1);
     2562    owl_fmtext_append_normal(&fm, buff);
    25592563    owl_filter_print(f, buff);
    25602564    owl_fmtext_append_normal(&fm, buff);
     
    26222626  sprintf(argbuff, "class ^(un)*%s(\\.d)*$", tmpclass);
    26232627  if (tmpinstance) {
    2624     sprintf(argbuff, "%s and ( instance ^%s(\\.d)*$ )", argbuff, tmpinstance);
     2628    sprintf(argbuff, "%s and ( instance ^(un)*%s(\\.d)*$ )", argbuff, tmpinstance);
    26252629  }
    26262630  owl_free(tmpclass);
     
    26702674
    26712675  argbuff=owl_malloc(strlen(longuser)+1000);
    2672   sprintf(argbuff, "( type ^zephyr$ and ( class ^message$ and instance ^personal$ and ");
     2676  sprintf(argbuff, "( type ^zephyr$ and filter personal and ");
    26732677  sprintf(argbuff, "%s ( ( direction ^in$ and sender ^%s$ ) or ( direction ^out$ and recipient ^%s$ ) ) )", argbuff, longuser, longuser);
    2674   sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) ) )", argbuff, longuser);
     2678  sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) )", argbuff, longuser);
    26752679
    26762680  owl_filter_init_fromstring(f, filtname, argbuff);
     
    28002804  owl_message *m;
    28012805  char *zperson, *filtname=NULL;
     2806  char *argv[1];
    28022807 
    28032808  v=owl_global_get_current_view(&g);
     
    28312836  /* narrow personal and login messages to the sender or recip as appropriate */
    28322837  if (owl_message_is_type_zephyr(m)) {
    2833     if (owl_message_is_private(m) || owl_message_is_loginout(m)) {
     2838    if (owl_message_is_personal(m) || owl_message_is_loginout(m)) {
    28342839      if (owl_message_is_direction_in(m)) {
    28352840        zperson=short_zuser(owl_message_get_sender(m));
     
    28582863
    28592864  /* pass it off to perl */
    2860   char *argv[1];
    28612865  if(type) {
    28622866    argv[0] = "-i";
     
    30163020void owl_function_zpunt(char *class, char *inst, char *recip, int direction)
    30173021{
    3018   owl_filter *f;
    3019   owl_list *fl;
    30203022  char *buff;
    30213023  char *quoted;
    3022   int ret, i, j;
    3023 
    3024   fl=owl_global_get_puntlist(&g);
    3025 
    3026   /* first, create the filter */
    3027   f=owl_malloc(sizeof(owl_filter));
     3024
    30283025  buff=owl_malloc(strlen(class)+strlen(inst)+strlen(recip)+100);
    30293026  strcpy(buff, "class");
     
    30563053    owl_free(quoted);
    30573054  }
    3058  
    3059   owl_function_debugmsg("About to filter %s", buff);
    3060   ret=owl_filter_init_fromstring(f, "punt-filter", buff);
     3055
     3056  owl_function_punt(buff, direction);
    30613057  owl_free(buff);
     3058}
     3059
     3060void owl_function_punt(char *filter, int direction)
     3061{
     3062  owl_filter *f;
     3063  owl_list *fl;
     3064  int ret, i, j;
     3065  fl=owl_global_get_puntlist(&g);
     3066
     3067  /* first, create the filter */
     3068  f=malloc(sizeof(owl_filter));
     3069
     3070  owl_function_debugmsg("About to filter %s", filter);
     3071  ret=owl_filter_init_fromstring(f, "punt-filter", filter);
    30623072  if (ret) {
    30633073    owl_function_error("Error creating filter for zpunt");
     
    30703080  for (i=0; i<j; i++) {
    30713081    if (owl_filter_equiv(f, owl_list_get_element(fl, i))) {
     3082      owl_function_debugmsg("found an equivalent punt filter");
    30723083      /* if we're punting, then just silently bow out on this duplicate */
    30733084      if (direction==0) {
     
    30803091        owl_filter_free(owl_list_get_element(fl, i));
    30813092        owl_list_remove_element(fl, i);
     3093        owl_filter_free(f);
    30823094        return;
    30833095      }
     
    30853097  }
    30863098
     3099  owl_function_debugmsg("punting");
    30873100  /* If we're punting, add the filter to the global punt list */
    30883101  if (direction==0) {
     
    34613474  char *filename;
    34623475
    3463   filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
     3476  filename=owl_global_get_startupfile(&g);
    34643477  file=fopen(filename, "a");
    34653478  if (!file) {
    34663479    owl_function_error("Error opening startupfile for new command");
    3467     owl_free(filename);
    34683480    return;
    34693481  }
     
    34713483  /* delete earlier copies */
    34723484  owl_util_file_deleteline(filename, buff, 1);
    3473   owl_free(filename);
    34743485
    34753486  /* add this line */
     
    34833494{
    34843495  char *filename;
    3485   filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
     3496  filename=owl_global_get_startupfile(&g);
    34863497  owl_util_file_deleteline(filename, buff, 1);
    3487   owl_free(filename);
    34883498}
    34893499
     
    34973507
    34983508  if (!filename) {
    3499     filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
     3509    filename=owl_global_get_startupfile(&g);
    35003510    file=fopen(filename, "r");
    3501     owl_free(filename);
    35023511  } else {
    35033512    file=fopen(filename, "r");
  • global.c

    r34509d5 r93ee554  
    1818  struct hostent *hent;
    1919  char hostname[MAXHOSTNAMELEN];
     20  char *cd;
    2021
    2122  g->malloced=0;
     
    8687  g->homedir=owl_strdup(getenv("HOME"));
    8788
     89  g->confdir = NULL;
     90  g->startupfile = NULL;
     91  cd = owl_sprintf("%s/%s", g->homedir, OWL_CONFIG_DIR);
     92  owl_global_set_confdir(g, cd);
     93  owl_free(cd);
     94
    8895  owl_messagelist_create(&(g->msglist));
    8996  owl_mainwin_init(&(g->mw));
     
    319326}
    320327
     328char *owl_global_get_confdir(owl_global *g) {
     329  if (g->confdir) return(g->confdir);
     330  return("/");
     331}
     332
     333/*
     334 * Setting this also sets startupfile to confdir/startup
     335 */
     336void owl_global_set_confdir(owl_global *g, char *cd) {
     337  free(g->confdir);
     338  g->confdir = owl_strdup(cd);
     339  free(g->startupfile);
     340  g->startupfile = owl_sprintf("%s/startup", cd);
     341}
     342
     343char *owl_global_get_startupfile(owl_global *g) {
     344  if(g->startupfile) return(g->startupfile);
     345  return("/");
     346}
     347
    321348int owl_global_get_direction(owl_global *g) {
    322349  return(g->direction);
  • keys.c

    r51c57f8 r8938188  
    180180  BIND_CMD("M-<",         "popless:scroll-to-top", "");
    181181
     182  BIND_CMD("END",         "popless:scroll-to-bottom", "");
    182183  BIND_CMD(">",           "popless:scroll-to-bottom", "");
    183184  BIND_CMD("M->",         "popless:scroll-to-bottom", "");
  • message.c

    r34509d5 r93ee554  
    2727owl_fmtext_cache * owl_message_next_fmtext() /*noproto*/
    2828{
     29    owl_fmtext_cache * f = fmtext_cache_next;
    2930    if(fmtext_cache_next->message != NULL) {
    3031        owl_message_invalidate_format(fmtext_cache_next->message);
    3132    }
    32     owl_fmtext_cache * f = fmtext_cache_next;
    3333    fmtext_cache_next++;
    3434    if(fmtext_cache_next - fmtext_cache == OWL_FMTEXT_CACHE_SIZE)
     
    121121    p=owl_list_get_element(&(m->attributes), i);
    122122    buff=owl_sprintf("  %-15.15s: %-35.35s\n", owl_pair_get_key(p), owl_pair_get_value(p));
     123    if(buff == NULL) {
     124      buff=owl_sprintf("  %-15.15s: %-35.35s\n", owl_pair_get_key(p), "<error>");
     125      if(buff == NULL)
     126        buff=owl_strdup("   <error>\n");
     127    }
    123128    owl_fmtext_append_normal(fm, buff);
    124129    owl_free(buff);
     
    417422char *owl_message_get_text(owl_message *m)
    418423{
     424  owl_message_format(m);
    419425  return(owl_fmtext_get_text(&(m->fmtext->fmtext)));
    420426}
     
    566572
    567573int owl_message_is_answered(owl_message *m) {
     574  char *q;
    568575  if(!owl_message_is_question(m)) return 0;
    569   char * q = owl_message_get_attribute_value(m, "question");
     576  q = owl_message_get_attribute_value(m, "question");
    570577  if(!q) return 0;
    571578  return !strcmp(q, "answered");
     
    813820  struct hostent *hent;
    814821  char *ptr, *tmp, *tmp2;
     822  int len;
    815823
    816824  owl_message_init(m);
     
    841849    owl_message_set_opcode(m, "");
    842850  }
    843   owl_message_set_zsig(m, n->z_message);
     851  owl_message_set_zsig(m, owl_zephyr_get_zsig(n, &len));
    844852
    845853  if ((ptr=strchr(n->z_recipient, '@'))!=NULL) {
  • obarray.c

    rdb90f03 r535d68b  
    8080  owl_obarray_init(&oa);
    8181
    82   printf("BEGIN testing owl_obarray\n");
     82  printf("# BEGIN testing owl_obarray\n");
    8383
    8484  p = owl_obarray_insert(&oa, "test");
     
    9696  FAIL_UNLESS("Didn't find a string that isn't there", p == NULL);
    9797
    98   printf("END testing owl_obarray (%d failures)\n", numfailed);
     98  printf("# END testing owl_obarray (%d failures)\n", numfailed);
    9999
    100100  return numfailed;
  • owl.c

    r34509d5 r93ee554  
    6565owl_global g;
    6666
     67char * owl_get_datadir() {
     68    char * datadir = getenv("BARNOWL_DATA_DIR");
     69    if(datadir != NULL)
     70        return strchr(datadir, '=') + 1;
     71    return DATADIR;
     72}
     73
    6774int main(int argc, char **argv, char **env)
    6875{
     
    7481  struct sigaction sigact;
    7582  char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE];
     83  char *confdir;
    7684  owl_filter *f;
    7785  owl_style *s;
     
    8896  argvsave=argv;
    8997  configfile=NULL;
     98  confdir = NULL;
    9099  tty=NULL;
    91100  debug=0;
     
    105114    } else if (!strcmp(argv[0], "-c")) {
    106115      if (argc<2) {
    107         fprintf(stderr, "Too few arguments to -c\n");
    108         usage();
    109         exit(1);
     116        fprintf(stderr, "Too few arguments to -c\n");
     117        usage();
     118        exit(1);
    110119      }
    111120      configfile=argv[1];
     
    114123    } else if (!strcmp(argv[0], "-t")) {
    115124      if (argc<2) {
    116         fprintf(stderr, "Too few arguments to -t\n");
    117         usage();
    118         exit(1);
     125        fprintf(stderr, "Too few arguments to -t\n");
     126        usage();
     127        exit(1);
    119128      }
    120129      tty=argv[1];
     130      argv+=2;
     131      argc-=2;
     132    } else if (!strcmp(argv[0], "-s")){
     133      if (argc<2) {
     134        fprintf(stderr, "Too few arguments to -s\n");
     135        usage();
     136        exit(1);
     137      }
     138      confdir = argv[1];
    121139      argv+=2;
    122140      argc-=2;
     
    131149      argc--;
    132150    } else if (!strcmp(argv[0], "-v")) {
    133       printf("This is owl version %s\n", OWL_VERSION_STRING);
     151      printf("This is barnowl version %s\n", OWL_VERSION_STRING);
    134152      exit(0);
    135153    } else {
     
    163181  /* screen init */
    164182  if (!getenv("TERMINFO")) {
    165     sprintf(buff, "TERMINFO=%s", TERMINFO);
    166     putenv(buff);
    167     owl_function_debugmsg("startup: setting TERMINFO to %s", TERMINFO);
     183    owl_function_debugmsg("startup: Not setting TERMINFO");
    168184  } else {
    169185    owl_function_debugmsg("startup: leaving TERMINFO as %s from envrionment", getenv("TERMINFO"));
     
    195211  /* owl global init */
    196212  owl_global_init(&g);
    197     if (debug) owl_global_set_debug_on(&g);
     213  if (debug) owl_global_set_debug_on(&g);
     214  if (confdir) owl_global_set_confdir(&g, confdir);
    198215  owl_function_debugmsg("startup: first available debugging message");
    199216  owl_global_set_startupargs(&g, argcsave, argvsave);
     
    217234  /* create the owl directory, in case it does not exist */
    218235  owl_function_debugmsg("startup: creating owl directory, if not present");
    219   dir=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_CONFIG_DIR);
     236  dir=owl_global_get_confdir(&g);
    220237  mkdir(dir, S_IRWXU);
    221   owl_free(dir);
    222238
    223239  /* set the tty, either from the command line, or by figuring it out */
     
    263279  owl_function_debugmsg("startup: creating default filters");
    264280  f=owl_malloc(sizeof(owl_filter));
    265   owl_filter_init_fromstring(f, "personal", "isprivate ^true$");
     281  owl_filter_init_fromstring(f, "personal", "isprivate ^true$ and ( not type ^zephyr$"
     282                             " or ( class ^message and"
     283                             " ( instance ^personal$ or instance ^urgent$ ) ) )");
    266284  owl_list_append_element(owl_global_get_filterlist(&g), f);
    267285
     
    533551    j=wgetch(typwin);
    534552    if (j==ERR) {
    535       usleep(10);
     553      usleep(10000);
    536554    } else {
    537555      owl_global_update_lastinputtime(&g);
     
    700718void usage()
    701719{
    702   fprintf(stderr, "Owl version %s\n", OWL_VERSION_STRING);
    703   fprintf(stderr, "Usage: owl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-t <ttyname>]\n");
     720  fprintf(stderr, "Barnowl version %s\n", OWL_VERSION_STRING);
     721  fprintf(stderr, "Usage: barnowl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n");
    704722  fprintf(stderr, "  -n      don't load zephyr subscriptions\n");
    705723  fprintf(stderr, "  -d      enable debugging\n");
    706724  fprintf(stderr, "  -D      enable debugging and delete previous debug file\n");
    707   fprintf(stderr, "  -v      print the Owl version number and exit\n");
     725  fprintf(stderr, "  -v      print the Barnowl version number and exit\n");
    708726  fprintf(stderr, "  -h      print this help message\n");
    709727  fprintf(stderr, "  -c      specify an alternate config file\n");
     728  fprintf(stderr, "  -s      specify an alternate config dir (default ~/.owl)\n");
    710729  fprintf(stderr, "  -t      set the tty name\n");
    711730}
  • owl.h

    r34509d5 r93ee554  
    6464#ifdef OWL_PERL
    6565typedef void WINDOW;
     66/* logout is defined in FreeBSD. */
     67#define logout logout_
    6668#include <perl.h>
     69#undef logout
    6770#include "XSUB.h"
    6871#else
     
    560563  char *thishost;
    561564  char *homedir;
     565  char *confdir;
     566  char *startupfile;
    562567  int direction;
    563568  int zaway;
  • perl/lib/BarnOwl/ModuleLoader.pm

    r9de39410 rbe98ba5  
    66use lib (BarnOwl::get_data_dir() . "/modules/");
    77use PAR (BarnOwl::get_data_dir() . "/modules/*.par");
    8 use PAR ($ENV{HOME} . "/.owl/modules/*.par");
     8use PAR (BarnOwl::get_config_dir() . "/modules/*.par");
    99
    1010sub load_all {
    1111    my %modules;
    1212    my @modules;
     13
     14    my @moddirs = ();
     15    push @moddirs, BarnOwl::get_data_dir() . "/modules";
     16    push @moddirs, BarnOwl::get_config_dir() . "/modules";
    1317   
    14     for my $dir ( BarnOwl::get_data_dir() . "/modules",
    15                   $ENV{HOME} . "/.owl/modules" ) {
     18    for my $dir (@moddirs) {
    1619        opendir(my $dh, $dir) or next;
    1720        while(defined(my $f = readdir($dh))) {
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    rf032974 r892568b  
    581581      or die("Usage: jmuc join MUC [-p password] [-a account]");
    582582
     583    die("Error: Must specify a fully-qualified MUC name (e.g. barnowl\@conference.mit.edu)\n")
     584        unless $muc =~ /@/;
    583585    $muc = Net::Jabber::JID->new($muc);
    584586    $jid = Net::Jabber::JID->new($jid);
     
    586588
    587589    $conn->getConnectionFromJID($jid)->MUCJoin(JID      => $muc,
    588                                                   Password => $password,
    589                                                   History  => {
    590                                                       MaxChars => 0
    591                                                      });
     590                                               Password => $password,
     591                                               History  => {
     592                                                   MaxChars => 0
     593                                                  });
    592594    return;
    593595}
     
    599601    die("Usage: jmuc part MUC [-a account]") unless $muc;
    600602
    601     $conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc);
    602     queue_admin_msg("$jid has left $muc.");
     603    if($conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc)) {
     604        queue_admin_msg("$jid has left $muc.");
     605    } else {
     606        die("Error: Not joined to $muc");
     607    }
    603608}
    604609
     
    639644    my $m = shift;
    640645    my @jids = $m->Presence();
    641     return "JIDs present in " . $m->BaseJID . "\n\t"
    642       . join("\n\t", map {$_->GetResource}@jids) . "\n";
     646
     647    my $presence = "JIDs present in " . $m->BaseJID;
     648    if($m->Anonymous) {
     649        $presence .= " [anonymous MUC]";
     650    }
     651    $presence .= "\n\t";
     652    $presence .= join("\n\t", map {pp_jid($m, $_);} @jids) . "\n";
     653    return $presence;
     654}
     655
     656sub pp_jid {
     657    my ($m, $jid) = @_;
     658    my $nick = $jid->GetResource;
     659    my $full = $m->GetFullJID($jid);
     660    if($full && $full ne $nick) {
     661        return "$nick ($full)";
     662    } else {
     663        return "$nick";
     664    }
    643665}
    644666
     
    904926                              sid => $sid } );
    905927    $jhash{type} = 'admin';
     928   
    906929    BarnOwl::queue_message( BarnOwl::Message->new(%jhash) );
    907930}
     
    11341157    }
    11351158    elsif ( $jtype eq 'normal' ) {
    1136         $props{replycmd}  = undef;
     1159        $props{replycmd}  = "";
    11371160        $props{private} = 1;
    11381161    }
    11391162    elsif ( $jtype eq 'headline' ) {
    1140         $props{replycmd} = undef;
     1163        $props{replycmd} = "";
    11411164    }
    11421165    elsif ( $jtype eq 'error' ) {
    1143         $props{replycmd} = undef;
     1166        $props{replycmd} = "";
    11441167        $props{body}     = "Error "
    11451168          . $props{error_code}
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm

    r3c455b4 r892568b  
    5252Leave a MUC. The MUC is specified in the same form as L</FindMUC>
    5353
     54Returns true if successful, false if this connection was not in the
     55named MUC.
     56
    5457=cut
    5558
     
    6164    $muc->Leave();
    6265    $self->{_BARNOWL_MUCS} = [grep {$_->BaseJID ne $muc->BaseJID} $self->MUCs];
     66    return 1;
    6367}
    6468
  • perl/modules/Jabber/lib/Net/Jabber/MUC.pm

    rc2bed55 r892568b  
    6464    $self->{JID} = $args{jid};
    6565    $self->{PRESENCE} = { };
     66    $self->{ANONYMOUS} = 1;
    6667
    6768    bless($self, $class);
     
    188189        delete $self->{PRESENCE}->{$from->GetJID('full')};
    189190    } elsif($type eq 'available') {
    190         $self->{PRESENCE}->{$from->GetJID('full')} = $from;
     191        $self->{PRESENCE}->{$from->GetJID('full')} = {ROOMNICK => $from};
     192        my $x = $presence->GetX('http://jabber.org/protocol/muc#user');
     193        if($x && $x->DefinedItem()) {
     194            my $item = $x->GetItem();
     195            if($item->DefinedJID()) {
     196                $self->{PRESENCE}->{$from->GetJID('full')}->{FULLJID} = $item->GetJID();
     197                $self->{ANONYMOUS} = 0;
     198            }
     199        }
    191200    }
    192201}
     
    207216}
    208217
     218=head2 GetFullJID roomjid
     219
     220Given the roomnick of a user in the MUC, return their full NIC if the
     221MUC makes it available. If the MUC is anonymous or the user does not
     222exist in the MUC, return undef.
     223
     224=cut
     225
     226sub GetFullJID {
     227    my $self = shift;
     228    my $jid = shift;
     229
     230    $jid = $jid->GetJID('full') if UNIVERSAL::isa($jid, 'Net::Jabber::JID');
     231    my $pres = $self->{PRESENCE}->{$jid};
     232    return unless $pres;
     233    return $pres->{FULLJID};
     234}
     235
    209236=head2 Presence
    210237
     
    215242sub Presence {
    216243    my $self = shift;
    217     return values %{$self->{PRESENCE}};
     244    return map {$_->{ROOMNICK}} values %{$self->{PRESENCE}};
     245}
     246
     247=head2 Anonymous
     248
     249Returns true if the MUC is anonymous (hides participants real JIDs)
     250
     251=cut
     252
     253sub Anonymous {
     254    my $self = shift;
     255    return $self->{ANONYMOUS};
    218256}
    219257
  • perl/modules/Jabber/lib/XML/Stream.pm

    rc2bed55 r5073972  
    11611161    }
    11621162
    1163     delete($self->{SIDS}->{$currsid});
     1163    # 08.04.05(Fri) slipstream@yandex.ru for compapility with ejabberd since it reuses stream id
     1164    delete($self->{SIDS}->{$currsid}) unless ($currsid eq $sid);
    11641165
    11651166    if (exists($self->GetRoot($sid)->{version}) &&
  • perlconfig.c

    rf6b319c rad15610  
    137137  char *key,*val;
    138138  HV * hash;
     139  struct tm tm;
    139140
    140141  hash = (HV*)SvRV(msg);
     
    162163    } else if (!strcmp(key, "time")) {
    163164      m->timestr = owl_strdup(val);
    164       struct tm tm;
    165165      strptime(val, "%a %b %d %T %Y", &tm);
    166166      m->time = mktime(&tm);
     
    445445  int i, count;
    446446  char * ret = NULL;
     447  SV *rv;
    447448  STRLEN n_a;
    448449  dSP;
     
    467468    if(count != 1)
    468469      croak("Perl command %s returned more than one value!", cmd->name);
    469     SV * rv = POPs;
     470    rv = POPs;
    470471    if(SvTRUE(rv)) {
    471472      ret = owl_strdup(SvPV(rv, n_a));
     
    488489  SV *cb = (SV*)(e->cbdata);
    489490  unsigned int n_a;
     491  dSP;
     492
    490493  if(cb == NULL) {
    491494    owl_function_error("Perl callback is NULL!");
    492495  }
    493 
    494   dSP;
    495496
    496497  ENTER;
     
    516517void owl_perlconfig_mainloop()
    517518{
     519  dSP;
    518520  if (!owl_perlconfig_is_function("BarnOwl::Hooks::_mainloop_hook"))
    519521    return;
    520   dSP ;
    521522  PUSHMARK(SP) ;
    522523  call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
  • perlglue.xs

    r13a3c1db rb363d83  
    199199get_data_dir ()
    200200        CODE:
    201                 RETVAL = (char *) DATADIR;
     201                RETVAL = (char *) owl_get_datadir();
    202202        OUTPUT:
    203203        RETVAL
     204
     205char *
     206get_config_dir ()
     207        CODE:
     208                RETVAL = (char *) owl_global_get_confdir(&g);
     209        OUTPUT:
     210        RETVAL 
    204211
    205212void
  • perlwrap.pm

    r42947f1 r18fb3d4f  
    2121};
    2222
    23 use lib(get_data_dir()."/lib");
    24 use lib($ENV{HOME}."/.owl/lib");
    25 
     23use lib(get_data_dir() . "/lib");
     24use lib(get_config_dir() . "/lib");
     25
     26# perlconfig.c will set this to the value of the -c command-line
     27# switch, if present.
    2628our $configfile;
    2729
     
    520522    if ( $m->is_loginout) {
    521523        return format_login($m);
    522     } elsif($m->is_ping) {
     524    } elsif($m->is_ping && $m->is_personal) {
    523525        return ( "\@b(PING) from \@b(" . $m->pretty_sender . ")\n" );
    524526    } elsif($m->is_admin) {
     
    568570    }
    569571
     572    if($m->opcode) {
     573        $header .= " [" . $m->opcode . "]";
     574    }
    570575    $header .= "  " . time_hhmm($m);
    571576    my $sender = $m->long_sender;
  • test.h

    r0138478 r1cf3f8d3  
    33
    44#define FAIL_UNLESS(desc,pred) do { int __pred = (pred);                \
    5     printf("\t%-4s: %s", (__pred)?"ok":(numfailed++,"FAIL"), desc);     \
     5    printf("%s %s", (__pred)?"ok":(numfailed++,"not ok"), desc);     \
    66    if(!(__pred)) printf("\t(%s:%d)", __FILE__, __LINE__); printf("%c", '\n'); } while(0)
    77
  • tester.c

    re7dc035 r1cf3f8d3  
    143143
    144144
     145#define OWL_DICT_NTESTS  20
     146#define OWL_UTIL_NTESTS  9
     147#define OWL_OBARRAY_NTESTS  5
     148#define OWL_VARIABLE_NTESTS  52
     149#define OWL_FILTER_NTESTS  23
     150
    145151int main(int argc, char **argv, char **env)
    146152{
     
    149155
    150156  int numfailures=0;
    151   if (argc==2 && 0==strcmp(argv[1],"reg")) {
     157  if (argc==1 || (argc==2 && 0==strcmp(argv[1],"reg"))) {
     158    printf("1..%d\n", OWL_UTIL_NTESTS+OWL_DICT_NTESTS+OWL_VARIABLE_NTESTS
     159           +OWL_FILTER_NTESTS+OWL_OBARRAY_NTESTS);
    152160    numfailures += owl_util_regtest();
    153161    numfailures += owl_dict_regtest();
     
    156164    numfailures += owl_obarray_regtest();
    157165    if (numfailures) {
    158       fprintf(stderr, "*** WARNING: %d failures total\n", numfailures);
     166      fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
    159167    }
    160168    return(numfailures);
  • util.c

    r34509d5 r93ee554  
    759759char * owl_util_baseclass(char * class)
    760760{
    761   char *ret;
    762761  char *start, *end;
    763762
     
    769768  start = owl_strdup(start);
    770769  end = start + strlen(start) - 1;
    771   while(*end == 'd' && *(end-1) == '.') {
     770  while(end > start && *end == 'd' && *(end-1) == '.') {
    772771    end -= 2;
    773772  }
     
    789788  int numfailed=0;
    790789
    791   printf("BEGIN testing owl_util\n");
     790  printf("# BEGIN testing owl_util\n");
    792791
    793792  FAIL_UNLESS("owl_util_substitute 1",
     
    812811              !strcmp("meep foo bar", owl_util_uniq("meep foo", "bar foo meep", "-")));
    813812
    814   if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");
    815   printf("END testing owl_util (%d failures)\n", numfailed);
     813  // if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");
     814  printf("# END testing owl_util (%d failures)\n", numfailed);
    816815  return(numfailed);
    817816}
  • variable.c

    ra695a68 rad15610  
    974974  int numfailed=0;
    975975  char buf[1024];
     976  owl_variable * v;
    976977
    977978  in_regtest = 1;
    978979
    979   printf("BEGIN testing owl_variable\n");
     980  printf("# BEGIN testing owl_variable\n");
    980981  FAIL_UNLESS("setup", 0==owl_variable_dict_setup(&vd));
    981982
     
    10271028  FAIL_UNLESS("get enum 10", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));
    10281029
    1029   owl_variable * v;
    1030  
    10311030  owl_variable_dict_newvar_string(&vd, "stringvar", "", "", "testval");
    10321031  FAIL_UNLESS("get new string var", NULL != (v = owl_variable_get(&vd, "stringvar", OWL_VARIABLE_STRING)));
     
    10491048  owl_variable_dict_free(&vd);
    10501049
    1051   if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");
    1052   printf("END testing owl_variable (%d failures)\n", numfailed);
     1050  // if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");
     1051  printf("# END testing owl_variable (%d failures)\n", numfailed);
    10531052  return(numfailed);
    10541053}
  • zephyr.c

    r13a3c1db r50e29e3  
    328328  char *out;
    329329
     330  /* If there's no message here, just run along now */
     331  if (n->z_message_len == 0)
     332    return(owl_strdup(""));
     333
    330334  count=save=0;
    331335  for (i=0; i<n->z_message_len; i++) {
     
    362366{
    363367  int i, fields;
     368
     369  if(n->z_message_len == 0)
     370    return 0;
    364371
    365372  fields=1;
  • zwrite.c

    r34509d5 r93ee554  
    125125  }
    126126
     127  if (z->class == NULL &&
     128      z->inst == NULL &&
     129      owl_list_get_size(&(z->recips))==0) {
     130    owl_function_error("You must specify a recipient for zwrite");
     131    return(-1);
     132  }
     133
    127134  /* now deal with defaults */
    128135  if (z->class==NULL) z->class=owl_strdup("message");
     
    132139  /* z->message is allowed to stay NULL */
    133140 
    134   if (!strcasecmp(z->class, "message") &&
    135       !strcasecmp(z->inst, "personal") &&
    136       owl_list_get_size(&(z->recips))==0) {
    137     owl_function_error("You must specify a recipient for zwrite");
    138     return(-1);
    139   }
    140 
    141141  /* get a zsig, if not given */
    142142  if (z->zsig==NULL) {
  • aim.c

    r9854278 r34509d5  
    948948 
    949949  if (modname) {
    950     if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) {
     950    if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) {
    951951      /* perror("memrequest: malloc"); */
    952952      return -1;
     
    954954    sprintf(filename, "%s/%s.ocm", priv->aimbinarypath, modname);
    955955  } else {
    956     if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) {
     956    if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) {
    957957      /* perror("memrequest: malloc"); */
    958958      return -1;
     
    964964    if (!modname) {
    965965      /* perror("memrequest: stat"); */
    966       free(filename);
     966      owl_free(filename);
    967967      return -1;
    968968    }
     
    986986    int i;
    987987   
    988     free(filename); /* not needed */
     988    owl_free(filename); /* not needed */
    989989    owl_function_error("getaimdata memrequest: recieved invalid request for 0x%08lx bytes at 0x%08lx (file %s)\n", len, offset, modname);
    990990    i = 8;
     
    993993    }
    994994   
    995     if (!(buf = malloc(i))) {
     995    if (!(buf = owl_malloc(i))) {
    996996      return -1;
    997997    }
     
    10171017    *buflenret = i;
    10181018  } else {
    1019     if (!(buf = malloc(len))) {
    1020       free(filename);
     1019    if (!(buf = owl_malloc(len))) {
     1020      owl_free(filename);
    10211021      return -1;
    10221022    }
     
    10241024    if (!(f = fopen(filename, "r"))) {
    10251025      /* perror("memrequest: fopen"); */
    1026       free(filename);
    1027       free(buf);
     1026      owl_free(filename);
     1027      owl_free(buf);
    10281028      return -1;
    10291029    }
    10301030   
    1031     free(filename);
     1031    owl_free(filename);
    10321032   
    10331033    if (fseek(f, offset, SEEK_SET) == -1) {
    10341034      /* perror("memrequest: fseek"); */
    10351035      fclose(f);
    1036       free(buf);
     1036      owl_free(buf);
    10371037      return -1;
    10381038    }
     
    10411041      /* perror("memrequest: fread"); */
    10421042      fclose(f);
    1043       free(buf);
     1043      owl_free(buf);
    10441044      return -1;
    10451045    }
     
    10761076  if (priv->aimbinarypath && (getaimdata(sess, &buf, &buflen, offset, len, modname) == 0)) {
    10771077    aim_sendmemblock(sess, fr->conn, offset, buflen, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
    1078     free(buf);
     1078    owl_free(buf);
    10791079  } else {
    10801080    owl_function_debugmsg("faimtest_memrequest: unable to use AIM binary (\"%s/%s\"), sending defaults...\n", priv->aimbinarypath, modname);
     
    13421342      int z;
    13431343     
    1344       newbuf = malloc(i+1);
     1344      newbuf = owl_malloc(i+1);
    13451345      for (z = 0; z < i; z++)
    13461346        newbuf[z] = (z % 10)+0x30;
    13471347      newbuf[i] = '\0';
    13481348      /* aim_send_im(sess, userinfo->sn, AIM_IMFLAGS_ACK | AIM_IMFLAGS_AWAY, newbuf); */
    1349       free(newbuf);
     1349      owl_free(newbuf);
    13501350    }
    13511351  } else if (strstr(tmpstr, "seticqstatus")) {
  • cmd.c

    r6922edd r34509d5  
    7474  owl_cmd *cmd;
    7575
    76   tmpbuff=strdup(cmdbuff);
     76  tmpbuff=owl_strdup(cmdbuff);
    7777  argv=owl_parseline(tmpbuff, &argc);
    7878  if (argc < 0) {
  • text.c

    r72db971 r34509d5  
    327327  tolen  = strlen(to);
    328328  fromlen  = strlen(from);
    329   out = malloc(outlen);
     329  out = owl_malloc(outlen);
    330330
    331331  while (in[inpos]) {
  • zcrypt.c

    r9ceee9d r34509d5  
    385385
    386386/* Build a space-separated string from argv from elements between start  *
    387  * and end - 1.  malloc()'s the returned string. */
     387 * and end - 1.  owl_malloc()'s the returned string. */
    388388char *BuildArgString(char **argv, int start, int end) {
    389389  int len = 1;
     
    397397
    398398  /* Allocate memory */
    399   result = (char *)malloc(len);
     399  result = (char *)owl_malloc(len);
    400400  if (result) {
    401401    /* Build the string */
     
    482482      /* Prepare result to be returned */
    483483      char *temp = keyfile;
    484       keyfile = (char *)malloc(strlen(temp) + 1);
     484      keyfile = (char *)owl_malloc(strlen(temp) + 1);
    485485      if (keyfile) {
    486486        strcpy(keyfile, temp);
     
    611611      }
    612612      use_buffer = TRUE;
    613       if ((inptr = inbuff = (char *)malloc(MAX_RESULT)) == NULL) {
     613      if ((inptr = inbuff = (char *)owl_malloc(MAX_RESULT)) == NULL) {
    614614        printf("Memory allocation error\n");
    615615        return FALSE;
     
    639639      printf("Could not run zwrite\n");
    640640      if (freein && inbuff) {
    641         free(inbuff);
     641        owl_free(inbuff);
    642642      }
    643643      return(FALSE);
     
    685685
    686686  /* Free the input buffer, if necessary */
    687   if (freein && inbuff) free(inbuff);
     687  if (freein && inbuff) owl_free(inbuff);
    688688
    689689  return(!error);
Note: See TracChangeset for help on using the changeset viewer.