Changeset 9e88fa7


Ignore:
Timestamp:
May 23, 2010, 7:56:29 PM (10 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
922f589
Parents:
7cc1092 (diff), f6413c3 (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:
Merge branch 'twitter'
Files:
10 added
1 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Makefile.am

    r636de2a r1fd469d4  
    1 MODULES = Jabber IRC WordWrap
     1MODULES = Jabber IRC WordWrap Twitter
    22
    33EXTRA_DIST = $(MODULES:=/Makefile.PL) $(MODULES:=/inc) $(MODULES:=/lib)
  • Makefile.am

    rae333f0 rc45e1eb  
    11ACLOCAL_AMFLAGS = -I m4
     2CFLAGS += $(EXTRA_CFLAGS)
    23
    34GIT_DESCRIPTION := $(if $(wildcard .git),$(shell git describe --match='barnowl-*' HEAD 2>/dev/null))
     
    4849     keypress.c keymap.c keybinding.c cmd.c context.c \
    4950     aim.c buddy.c buddylist.c style.c errqueue.c \
    50      zbuddylist.c popexec.c obarray.c select.c wcwidth.c \
     51     zbuddylist.c popexec.c select.c wcwidth.c \
    5152     glib_compat.c filterproc.c
    5253
  • commands.c

    re2cbbbe rd544237  
    9292              "Use 'show keymaps' to see the existing keymaps.\n"
    9393              "Key sequences may be things like M-C-t or NPAGE.\n\n"
    94               "Ex.: bindkey recv C-b command zwrite -c barnowl"
    95               "SEE ALSO: bindkey"),
     94              "Ex.: bindkey recv C-b command zwrite -c barnowl\n"
     95              "Ex.: bindkey recv m command start-command zwrite -c my-class -i \n\n"
     96              "SEE ALSO: unbindkey, start-command"),
    9697
    9798  OWLCMD_ARGS("unbindkey", owl_command_unbindkey, OWL_CTX_ANY,
     
    100101              "Removes a binding of a key sequence within a keymap.\n"
    101102              "Use 'show keymaps' to see the existing keymaps.\n"
    102               "Ex.: unbindkey recv H"
     103              "Ex.: unbindkey recv H\n\n"
    103104              "SEE ALSO: bindkey"),
    104105
    105106  OWLCMD_ARGS("zwrite", owl_command_zwrite, OWL_CTX_INTERACTIVE,
    106107              "send a zephyr",
    107               "zwrite [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [<user> ...] [-m <message...>]",
     108              "zwrite [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcode] [<user> ...] [-m <message...>]",
    108109              "Zwrite send a zephyr to the one or more users specified.\n\n"
    109110              "The following options are available:\n\n"
     
    137138  OWLCMD_ARGS("zcrypt", owl_command_zcrypt, OWL_CTX_INTERACTIVE,
    138139              "send an encrypted zephyr",
    139               "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [-m <message...>]\n",
     140              "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcode] [-m <message...>]\n",
    140141              "Behaves like zwrite but uses encryption.  Not for use with\n"
    141142              "personal messages\n"),
     
    147148              "allow editing.\n\n"
    148149              "If 'sender' is specified, reply to the sender.\n\n"
    149               "If 'all' or no args are specified, reply publically to the\n"
     150              "If 'all' or no args are specified, reply publicly to the\n"
    150151              "same class/instance for non-personal messages and to the\n"
    151152              "sender for personal messages.\n\n"
     
    265266              "zpunt <class> <instance> [recipient]\n"
    266267              "zpunt <instance>",
    267               "The zpunt command will supress message to the specified\n"
     268              "The zpunt command will suppress messages to the specified\n"
    268269              "zephyr triplet.  In the second usage messages are suppressed\n"
    269270              "for class MESSAGE and the named instance.\n\n"
     
    282283              "punt <filter-text>",
    283284              "punt <filter-text (multiple words)>\n"
    284               "The punt command will supress message to the specified\n"
     285              "The punt command will suppress messages to the specified\n"
    285286              "filter\n\n"
    286287              "SEE ALSO:  unpunt, zpunt, show zpunts\n"),
     
    585586              "name style after the -s argument.\n"
    586587              "\n"
    587               "The other usages listed above are abbreivated forms that simply set\n"
     588              "The other usages listed above are abbreviated forms that simply set\n"
    588589              "the filter of the current view. The -d option allows you to write a\n"
    589590              "filter expression that will be dynamically created by owl and then\n"
     
    593594  OWLCMD_ARGS("smartnarrow", owl_command_smartnarrow, OWL_CTX_INTERACTIVE,
    594595              "view only messages similar to the current message",
    595               "smartnarrow [-i | --instance]  [-r | --relatde]",
     596              "smartnarrow [-i | --instance]  [-r | --related]",
    596597              "If the curmsg is a personal message narrow\n"
    597598              "   to the conversation with that user.\n"
     
    613614              "   message, the filter is to that instance.\n"
    614615              "If the curmsg is a class message, the filter is that class.\n"
    615               "If the curmsg is a class message and '-i' is specied\n"
     616              "If the curmsg is a class message and '-i' is specified\n"
    616617              "    the filter is to that class and instance.\n"),
    617618
     
    633634              "SEE ALSO: filter, view, viewclass\n"),
    634635  OWLCMD_ALIAS("vu", "viewuser"),
     636  OWLCMD_ALIAS("viewperson", "viewuser"),
     637  OWLCMD_ALIAS("vp", "viewuser"),
    635638
    636639  OWLCMD_ARGS("show", owl_command_show, OWL_CTX_INTERACTIVE,
     
    671674              "for formatting messages.\n\n"
    672675              "Show variables will list the names of all variables.\n\n"
    673               "Show errors will show a list of errors ecountered by Owl.\n\n"
     676              "Show errors will show a list of errors encountered by Owl.\n\n"
    674677              "SEE ALSO: filter, view, alias, bindkey, help\n"),
    675678 
     
    740743              "set the search highlight string without searching",
    741744              "setsearch <string>",
    742               "The setsearch command highlights all occurences of its\n"
     745              "The setsearch command highlights all occurrences of its\n"
    743746          "argument and makes it the default argument for future\n"
    744747          "search commands, but does not move the cursor.  With\n"
     
    12921295  char opt;
    12931296  int instance = 0, related = 0, i;
    1294   char **tmp_argv = owl_malloc(sizeof(char *) * argc);
     1297  const char **tmp_argv = owl_malloc(sizeof(char *) * argc);
    12951298
    12961299  for (i = 0; i < argc; i++)
    1297     tmp_argv[i] = owl_strdup(argv[i]);
    1298 
    1299   static struct option options[] = {
     1300    tmp_argv[i] = argv[i];
     1301
     1302  static const struct option options[] = {
    13001303    {"instance", 0, 0, 'i'},
    13011304    {"related",  0, 0, 'r'},
    13021305    {NULL,       0, 0, 0}};
    1303   while ((opt = getopt_long(argc, tmp_argv, "ir", options, NULL)) != -1) {
     1306
     1307  optind = 0;
     1308  while ((opt = getopt_long(argc, (char **)tmp_argv, "ir", options, NULL)) != -1) {
    13041309    switch (opt) {
    13051310      case 'i':
     
    13151320  }
    13161321
    1317   for (i = 0; i < argc; i++)
    1318     owl_free(tmp_argv[i]);
    1319   owl_free(tmp_argv);
    1320 
    13211322  filtname = owl_function_smartfilter(instance, related);
    13221323
     
    13271328
    13281329done:
    1329   optind = 0; /* reset getopt */
     1330  owl_free(tmp_argv);
     1331
    13301332  return NULL;
    13311333}
     
    16061608char *owl_command_exec(int argc, const char *const *argv, const char *buff)
    16071609{
    1608   return owl_function_exec(argc, argv, buff, 0);
     1610  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_RETURN);
    16091611}
    16101612
    16111613char *owl_command_pexec(int argc, const char *const *argv, const char *buff)
    16121614{
    1613   return owl_function_exec(argc, argv, buff, 1);
     1615  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_POPUP);
    16141616}
    16151617
    16161618char *owl_command_aexec(int argc, const char *const *argv, const char *buff)
    16171619{
    1618   return owl_function_exec(argc, argv, buff, 2);
     1620  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
    16191621}
    16201622
    16211623char *owl_command_perl(int argc, const char *const *argv, const char *buff)
    16221624{
    1623   return owl_function_perl(argc, argv, buff, 0);
     1625  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_RETURN);
    16241626}
    16251627
    16261628char *owl_command_pperl(int argc, const char *const *argv, const char *buff)
    16271629{
    1628   return owl_function_perl(argc, argv, buff, 1);
     1630  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_POPUP);
    16291631}
    16301632
    16311633char *owl_command_aperl(int argc, const char *const *argv, const char *buff)
    16321634{
    1633   return owl_function_perl(argc, argv, buff, 2);
     1635  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
    16341636}
    16351637
  • configure.ac

    r07f655b r263320f  
    6464   ])])
    6565
    66 AC_CHECK_FUNCS([use_default_colors resizeterm])
     66AC_CHECK_FUNCS([use_default_colors])
     67AC_CHECK_FUNCS([resizeterm], [], [AC_MSG_ERROR([No resizeterm found])])
    6768AC_CHECK_FUNCS([des_string_to_key DES_string_to_key], [HAVE_DES_STRING_TO_KEY=1])
    6869AC_CHECK_FUNCS([des_ecb_encrypt DES_ecb_encrypt], [HAVE_DES_ECB_ENCRYPT=1])
  • doc/releasing-barnowl.txt

    r1ea0249 r5f08dbe  
    1 DOING A BARNOWL RELEASE
     1-*- mode: org *-
     2* DOING A BARNOWL RELEASE
     3  - [ ] Send mail to barnowl-dev indicating that a release is
     4        happening soon, and soliciting any improvements that
     5        developers want included in the release.
     6  - [ ] Wait a while (a week or so, or more if necessary) for any
     7        pending patches to get in.
     8  - [ ] Prepare the -rc commit
     9   - [ ] Run ./scripts/add-changelog NEW-VERSION PREV-TAG..HEAD
     10   - [ ] Edit ChangeLog to combine and filter entries
     11   - [ ] Edit configure.ac to bump the version to 1.Nrc1
     12  - [ ] Commit with message 'BarnOwl 1.Nrc1'; don't push until after
     13        builds all succeed
     14  - [ ] Run scripts/do-release with -f (so it won't complain about
     15        missing changelog), makes a tarball
     16  - [ ] Do a locker build (See DOING A LOCKER BUILD)
     17  - [ ] Update configure.ac on master to bump the version to 1.(N+1)dev
     18  - [ ] Push git git:
     19   - [ ] The RC commit
     20   - [ ] The configure.ac change on master
     21   - [ ] A release-1.N branch pointing at the RC commit
     22  - [ ] Copy tarball into /mit/barnowl/web_scripts/dist
     23  - [ ] Send mail announcing the RC to barnowl-dev@mit.edu
     24  - [ ] Wait 1-2 weeks, collect any bug reports
     25  - [ ] Fix any reported bugs on master
     26  - [ ] Cherry-pick/backport appropriate fixes from master onto
     27        release-1.N
     28  - [ ] If there have been many or large bugfixes, repeat the process
     29        for barnowl 1.Nrc2
    230
    3 [ ] Send mail to barnowl-dev indicating that a release is happening
    4     soon, and soliciting any improvements that developers want
    5     included in the release.
     31* DOING THE ACTUAL RELEASE
     32  - [ ] Update the changelog and configure.ac for barnowl 1.N
     33  - [ ] run ./scripts/do-release
     34  - [ ] Do the locker build
     35  - [ ] Push the release tag
     36  - [ ] Write up release notes
     37        (I usually use the previous release's email as a template)
     38  - [ ] Update the website
     39   - [ ] Add the line that `do-release` printed to the changelog on the home page
     40   - [ ] Add your release notes as /release-notes/1.N
     41  - [ ] Send the release notes to barnowl-users@mit.edu
    642
    7 [ ] Wait a while (a week or so, or more if necessary) for any pending
    8     patches to get in.
     43* DOING A LOCKER BUILD
     44  - [ ] Copy the tarball to build@nelhage.com
     45  - [ ] ssh to build@nelhage.com and kinit
     46  - [ ] On build@nelhage.com, run barnowl-build-all TARBALL.
     47        This script does builds for all Debathena platforms using chroots
     48        on nelhage.com, and ssh's to Athena 9 machines to do the two
     49        Athena 9 builds.
     50  - [ ] Sanity-check the builds
     51   - [ ] Do cursory testing on debathena platforms and both athena9s.
     52   - [ ] chroots on nelhage.com also useful
     53  - [ ] Update symlinks with locker-update script;
     54        - locker-update [-b] [-n] VERSION
     55        - e.g. locker-update -b -n barnowl-1.6rc1
     56   - [ ] Use -b to update the barnowl-beta name
     57   - [ ] Use -n first for dry-run
    958
    10 [ ] Prepare the -rc commit
    11 
    12  [ ] Run ./scripts/add-changelog NEW-VERSION PREV-TAG..HEAD
    13 
    14  [ ] Edit ChangeLog to combine and filter entries
    15 
    16  [ ] Edit configure.ac to bump the version to 1.Nrc1
    17 
    18 [ ] Commit with message 'BarnOwl 1.Nrc1'; don't push until after
    19     builds all succeed
    20 
    21 [ ] Run scripts/do-release with -f (so it won't complain about missing
    22     changelog), makes a tarball
    23 
    24 [ ] Make all the builds
    25  
    26  [ ] On build@nelhage.com, run barnowl-build-all TARBALL to build for
    27      everything with chroots, doesn't do athena 9 builds. Builds into
    28      locker parellel to all other versions.
    29 
    30  [ ] Do two athena9 builds: solaris and linux, usually use multics (or
    31      sun.dialup) for the solaris build, oliver for linux athena9
    32 
    33   [ ] Remember to add gnu; add barnowl
    34 
    35   [ ] eval `barnowl-perl-config` to include the perl modules in the
    36       barnowl locker
    37 
    38   [ ] Run scripts/locker-build TARBALL (barnowl-build-all loops over
    39       all of them in schroots). It overrides existing one.
    40 
    41 [ ] Sanity-check the builds
    42 
    43  [ ] Do cursory testing on debathena platforms and both athena9s.
    44 
    45  [ ] chroots on nelhage.com also useful
    46 
    47 [ ] Update symlinks with locker-update script;
    48 
    49       locker-update [-b] [-n] VERSION
    50 
    51     e.g. locker-update -b -n barnowl-1.6rc1
    52  
    53  [ ] -b for the beta
    54 
    55  [ ] -n first for dry-run
    56 
    57 [ ] Push the RC commit
    58 
    59 [ ] Copy tarball into /mit/barnowl/web_scripts/dist
    60 
    61 [ ] Send mail (rcs to barnowl-dev@, release to barnowl-users@)
    62 
    63 [ ] Make an actual release about a week after the RC
    64 
    65 
    66 LOCKER LAYOUT
    67 
    68 * builds/barnowl-VERSION contains the arch-independent files by
    69   version
    70 
    71 * arch/SYSNAME/bin/barnowl-VERSION is the actual binary
    72 
    73 * arch/SYSNAME/bin/barnowl is a symlink to ../../common/bin/barnowl
    74   (wrapper script runs barnowl.real). .../barnowl.real is a symlink to
    75   the latest version.
    76 
    77 * zcrypt is also installed with a versioned name, but currently
    78   barnowl-N will not run zcrypt-N, so we can't change that interface
    79   at all.
     59* LOCKER LAYOUT
     60  - builds/barnowl-VERSION contains the arch-independent files by
     61    version
     62  - arch/SYSNAME/bin/barnowl-VERSION is the actual binary
     63  - arch/SYSNAME/bin/barnowl is a symlink to ../../common/bin/barnowl
     64    (wrapper script runs barnowl.real). .../barnowl.real is a symlink
     65    to the latest version.
     66  - zcrypt is also installed with a versioned name, but currently
     67    barnowl-N will not run zcrypt-N, so we can't change that interface
     68    at all.
  • editwin.c

    r6e58ff2 r9d7a720  
    4747static int oe_char_width(gunichar c, int column);
    4848static int oe_region_width(owl_editwin *e, int start, int end, int width);
    49 static int oe_find_display_line(owl_editwin *e, int *x, int index);
     49static int oe_find_display_line(owl_editwin *e, int *x, int index, int *hard);
    5050static void oe_insert_char(owl_editwin *e, gunichar c);
    51 static int owl_editwin_limit_maxcols(int v, int maxv);
     51static int owl_editwin_limit_maxcols(int width, int cols);
    5252static int owl_editwin_check_dotsend(owl_editwin *e);
    5353static int owl_editwin_is_char_in(owl_editwin *e, const char *set);
     
    125125  e->topindex = 0;
    126126  e->excursions = NULL;
    127   owl_editwin_set_curswin(e, win, winlines, wincols);
    128127  e->style=style;
    129128  if ((style!=OWL_EDITWIN_STYLE_MULTILINE) &&
     
    131130    e->style=OWL_EDITWIN_STYLE_MULTILINE;
    132131  }
     132  owl_editwin_set_curswin(e, win, winlines, wincols);
    133133  e->lock=0;
    134134  e->dotsend=0;
     
    152152  e->wincols=wincols;
    153153  e->fillcol=owl_editwin_limit_maxcols(wincols-7, owl_global_get_edit_maxfillcols(&g));
    154   e->wrapcol=owl_editwin_limit_maxcols(wincols-7, owl_global_get_edit_maxwrapcols(&g));
     154  if (e->style == OWL_EDITWIN_STYLE_MULTILINE)
     155    e->wrapcol=owl_editwin_limit_maxcols(wincols-7, owl_global_get_edit_maxwrapcols(&g));
     156  else
     157    e->wrapcol = 0;
    155158}
    156159
     
    218221}
    219222
    220 static int owl_editwin_limit_maxcols(int v, int maxv)
    221 {
    222   /* maxv > 5 ? MAX(v, vax) : v */
    223   if (maxv > 5 && v > maxv) {
    224     return(maxv);
    225   } else {
    226     return(v);
    227   }
     223static int owl_editwin_limit_maxcols(int width, int cols)
     224{
     225  if (cols == 0)
     226    return width;
     227  return cols;
    228228}
    229229
     
    388388}
    389389
    390 static int oe_find_display_line(owl_editwin *e, int *x, int index)
     390static int oe_find_display_line(owl_editwin *e, int *x, int index, int *hard)
    391391{
    392392  int width = 0, cw;
     
    405405    cw = oe_char_width(c, width);
    406406
    407     if (width + cw > e->wincols) {
     407    if (width + cw > e->wincols - 1) {
    408408      if (x != NULL && *x == width)
    409409        *x = -1;
     410      if (hard != NULL) *hard = 0;
    410411      break;
    411412    }
     
    415416      if (width < e->wincols)
    416417        ++index; /* skip the newline */
     418      if (hard != NULL) *hard = 1;
    417419      break;
    418420    }
     
    423425      if (x != NULL && e->index > index)
    424426        *x = width + 1;
     427      if (hard != NULL) *hard = 1;
    425428      break;
    426429    }
     
    452455    last = e->index;
    453456    for (n = 0, i = e->index; i < index; n++)
    454       i = oe_find_display_line(e, NULL, i);
     457      i = oe_find_display_line(e, NULL, i, NULL);
    455458    count += n == 0 ? 1 : n;
    456459    if (count < goal)
     
    461464  /* if we overshot, backtrack */
    462465  for (n = 0; n < (count - goal); n++)
    463     e->topindex = oe_find_display_line(e, NULL, e->topindex);
     466    e->topindex = oe_find_display_line(e, NULL, e->topindex, NULL);
    464467
    465468  oe_restore_excursion(e, &x);
     
    483486void owl_editwin_redisplay(owl_editwin *e)
    484487{
    485   int x = -1, y = -1, t;
     488  int x = -1, y = -1, t, hard;
    486489  int line, index, lineindex, times = 0;
    487490
     
    497500      lineindex = index;
    498501      t = -1;
    499       index = oe_find_display_line(e, &t, lineindex);
     502      index = oe_find_display_line(e, &t, lineindex, &hard);
    500503      if (x == -1 && t != -1)
    501504        x = t, y = line;
     
    516519                                        oe_region_width(e, lineindex, e->lock, 0)));
    517520          } else
    518             oe_mvaddnec(e, line, 0, oe_region_width(e, line, index, 0));
     521            oe_mvaddnec(e, line, 0, oe_region_width(e, lineindex, index, 0));
    519522        }
     523        if (!hard)
     524          waddch(e->curswin, '\\');
    520525      }
    521526      line++;
     
    10961101  int sentence;
    10971102
     1103  if (e->fillcol < 0)
     1104    /* auto-fill disabled */
     1105    return;
     1106
    10981107  oe_save_excursion(e, &x);
    10991108
     
    12321241    }
    12331242
    1234     if (e->cursorx != -1 && e->cursorx + oe_char_width(c, e->cursorx) > e->wrapcol) {
     1243    if (e->wrapcol > 0 && e->cursorx != -1 &&
     1244        e->cursorx + oe_char_width(c, e->cursorx) > e->wrapcol) {
    12351245      /* XXX this is actually wrong:
    12361246       * + If the line has been been wrapped, we can be past the wrap column but
  • functions.c

    r1cfcab7 r89ab5c8  
    12641264void owl_function_full_redisplay(void)
    12651265{
    1266   redrawwin(owl_global_get_curs_recwin(&g));
    1267   redrawwin(owl_global_get_curs_sepwin(&g));
    1268   /* Work around curses segfualts with windows off the screen */
    1269   if (g.lines >= owl_global_get_typwin_lines(&g)+2)
    1270       redrawwin(owl_global_get_curs_typwin(&g));
    1271   if (g.lines >= 2)
    1272       redrawwin(owl_global_get_curs_msgwin(&g));
     1266  touchwin(owl_global_get_curs_recwin(&g));
     1267  touchwin(owl_global_get_curs_sepwin(&g));
     1268  touchwin(owl_global_get_curs_typwin(&g));
     1269  touchwin(owl_global_get_curs_msgwin(&g));
    12731270
    12741271  sepbar("");
     
    15751572{
    15761573  owl_global_set_typwin_lines(&g, newsize);
    1577   owl_function_resize();
     1574  owl_global_set_relayout_pending(&g);
    15781575}
    15791576
     
    19951992  newbuff = owl_sprintf("%s%s", buff, redirect);
    19961993
    1997   if (type == 1) {
     1994  if (type == OWL_OUTPUT_POPUP) {
    19981995    owl_popexec_new(newbuff);
    19991996  } else {
     
    20021999    pclose(p);
    20032000   
    2004     if (type==1) {
    2005       owl_function_popless_text(out);
    2006     } else if (type==0) {
     2001    if (type == OWL_OUTPUT_RETURN) {
    20072002      owl_free(newbuff);
    20082003      return out;
    2009     } else if (type==2) {
     2004    } else if (type == OWL_OUTPUT_ADMINMSG) {
    20102005      owl_function_adminmsg(buff, out);
    2011     } else {
    2012       owl_function_popless_text(out);
    20132006    }
    20142007    owl_free(out);
     
    20372030  perlout = owl_perlconfig_execute(buff);
    20382031  if (perlout) {
    2039     if (type==1) {
     2032    if (type == OWL_OUTPUT_POPUP) {
    20402033      owl_function_popless_text(perlout);
    2041     } else if (type==2) {
     2034    } else if (type == OWL_OUTPUT_ADMINMSG) {
    20422035      owl_function_adminmsg(buff, perlout);
    2043     } else if (type==0) {
     2036    } else if (type == OWL_OUTPUT_RETURN) {
    20442037      return perlout;
    2045     } else {
    2046       owl_function_popless_text(perlout);
    20472038    }
    20482039    owl_free(perlout);
     
    23342325  /* if it already exists then go with it.  This lets users override */
    23352326  if (owl_global_get_filter(&g, filtname)) {
    2336     return(filtname);
     2327    goto done;
    23372328  }
    23382329
     
    23642355
    23652356  owl_free(argbuff);
     2357done:
    23662358  owl_free(class);
    23672359  if (instance) {
     
    23922384  /* if it already exists then go with it.  This lets users override */
    23932385  if (owl_global_get_filter(&g, filtname)) {
    2394     return(owl_strdup(filtname));
     2386    return filtname;
    23952387  }
    23962388
     
    25072499
    25082500  owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 
     2501}
     2502
     2503static char *owl_function_smartfilter_cc(const owl_message *m) {
     2504  const char *ccs;
     2505  char *filtname;
     2506  char *text;
     2507  owl_filter *f;
     2508
     2509  ccs = owl_message_get_attribute_value(m, "zephyr_ccs");
     2510
     2511  filtname = owl_sprintf("conversation-%s", ccs);
     2512  owl_text_tr(filtname, ' ', '-');
     2513
     2514  if (owl_global_get_filter(&g, filtname)) {
     2515    return filtname;
     2516  }
     2517
     2518  text = owl_sprintf("type ^zephyr$ and filter personal and "
     2519                     "zephyr_ccs ^%s%s%s$",
     2520                     owl_getquoting(ccs), ccs, owl_getquoting(ccs));
     2521
     2522  f = owl_filter_new_fromstring(filtname, text);
     2523
     2524  owl_global_add_filter(&g, f);
     2525
     2526  owl_free(text);
     2527
     2528  return filtname;
    25092529}
    25102530
     
    25622582  if (owl_message_is_type_zephyr(m)) {
    25632583    if (owl_message_is_personal(m) || owl_message_is_loginout(m)) {
     2584      if (owl_message_get_attribute_value(m, "zephyr_ccs") != NULL) {
     2585        return owl_function_smartfilter_cc(m);
     2586      }
     2587
    25642588      if (owl_message_is_direction_in(m)) {
    25652589        zperson=short_zuser(owl_message_get_sender(m));
  • global.c

    r8479494 r20aced3  
    5353  g->filterlist = NULL;
    5454  owl_list_create(&(g->puntlist));
    55   owl_list_create(&(g->messagequeue));
     55  g->messagequeue = g_queue_new();
    5656  owl_dict_create(&(g->styledict));
    5757  g->curmsg_vert_offset=0;
    5858  g->resizepending=0;
     59  g->relayoutpending = 0;
    5960  g->direction=OWL_DIRECTION_DOWNWARDS;
    6061  g->zaway=0;
     
    112113  g->pseudologin_notify = 0;
    113114
    114   owl_obarray_init(&(g->obarray));
    115 
    116115  owl_message_init_fmtext_cache();
    117116  owl_list_create(&(g->io_dispatch_list));
     
    119118  g->timerlist = NULL;
    120119  g->interrupted = FALSE;
     120
     121  /* set up a pad for input */
     122  g->input_pad = newpad(1, 1);
     123  nodelay(g->input_pad, 1);
     124  keypad(g->input_pad, 1);
     125  meta(g->input_pad, 1);
    121126}
    122127
     
    137142
    138143  if (win == NULL) {
    139     owl_function_debugmsg("_owl_panel_set_window: passed NULL win (failed to allocate?)\n");
     144    owl_function_debugmsg("_owl_panel_set_window: passed NULL win (failed to allocate?)");
    140145    endwin();
    141146    exit(50);
     
    164169  }
    165170
    166   owl_function_debugmsg("_owl_global_setup_windows: about to call newwin(%i, %i, 0, 0)\n", g->recwinlines, cols);
    167 
    168171  /* create the new windows */
    169172  _owl_panel_set_window(&g->recpan, newwin(g->recwinlines, cols, 0, 0));
     
    180183  idlok(owl_global_get_curs_msgwin(g), FALSE);
    181184
    182   nodelay(owl_global_get_curs_typwin(g), 1);
    183   keypad(owl_global_get_curs_typwin(g), TRUE);
    184185  wmove(owl_global_get_curs_typwin(g), 0, 0);
    185 
    186   meta(owl_global_get_curs_typwin(g), TRUE);
    187186}
    188187
     
    394393}
    395394
     395void owl_global_set_relayout_pending(owl_global *g) {
     396  g->relayoutpending = 1;
     397}
     398
    396399const char *owl_global_get_homedir(const owl_global *g) {
    397400  if (g->homedir) return(g->homedir);
     
    467470}
    468471
     472/*
     473 * Compute the size of the terminal. Try a ioctl, fallback to other stuff on
     474 * fail.
     475 */
     476static void _owl_global_get_size(int *lines, int *cols) {
     477  struct winsize size;
     478  /* get the new size */
     479  ioctl(STDIN_FILENO, TIOCGWINSZ, &size);
     480  if (size.ws_row) {
     481    *lines = size.ws_row;
     482  } else {
     483    *lines = LINES;
     484  }
     485
     486  if (size.ws_col) {
     487    *cols = size.ws_col;
     488  } else {
     489    *cols = COLS;
     490  }
     491}
     492
    469493void owl_global_resize(owl_global *g, int x, int y) {
    470494  /* resize the screen.  If x or y is 0 use the terminal size */
    471   struct winsize size;
    472    
    473495  if (!g->resizepending) return;
    474496  g->resizepending = 0;
    475497
    476   if (!isendwin()) {
    477     endwin();
    478   }
    479 
    480   /* get the new size */
    481   ioctl(STDIN_FILENO, TIOCGWINSZ, &size);
    482   if (x==0) {
    483     if (size.ws_row) {
    484       g->lines=size.ws_row;
    485     } else {
    486       g->lines=LINES;
    487     }
    488   } else {
    489       g->lines=x;
    490   }
    491 
    492   if (y==0) {
    493     if (size.ws_col) {
    494       g->cols=size.ws_col;
    495     } else {
    496       g->cols=COLS;
    497     }
    498   } else {
    499     g->cols=y;
    500   }
    501 
    502 #ifdef HAVE_RESIZETERM
    503   resizeterm(size.ws_row, size.ws_col);
    504 #endif
     498  _owl_global_get_size(&g->lines, &g->cols);
     499  if (x != 0) {
     500    g->lines = x;
     501  }
     502  if (y != 0) {
     503    g->cols = y;
     504  }
     505
     506  resizeterm(g->lines, g->cols);
     507
     508  owl_function_debugmsg("New size is %i lines, %i cols.", g->lines, g->cols);
     509  owl_global_set_relayout_pending(g);
     510}
     511
     512void owl_global_relayout(owl_global *g) {
     513  owl_popwin *pw;
     514  owl_viewwin *vw;
     515
     516  if (!g->relayoutpending) return;
     517  g->relayoutpending = 0;
     518
     519  owl_function_debugmsg("Relayouting...");
    505520
    506521  /* re-initialize the windows */
     
    513528   * screen */
    514529  owl_function_calculate_topmsg(OWL_DIRECTION_NONE);
     530
     531  /* recreate the popwin */
     532  pw = owl_global_get_popwin(g);
     533  if (owl_popwin_is_active(pw)) {
     534    /*
     535     * This is somewhat hacky; we probably want a proper windowing layer. We
     536     * destroy the popwin and recreate it. Then the viewwin is redirected to
     537     * the new window.
     538     */
     539    vw = owl_global_get_viewwin(g);
     540    owl_popwin_close(pw);
     541    owl_popwin_up(pw);
     542    owl_viewwin_set_curswin(vw, owl_popwin_get_curswin(pw),
     543        owl_popwin_get_lines(pw), owl_popwin_get_cols(pw));
     544    owl_viewwin_redisplay(vw);
     545  }
    515546
    516547  /* refresh stuff */
     
    525556  owl_function_full_redisplay();
    526557
    527   owl_function_debugmsg("New size is %i lines, %i cols.", size.ws_row, size.ws_col);
    528558  owl_function_makemsg("");
    529559}
     
    832862void owl_global_messagequeue_addmsg(owl_global *g, owl_message *m)
    833863{
    834   owl_list_append_element(&(g->messagequeue), m);
     864  g_queue_push_tail(g->messagequeue, m);
    835865}
    836866
     
    843873  owl_message *out;
    844874
    845   if (owl_list_get_size(&(g->messagequeue))==0) return(NULL);
    846   out=owl_list_get_element(&(g->messagequeue), 0);
    847   owl_list_remove_element(&(g->messagequeue), 0);
    848   return(out);
     875  if (g_queue_is_empty(g->messagequeue))
     876    return NULL;
     877  out = g_queue_pop_head(g->messagequeue);
     878  return out;
    849879}
    850880
    851881int owl_global_messagequeue_pending(owl_global *g)
    852882{
    853   if (owl_list_get_size(&(g->messagequeue))==0) return(0);
    854   return(1);
     883  return !g_queue_is_empty(g->messagequeue);
    855884}
    856885
     
    9801009}
    9811010
    982 const char * owl_global_intern(owl_global *g, const char * string)
    983 {
    984   return owl_obarray_insert(&(g->obarray), string);
    985 }
    986 
    9871011owl_list *owl_global_get_io_dispatch_list(owl_global *g)
    9881012{
  • logging.c

    r91634ec r839697d  
    128128  char filename[MAXPATHLEN], *logpath;
    129129  char *to, *temp;
     130  GList *cc;
    130131
    131132  /* expand ~ in path names */
     
    135136  if (owl_message_is_type_zephyr(m)) {
    136137    /* If this has CC's, do all but the "recipient" which we'll do below */
    137     to = owl_message_get_cc_without_recipient(m);
    138     if (to != NULL) {
    139       temp = strtok(to, " ");
    140       while (temp != NULL) {
    141           temp = short_zuser(temp);
    142           snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp);
    143           owl_log_append(m, filename);
    144           temp = strtok(NULL, " ");
    145       }
    146       owl_free(to);
    147     }
     138    cc = owl_message_get_cc_without_recipient(m);
     139    while (cc != NULL) {
     140      temp = short_zuser(cc->data);
     141      snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp);
     142      owl_log_append(m, filename);
     143
     144      owl_free(cc->data);
     145      cc = g_list_delete_link(cc, cc);
     146    }
     147
    148148    to = short_zuser(owl_message_get_recipient(m));
    149149  } else if (owl_message_is_type_jabber(m)) {
     
    325325     * the sender, as well.
    326326     */
    327     char *cc, *temp;
     327    char *temp;
     328    GList *cc;
    328329    cc = owl_message_get_cc_without_recipient(m);
    329     if (cc != NULL) {
    330       temp = strtok(cc, " ");
    331       while (temp != NULL) {
    332         temp = short_zuser(temp);
    333         if (strcasecmp(temp, frombuff) != 0) {
    334           snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp);
    335           owl_log_append(m, filename);
    336         }
    337         temp = strtok(NULL, " ");
     330    while (cc != NULL) {
     331      temp = short_zuser(cc->data);
     332      if (strcasecmp(temp, frombuff) != 0) {
     333        snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp);
     334        owl_log_append(m, filename);
    338335      }
    339       owl_free(cc);
     336
     337      owl_free(cc->data);
     338      cc = g_list_delete_link(cc, cc);
    340339    }
    341340  }
  • message.c

    r9a7b4f2 r89ab5c8  
    6161  owl_pair *p = NULL, *pair = NULL;
    6262
     63  attrname = g_intern_string(attrname);
     64
    6365  /* look for an existing pair with this key, */
    6466  j=owl_list_get_size(&(m->attributes));
    6567  for (i=0; i<j; i++) {
    6668    p=owl_list_get_element(&(m->attributes), i);
    67     if (!strcmp(owl_pair_get_key(p), attrname)) {
     69    if (owl_pair_get_key(p) == attrname) {
    6870      owl_free(owl_pair_get_value(p));
    6971      pair = p;
     
    7476  if(pair ==  NULL) {
    7577    pair = owl_malloc(sizeof(owl_pair));
    76     owl_pair_create(pair, owl_global_intern(&g, attrname), NULL);
     78    owl_pair_create(pair, attrname, NULL);
    7779    owl_list_append_element(&(m->attributes), pair);
    7880  }
     
    8789  int i, j;
    8890  owl_pair *p;
     91  GQuark quark;
     92
     93  quark = g_quark_try_string(attrname);
     94  if (quark == 0)
     95    /* don't bother inserting into string table */
     96    return NULL;
     97  attrname = g_quark_to_string(quark);
    8998
    9099  j=owl_list_get_size(&(m->attributes));
    91100  for (i=0; i<j; i++) {
    92101    p=owl_list_get_element(&(m->attributes), i);
    93     if (!strcmp(owl_pair_get_key(p), attrname)) {
     102    if (owl_pair_get_key(p) == attrname) {
    94103      return(owl_pair_get_value(p));
    95104    }
     
    496505void owl_message_set_hostname(owl_message *m, const char *hostname)
    497506{
    498   m->hostname=owl_global_intern(&g, hostname);
     507  m->hostname = g_intern_string(hostname);
    499508}
    500509
     
    584593
    585594/* caller must free return value */
    586 char *owl_message_get_cc_without_recipient(const owl_message *m)
    587 {
    588   char *cc, *out, *end, *shortuser, *recip;
     595GList *owl_message_get_cc_without_recipient(const owl_message *m)
     596{
     597  char *cc, *shortuser, *recip;
    589598  const char *user;
     599  GList *out = NULL;
    590600
    591601  cc = owl_message_get_cc(m);
     
    594604
    595605  recip = short_zuser(owl_message_get_recipient(m));
    596   out = owl_malloc(strlen(cc) + 2);
    597   end = out;
    598606
    599607  user = strtok(cc, " ");
     
    601609    shortuser = short_zuser(user);
    602610    if (strcasecmp(shortuser, recip) != 0) {
    603       strcpy(end, user);
    604       end[strlen(user)] = ' ';
    605       end += strlen(user) + 1;
     611      out = g_list_prepend(out, owl_strdup(user));
    606612    }
    607613    owl_free(shortuser);
    608614    user = strtok(NULL, " ");
    609615  }
    610   end[0] = '\0';
    611616
    612617  owl_free(recip);
    613618  owl_free(cc);
    614 
    615   if (strlen(out) == 0) {
    616     owl_free(out);
    617     out = NULL;
    618   }
    619619
    620620  return(out);
     
    732732  owl_message_set_recipient(m, "looprecip");
    733733  owl_message_set_isprivate(m);
     734}
     735
     736void owl_message_save_ccs(owl_message *m) {
     737  GList *cc;
     738  char *tmp;
     739
     740  cc = owl_message_get_cc_without_recipient(m);
     741
     742  if (cc != NULL) {
     743    GString *recips = g_string_new("");
     744    cc = g_list_prepend(cc, short_zuser(owl_message_get_sender(m)));
     745    cc = g_list_prepend(cc, short_zuser(owl_message_get_recipient(m)));
     746    cc = g_list_sort(cc, (GCompareFunc)strcasecmp);
     747
     748    while(cc != NULL) {
     749      /* Collapse any identical entries */
     750      while (cc->next && strcasecmp(cc->data, cc->next->data) == 0) {
     751        owl_free(cc->data);
     752        cc = g_list_delete_link(cc, cc);
     753      }
     754
     755      tmp = short_zuser(cc->data);
     756      g_string_append(recips, tmp);
     757
     758      owl_free(tmp);
     759      owl_free(cc->data);
     760      cc = g_list_delete_link(cc, cc);
     761
     762      if (cc)
     763        g_string_append_c(recips, ' ');
     764    }
     765
     766    owl_message_set_attribute(m, "zephyr_ccs", recips->str);
     767    g_string_free(recips, true);
     768  }
    734769}
    735770
     
    869904    }
    870905  }
     906
     907  owl_message_save_ccs(m);
    871908}
    872909#else
     
    9631000    owl_message_set_isprivate(m);
    9641001  }
     1002
     1003  owl_message_save_ccs(m);
    9651004}
    9661005
  • owl.c

    r1cfcab7 r3aa0522  
    311311{
    312312  owl_input j;
    313   WINDOW *typwin;
    314 
    315   typwin = owl_global_get_curs_typwin(&g);
    316313
    317314  while (1) {
    318     j.ch = wgetch(typwin);
     315    j.ch = wgetch(g.input_pad);
    319316    if (j.ch == ERR) return;
    320317
     
    339336     
    340337      for (i = 1; i < bytes; i++) {
    341         int tmp =  wgetch(typwin);
     338        int tmp = wgetch(g.input_pad);
    342339        /* If what we got was not a byte, or not a continuation byte */
    343340        if (tmp > 0xff || !(tmp & 0x80 && ~tmp & 0x40)) {
     
    458455#endif /* OWL_STDERR_REDIR */
    459456
    460 void owl_zephyr_buddycheck_timer(owl_timer *t, void *data)
    461 {
    462   if (owl_global_is_pseudologins(&g)) {
    463     owl_function_debugmsg("Doing zephyr buddy check");
    464     owl_function_zephyr_buddy_check(1);
    465   }
     457static int owl_refresh_pre_select_action(owl_ps_action *a, void *data)
     458{
     459  /* if a resize has been scheduled, deal with it */
     460  owl_global_resize(&g, 0, 0);
     461  /* also handle relayouts */
     462  owl_global_relayout(&g);
     463
     464  /* update the terminal if we need to */
     465  if (owl_global_is_needrefresh(&g)) {
     466    /* these are here in case a relayout changes the windows */
     467    WINDOW *sepwin = owl_global_get_curs_sepwin(&g);
     468    WINDOW *typwin = owl_global_get_curs_typwin(&g);
     469
     470    /* push all changed windows to screen */
     471    update_panels();
     472    /* leave the cursor in the appropriate window */
     473    if (!owl_popwin_is_active(owl_global_get_popwin(&g))
     474        && owl_global_get_typwin(&g)) {
     475      owl_function_set_cursor(typwin);
     476    } else {
     477      owl_function_set_cursor(sepwin);
     478    }
     479    doupdate();
     480    owl_global_set_noneedrefresh(&g);
     481  }
     482  return 0;
    466483}
    467484
     
    469486int main(int argc, char **argv, char **env)
    470487{
    471   WINDOW *sepwin, *typwin;
    472488  int argcsave;
    473489  const char *const *argvsave;
     
    583599  owl_function_source(NULL);
    584600
    585   update_panels();
    586 
    587601  /* Set the default style */
    588602  owl_function_debugmsg("startup: setting startup and default style");
     
    605619  owl_global_push_context(&g, OWL_CTX_READCONFIG|OWL_CTX_RECV, NULL, "recv");
    606620
    607   owl_select_add_timer(180, 180, owl_zephyr_buddycheck_timer, NULL, NULL);
    608 
    609   /* If we ever deprecate the mainloop hook, remove this. */
    610   owl_select_add_timer(0, 1, owl_perlconfig_mainloop, NULL, NULL);
    611 
     621  owl_select_add_pre_select_action(owl_refresh_pre_select_action, NULL, NULL);
    612622  owl_select_add_pre_select_action(owl_process_messages, NULL, NULL);
    613623
     
    615625  /* main loop */
    616626  while (1) {
    617 
    618     /* if a resize has been scheduled, deal with it */
    619     owl_global_resize(&g, 0, 0);
    620 
    621     /* these are here in case a resize changes the windows */
    622     sepwin=owl_global_get_curs_sepwin(&g);
    623     typwin=owl_global_get_curs_typwin(&g);
    624 
    625     /* update the terminal if we need to */
    626     if (owl_global_is_needrefresh(&g)) {
    627       /* push all changed windows to screen */
    628       update_panels();
    629       /* leave the cursor in the appropriate window */
    630       if (!owl_popwin_is_active(owl_global_get_popwin(&g))
    631           && owl_global_get_typwin(&g)) {
    632         owl_function_set_cursor(typwin);
    633       } else {
    634         owl_function_set_cursor(sepwin);
    635       }
    636       doupdate();
    637       owl_global_set_noneedrefresh(&g);
    638     }
    639 
    640627    /* select on FDs we know about. */
    641628    owl_select();
  • owl.h

    r7892963 r20aced3  
    184184#define OWL_VARIABLE_BOOL       2
    185185#define OWL_VARIABLE_STRING     3
     186
     187#define OWL_OUTPUT_RETURN       0
     188#define OWL_OUTPUT_POPUP        1
     189#define OWL_OUTPUT_ADMINMSG     2
    186190
    187191#define OWL_FILTER_MAX_DEPTH    300
     
    518522} owl_colorpair_mgr;
    519523
    520 typedef struct _owl_obarray {
    521   owl_list strings;
    522 } owl_obarray;
    523 
    524524typedef struct _owl_io_dispatch {
    525525  int fd;                                     /* FD to watch for dispatch. */
     
    565565  owl_view current_view;
    566566  owl_messagelist msglist;
     567  WINDOW *input_pad;
    567568  PANEL *recpan, *seppan, *msgpan, *typpan;
    568569  int needrefresh;
    569570  int rightshift;
    570571  volatile sig_atomic_t resizepending;
     572  int relayoutpending;
    571573  int recwinlines;
    572574  char *thishost;
     
    604606  char *aim_screenname_for_filters;     /* currently logged in AIM screen name */
    605607  owl_buddylist buddylist;  /* list of logged in AIM buddies */
    606   owl_list messagequeue;    /* for queueing up aim and other messages */
     608  GQueue *messagequeue;     /* for queueing up aim and other messages */
    607609  owl_dict styledict;       /* global dictionary of available styles */
    608610  char *response;           /* response to the last question asked */
     
    617619  int pseudologin_notify;
    618620  struct termios startup_tio;
    619   owl_obarray obarray;
    620621  owl_list io_dispatch_list;
    621622  owl_list psa_list;
  • perl/lib/BarnOwl.pm

    ref4700c r675a998  
    535535    my $func = shift;
    536536    my $delta = shift;
    537     $delta = 10 unless int($delta) > 0;
     537    $delta = 10 unless defined($delta) && int($delta) > 0;
    538538    my $shift = BarnOwl::recv_getshift();
    539539    BarnOwl::recv_setshift($shift+$delta);
  • perl/lib/BarnOwl/Hooks.pm

    rb30c256 r3aa0522  
    7979our %EXPORT_TAGS = (all => [@EXPORT_OK]);
    8080
     81use BarnOwl::MainLoopCompatHook;
     82
    8183our $startup = BarnOwl::Hook->new;
    8284our $shutdown = BarnOwl::Hook->new;
    8385our $receiveMessage = BarnOwl::Hook->new;
    8486our $newMessage = BarnOwl::Hook->new;
    85 our $mainLoop = BarnOwl::Hook->new;
     87our $mainLoop = BarnOwl::MainLoopCompatHook->new;
    8688our $getBuddyList = BarnOwl::Hook->new;
    8789our $getQuickstart = BarnOwl::Hook->new;
     
    162164    }
    163165   
     166    $mainLoop->check_owlconf();
    164167    $startup->run(0);
    165168    BarnOwl::startup() if *BarnOwl::startup{CODE};
     
    186189   
    187190    BarnOwl::new_msg($m) if *BarnOwl::new_msg{CODE};
    188 }
    189 
    190 sub _mainloop_hook {
    191     $mainLoop->run;
    192     BarnOwl::mainloop_hook() if *BarnOwl::mainloop_hook{CODE};
    193191}
    194192
  • perl/lib/BarnOwl/Message/Generic.pm

    ree183be r5d1324f  
    66use base qw( BarnOwl::Message );
    77
     8sub body { "" }
     9
    810
    9111;
  • perl/lib/BarnOwl/Style/Default.pm

    r0fe69d2 r08544e0  
    3232    my $m = shift;
    3333    return $m->is_personal && $m->direction eq "in";
     34}
     35
     36sub maybe {
     37    my $x = shift;
     38    return defined($x) ? $x : "";
    3439}
    3540
     
    99104            $header .= ' / ' . $self->humanize($m->subcontext, 1);
    100105        }
    101         $header .= ' / @b{' . $m->pretty_sender . '}';
     106        $header .= ' / @b{' . maybe($m->pretty_sender) . '}';
    102107    }
    103108
  • perl/lib/BarnOwl/Timer.pm

    ree183be r8d16e58  
    2121}
    2222
     23sub stop {
     24    my $self = shift;
     25    if(defined($self->{timer})) {
     26        BarnOwl::Internal::remove_timer($self->{timer});
     27        undef $self->{timer};
     28    }
     29}
     30
    2331sub do_callback {
    2432    my $self = shift;
     
    2836sub DESTROY {
    2937    my $self = shift;
    30     if(defined($self->{timer})) {
    31         BarnOwl::Internal::remove_timer($self->{timer});
    32     }
     38    $self->stop;
    3339}
    3440
  • perl/modules/Jabber/lib/BarnOwl/Message/Jabber.pm

    rc854e74 r8278543  
    7777    } elsif ($self->jtype eq 'groupchat') {
    7878        my $room = $self->room;
    79         $filter = "jabber-room-$room";
    80         BarnOwl::command(qw[filter], $filter,
    81                          qw[type ^jabber$ and room], "^\Q$room\E\$");
     79        if ($inst) {
     80            my $subject = $self->subject;
     81            $filter = "jabber-room-$room-subject-$subject";
     82            BarnOwl::command(qw[filter], $filter,
     83                             qw[type ^jabber$ and room], "^\Q$room\E\$",
     84                             qw[and subject], "^\Q$subject\E\$");
     85        } else {
     86            $filter = "jabber-room-$room";
     87            BarnOwl::command(qw[filter], $filter,
     88                             qw[type ^jabber$ and room], "^\Q$room\E\$");
     89        }
    8290        return $filter;
    8391    } elsif ($self->login ne 'none') {
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    r8789410 raa0a0b5  
    285285        {
    286286            summary => "Send a Jabber Message",
    287             usage   => "jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]"
     287            usage   => "jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>] [-m <message>]"
    288288        }
    289289    );
     
    308308            description => "jmuc sends Jabber commands related to MUC.\n\n"
    309309              . "The following commands are available\n\n"
    310               . "join <muc>  Join a MUC.\n\n"
     310              . "join <muc>[/<nick>]\n"
     311              . "            Join a MUC (with a given nickname, or otherwise your JID).\n\n"
    311312              . "part <muc>  Part a MUC.\n"
    312313              . "            The MUC is taken from the current message if not supplied.\n\n"
     
    377378        my $cjidStr = $conn->baseJIDExists($jidStr);
    378379        if ($cjidStr) {
    379             BarnOwl::error("Already logged in as $cjidStr.");
    380             return;
     380            die("Already logged in as $cjidStr.\n");
    381381        }
    382382    }
     
    387387
    388388    if ( !$uid || !$componentname ) {
    389         BarnOwl::error("usage: $cmd JID");
    390         return;
     389        die("usage: $cmd JID\n");
    391390    }
    392391
    393392    if ( $conn->jidActive($jidStr) ) {
    394         BarnOwl::error("Already logged in as $jidStr.");
    395         return;
     393        die("Already logged in as $jidStr.\n");
    396394    } elsif ($conn->jidExists($jidStr)) {
    397395        return $conn->tryReconnect($jidStr, 1);
     
    526524sub cmd_jlist {
    527525    if ( !( scalar $conn->getJIDs() ) ) {
    528         BarnOwl::error("You are not logged in to Jabber.");
    529         return;
     526        die("You are not logged in to Jabber.\n");
    530527    }
    531528    BarnOwl::popless_ztext( onGetBuddyList() );
     
    534531sub cmd_jwrite {
    535532    if ( !$conn->connected() ) {
    536         BarnOwl::error("You are not logged in to Jabber.");
    537         return;
     533        die("You are not logged in to Jabber.\n");
    538534    }
    539535
     
    543539    my $jwrite_thread  = "";
    544540    my $jwrite_subject = "";
     541    my $jwrite_body;
    545542    my ($to, $from);
    546543    my $jwrite_type    = "chat";
     
    554551        'subject=s' => \$jwrite_subject,
    555552        'account=s' => \$from,
    556         'id=s'     =>  \$jwrite_sid,
     553        'id=s'      => \$jwrite_sid,
     554        'message=s' => \$jwrite_body,
    557555    ) or die("Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]\n");
    558556    $jwrite_type = 'groupchat' if $gc;
    559557
    560558    if ( scalar @ARGV != 1 ) {
    561         BarnOwl::error(
    562             "Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]");
    563         return;
     559        die("Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]\n");
    564560    }
    565561    else {
     
    570566
    571567    unless(scalar @candidates) {
    572         die("Unable to resolve JID $to");
     568        die("Unable to resolve JID $to\n");
    573569    }
    574570
     
    577573    unless(scalar @candidates) {
    578574        if(!$from) {
    579             die("You must specify an account with -a");
     575            die("You must specify an account with -a\n");
    580576        } else {
    581             die("Unable to resolve account $from");
     577            die("Unable to resolve account $from\n");
    582578        }
    583579    }
     
    594590        type    => $jwrite_type
    595591    };
     592
     593    if (defined($jwrite_body)) {
     594        process_owl_jwrite($jwrite_body);
     595        return;
     596    }
    596597
    597598    if(scalar @candidates > 1) {
     
    631632    my $func = $jmuc_commands{$cmd};
    632633    if ( !$func ) {
    633         BarnOwl::error("jmuc: Unknown command: $cmd");
    634         return;
     634        die("jmuc: Unknown command: $cmd\n");
    635635    }
    636636
     
    654654        }
    655655        else {
    656             BarnOwl::error('You must specify an account with -a <jid>');
     656            die("You must specify an account with -a <jid>\n");
    657657        }
    658658        return $func->( $jid, $muc, @ARGV );
     
    667667
    668668    $muc = shift @ARGV
    669       or die("Usage: jmuc join <muc> [-p <password>] [-a <account>]");
     669      or die("Usage: jmuc join <muc> [-p <password>] [-a <account>]\n");
    670670
    671671    die("Error: Must specify a fully-qualified MUC name (e.g. barnowl\@conference.mit.edu)\n")
     
    680680                                                   MaxChars => 0
    681681                                                  });
    682     $completion_jids{$muc} = 1;
     682    $completion_jids{$muc->GetJID('base')} = 1;
    683683    return;
    684684}
     
    688688
    689689    $muc = shift @args if scalar @args;
    690     die("Usage: jmuc part [<muc>] [-a <account>]") unless $muc;
     690    die("Usage: jmuc part [<muc>] [-a <account>]\n") unless $muc;
    691691
    692692    if($conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc)) {
    693693        queue_admin_msg("$jid has left $muc.");
    694694    } else {
    695         die("Error: Not joined to $muc");
     695        die("Error: Not joined to $muc\n");
    696696    }
    697697}
     
    703703    $muc = shift @args if scalar @args;
    704704
    705     die('Usage: jmuc invite <jid> [<muc>] [-a <account>]')
     705    die("Usage: jmuc invite <jid> [<muc>] [-a <account>]\n")
    706706      unless $muc && $invite_jid;
    707707
     
    718718    my ( $jid, $muc, @args ) = @_;
    719719    $muc = shift @args if scalar @args;
    720     die("Usage: jmuc configure [<muc>]") unless $muc;
     720    die("Usage: jmuc configure [<muc>]\n") unless $muc;
    721721    my $iq = Net::Jabber::IQ->new();
    722722    $iq->SetTo($muc);
     
    759759
    760760    $muc = shift @args if scalar @args;
    761     die("Usage: jmuc presence [<muc>]") unless $muc;
     761    die("Usage: jmuc presence [<muc>]\n") unless $muc;
    762762
    763763    if ($muc eq '-a') {
     
    774774    else {
    775775        my $m = $conn->getConnectionFromJID($jid)->FindMUC(jid => $muc);
    776         die("No such muc: $muc") unless $m;
     776        die("No such muc: $muc\n") unless $m;
    777777        BarnOwl::popless_ztext(jmuc_presence_single($m));
    778778    }
     
    801801    my $func = $jroster_commands{$cmd};
    802802    if ( !$func ) {
    803         BarnOwl::error("jroster: Unknown command: $cmd");
    804         return;
     803        die("jroster: Unknown command: $cmd\n");
    805804    }
    806805
     
    825824        }
    826825        else {
    827             BarnOwl::error('You must specify an account with -a <jid>');
     826            die("You must specify an account with -a <jid>\n");
    828827        }
    829828        return $func->( $jid, $name, \@groups, $purgeGroups,  @ARGV );
     
    849848    }
    850849    else {
    851         BarnOwl::error('You must specify an account with -a <jid>');
     850        die("You must specify an account with -a <jid>\n");
    852851    }
    853852
     
    12341233        $completion_jids{$room} = 1;
    12351234
     1235        my $muc;
     1236        if ($dir eq 'in') {
     1237            my $connection = $conn->getConnectionFromSid($props{sid});
     1238            $muc = $connection->FindMUC(jid => $from);
     1239        } else {
     1240            my $connection = $conn->getConnectionFromJID($props{from});
     1241            $muc = $connection->FindMUC(jid => $to);
     1242        }
     1243        $props{from} = $muc->GetFullJID($from) || $nick || $room;
    12361244        $props{sender} = $nick || $room;
    12371245        $props{recipient} = $room;
     
    13311339        return $givenJIDStr if ($conn->jidExists($givenJIDStr) );
    13321340        return resolveConnectedJID($givenJID->GetJID('base')) if $loose;
    1333         die("Invalid account: $givenJIDStr");
     1341        die("Invalid account: $givenJIDStr\n");
    13341342    }
    13351343
     
    13841392        # Not one of ours.
    13851393        else {
    1386             die("Invalid account: $givenJIDStr");
     1394            die("Invalid account: $givenJIDStr\n");
    13871395        }
    13881396
     
    14301438    if($from) {
    14311439        $from_jid = resolveConnectedJID($from, 1);
    1432         die("Unable to resolve account $from") unless $from_jid;
     1440        die("Unable to resolve account $from\n") unless $from_jid;
    14331441        $to_jid = resolveDestJID($to, $from_jid);
    14341442        push @matches, [$from_jid, $to_jid] if $to_jid;
  • perlconfig.c

    r1b1cd2c r3aa0522  
    582582}
    583583
    584 void owl_perlconfig_mainloop(owl_timer *t, void *data)
    585 {
    586   dSP;
    587   if (!owl_perlconfig_is_function("BarnOwl::Hooks::_mainloop_hook"))
    588     return;
    589   PUSHMARK(SP) ;
    590   call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
    591   if(SvTRUE(ERRSV)) {
    592     owl_function_error("%s", SvPV_nolen(ERRSV));
    593   }
    594   return;
    595 }
    596 
    597584void owl_perlconfig_io_dispatch(const owl_io_dispatch *d, void *data)
    598585{
  • popwin.c

    rf449096 r0881cdd  
    2828  popwin = newwin(pw->lines-2, pw->cols-2, startline+1, startcol+1);
    2929  pw->poppanel = new_panel(popwin);
    30  
    31   meta(popwin,TRUE);
    32   nodelay(popwin, 1);
    33   keypad(popwin, TRUE);
    3430
    3531  werase(popwin);
     
    6864  pw->active=0;
    6965  owl_global_set_needrefresh(&g);
    70   owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    71   owl_function_full_redisplay();
    7266  return(0);
    7367}
     
    7569int owl_popwin_is_active(const owl_popwin *pw)
    7670{
    77   if (pw->active==1) return(1);
    78   return(0);
     71  return pw->active;
    7972}
    8073
  • scripts/do-release

    r51dbfb5 rc62c755  
    9494NOW=$(date +"%B %d, %Y")
    9595cat <<EOF
    96  * '''$NOW''': BarnOwl $VERS Released. [wiki:Download] it here. or see the [/browser/ChangeLog?rev=$COMMIT ChangeLog]
     96 * '''$NOW''': BarnOwl $VERS Released. [wiki:Download] it here. or see the [wiki:release-notes/$VERS Release Notes] or [/browser/ChangeLog?rev=barnowl-$VERS ChangeLog].
    9797EOF
  • select.c

    r2a17b63 rc3031f3  
    273273
    274274  sigemptyset(&set);
     275  sigaddset(&set, SIGWINCH);
     276  sigaddset(&set, SIGALRM);
     277  sigaddset(&set, SIGPIPE);
     278  sigaddset(&set, SIGTERM);
     279  sigaddset(&set, SIGHUP);
    275280  sigaddset(&set, SIGINT);
    276281  sigprocmask(SIG_BLOCK, &set, oldmask);
  • tester.c

    r4123da1 r3f6555d  
    1616int main(int argc, char **argv, char **env)
    1717{
    18   owl_errqueue_init(owl_global_get_errqueue(&g));
    19   owl_obarray_init(&(g.obarray));
    20   g.context_stack = NULL;
    21   owl_global_push_context(&g, OWL_CTX_STARTUP, NULL, NULL);
     18  /* initialize a fake ncurses, detached from std{in,out} */
     19  FILE *rnull = fopen("/dev/null", "r");
     20  FILE *wnull = fopen("/dev/null", "w");
     21  newterm("xterm", wnull, rnull);
     22  /* initialize global structures */
     23  owl_global_init(&g);
    2224
    2325  numtests = 0;
     
    3133  numfailures += owl_variable_regtest();
    3234  numfailures += owl_filter_regtest();
    33   numfailures += owl_obarray_regtest();
    3435  numfailures += owl_editwin_regtest();
    3536  if (numfailures) {
     
    3738  }
    3839  printf("1..%d\n", numtests);
     40
     41  /* probably not necessary, but tear down the screen */
     42  endwin();
     43  fclose(rnull);
     44  fclose(wnull);
     45
    3946  return(numfailures);
    4047}
     
    293300}
    294301
    295 
    296 int owl_obarray_regtest(void) {
    297   int numfailed = 0;
    298   const char *p,*p2;
    299 
    300   owl_obarray oa;
    301   owl_obarray_init(&oa);
    302 
    303   printf("# BEGIN testing owl_obarray\n");
    304 
    305   p = owl_obarray_insert(&oa, "test");
    306   FAIL_UNLESS("returned string is equal", p && !strcmp(p, "test"));
    307   p2 = owl_obarray_insert(&oa, "test");
    308   FAIL_UNLESS("returned string is equal", p2 && !strcmp(p2, "test"));
    309   FAIL_UNLESS("returned the same string", p2 && p == p2);
    310 
    311   p = owl_obarray_insert(&oa, "test2");
    312   FAIL_UNLESS("returned string is equal", p && !strcmp(p, "test2"));
    313   p2 = owl_obarray_find(&oa, "test2");
    314   FAIL_UNLESS("returned the same string", p2 && !strcmp(p2, "test2"));
    315 
    316   p = owl_obarray_find(&oa, "nothere");
    317   FAIL_UNLESS("Didn't find a string that isn't there", p == NULL);
    318 
    319   printf("# END testing owl_obarray (%d failures)\n", numfailed);
    320 
    321   return numfailed;
    322 }
    323 
    324302int owl_editwin_regtest(void) {
    325303  int numfailed = 0;
  • variable.c

    r66e409c rd544237  
    110110
    111111  OWLVAR_ENUM( "loggingdirection" /* %OwlVarStub */, OWL_LOGGING_DIRECTION_BOTH,
    112                "specifices which kind of messages should be logged",
     112               "specifies which kind of messages should be logged",
    113113               "Can be one of 'both', 'in', or 'out'.  If 'in' is\n"
    114114               "selected, only incoming messages are logged, if 'out'\n"
     
    138138                    "location of users in your .anyone file.  If a user is present\n"
    139139                    "but sent no login message, or a user is not present that sent no\n"
    140                     "logout message, a pseudo login or logout message wil be created\n",
     140                    "logout message, a pseudo login or logout message will be created\n",
    141141                    NULL, owl_variable_pseudologins_set, NULL),
    142142
     
    151151
    152152                 "If non empty, any messages matching the given filter will be logged.\n"
    153                  "This is a completely separate mechanisim from the other logging\n"
     153                 "This is a completely separate mechanism from the other logging\n"
    154154                 "variables like logging, classlogging, loglogins, loggingdirection,\n"
    155155                 "etc.  If you want this variable to control all logging, make sure\n"
     
    198198  OWLVAR_PATH( "newmsgproc" /* %OwlVarStub:newmsgproc */, NULL,
    199199               "name of a program to run when new messages are present",
    200                "The named program will be run when owl recevies new.\n"
     200               "The named program will be run when owl receives new\n"
    201201               "messages.  It will not be run again until the first\n"
    202202               "instance exits"),
     
    213213                 "Called every time you start a zephyrgram without an\n"
    214214                 "explicit zsig.  The default setting implements the policy\n"
    215                  "descripted in the documentation for the 'zsig' variable.\n"),
     215                 "described in the documentation for the 'zsig' variable.\n"),
    216216
    217217  OWLVAR_STRING( "zsig" /* %OwlVarStub */, "",
     
    280280
    281281  OWLVAR_INT(    "edit:maxfillcols" /* %OwlVarStub:edit_maxfillcols */, 70,
    282                  "maximum number of columns for M-q to fill text to",
    283                  "This specifies the maximum number of columns for M-q\n"
    284                  "to fill text to.  If set to 0, ther will be no maximum\n"
    285                  "limit.  In all cases, the current width of the screen\n"
    286                  "will also be taken into account.  It will be used instead\n"
    287                  "if it is narrower than the maximum, or if this\n"
    288                  "is set to 0.\n" ),
    289 
    290   OWLVAR_INT(    "edit:maxwrapcols" /* %OwlVarStub:edit_maxwrapcols */, 0,
     282                 "maximum number of columns for M-q (edit:fill-paragraph) to fill text to",
     283                 "This specifies the maximum number of columns for M-q to fill text\n"
     284                 "to.  If set to 0, M-q will wrap to the width of the window, and\n"
     285                 "values less than 0 disable M-q entirely.\n"),
     286
     287  OWLVAR_INT(    "edit:maxwrapcols" /* %OwlVarStub:edit_maxwrapcols */, 70,
    291288                 "maximum number of columns for line-wrapping",
    292                  "This specifies the maximum number of columns for\n"
    293                  "auto-line-wrapping.  If set to 0, ther will be no maximum\n"
    294                  "limit.  In all cases, the current width of the screen\n"
    295                  "will also be taken into account.  It will be used instead\n"
    296                  "if it is narrower than the maximum, or if this\n"
    297                  "is set to 0.\n\n"
    298                  "It is recommended that outgoing messages be no wider\n"
    299                  "than 60 columns, as a courtesy to recipients.\n"),
     289                 "This specifies the maximum number of columns for\n"
     290                 "auto-line-wrapping.  If set to 0, text will be wrapped at the\n"
     291                 "window width. Values less than 0 disable automatic wrapping.\n"
     292                 "\n"
     293                 "As a courtesy to recipients, it is recommended that outgoing\n"
     294                 "Zephyr messages be no wider than 70 columns.\n"),
    300295
    301296  OWLVAR_INT( "aim_ignorelogin_timer" /* %OwlVarStub */, 15,
    302297              "number of seconds after AIM login to ignore login messages",
    303298              "This specifies the number of seconds to wait after an\n"
    304               "AIM login before allowing the recipt of AIM login notifications.\n"
     299              "AIM login before allowing the receipt of AIM login notifications.\n"
    305300              "By default this is set to 15.  If you would like to view login\n"
    306301              "notifications of buddies as soon as you login, set it to 0 instead."),
     
    405400  int rv;
    406401  rv = owl_variable_int_set_default(v, newval);
    407   if (0 == rv) owl_function_resize();
     402  if (0 == rv) owl_global_set_relayout_pending(&g);
    408403  return(rv);
    409404}
     
    433428int owl_variable_pseudologins_set(owl_variable *v, const void *newval)
    434429{
     430  static owl_timer *timer = NULL;
    435431  if (newval) {
    436432    if (*(const int*)newval == 1) {
    437433      owl_function_zephyr_buddy_check(0);
     434      if (timer == NULL) {
     435        timer = owl_select_add_timer(180, 180, owl_zephyr_buddycheck_timer, NULL, NULL);
     436      }
     437    } else {
     438      if (timer != NULL) {
     439        owl_select_remove_timer(timer);
     440        timer = NULL;
     441      }
    438442    }
    439443  }
  • viewwin.c

    rf449096 rfe4c786  
    6767{
    6868  owl_fmtext fm1, fm2;
     69
     70  /* avoid segfault when screen too small to create curswin */
     71  if (v->curswin == NULL)
     72    return;
    6973 
    7074  werase(v->curswin);
  • zephyr.c

    rf25812b r3687413  
    13641364#endif
    13651365
     1366void owl_zephyr_buddycheck_timer(owl_timer *t, void *data)
     1367{
     1368  if (owl_global_is_pseudologins(&g)) {
     1369    owl_function_debugmsg("Doing zephyr buddy check");
     1370    owl_function_zephyr_buddy_check(1);
     1371  } else {
     1372    owl_function_debugmsg("Warning: owl_zephyr_buddycheck_timer call pointless; timer should have been disabled");
     1373  }
     1374}
     1375
    13661376/*
    13671377 * Process zephyrgrams from libzephyr's queue. To prevent starvation,
Note: See TracChangeset for help on using the changeset viewer.