Changes in / [9a7b4f2:e2cbbbe]


Ignore:
Files:
1 added
19 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    rd564c3d r8a5b5a1  
     1#include <getopt.h>
    12#include <stdio.h>
    23#include <stdlib.h>
     
    9192              "Use 'show keymaps' to see the existing keymaps.\n"
    9293              "Key sequences may be things like M-C-t or NPAGE.\n\n"
    93               "Ex.: bindkey recv C-b command zwrite -c barnowl"),
     94              "Ex.: bindkey recv C-b command zwrite -c barnowl"
     95              "SEE ALSO: bindkey"),
     96
     97  OWLCMD_ARGS("unbindkey", owl_command_unbindkey, OWL_CTX_ANY,
     98              "removes a binding in a keymap",
     99              "bindkey <keymap> <keyseq>",
     100              "Removes a binding of a key sequence within a keymap.\n"
     101              "Use 'show keymaps' to see the existing keymaps.\n"
     102              "Ex.: unbindkey recv H"
     103              "SEE ALSO: bindkey"),
    94104
    95105  OWLCMD_ARGS("zwrite", owl_command_zwrite, OWL_CTX_INTERACTIVE,
     
    583593  OWLCMD_ARGS("smartnarrow", owl_command_smartnarrow, OWL_CTX_INTERACTIVE,
    584594              "view only messages similar to the current message",
    585               "smartnarrow [-i | --instance]",
     595              "smartnarrow [-i | --instance]  [-r | --relatde]",
    586596              "If the curmsg is a personal message narrow\n"
    587597              "   to the conversation with that user.\n"
     
    591601              "    to the class.\n"
    592602              "If the curmsg is a class message and '-i' is specified\n"
    593               "    then narrow to the class and instance.\n"),
     603              "    then narrow to the class and instance.\n"
     604              "If '-r' or '--related' is specified, behave as though the\n"
     605              "    'narrow-related' variable was inverted."),
    594606
    595607  OWLCMD_ARGS("smartfilter", owl_command_smartfilter, OWL_CTX_INTERACTIVE,
     
    897909                  "", ""),
    898910
    899   OWLCMD_VOID_CTX("editline:done", owl_command_editline_done,
    900                   OWL_CTX_EDITLINE,
    901                   "completes the command (eg, executes command being composed)",
    902                   "", ""),
    903 
    904   OWLCMD_VOID_CTX("editresponse:done", owl_command_editresponse_done,
    905                   OWL_CTX_EDITRESPONSE,
    906                   "completes the response to a question",
    907                   "", ""),
     911  OWLCMD_ALIAS   ("editline:done", "edit:done"),
     912  OWLCMD_ALIAS   ("editresponse:done", "edit:done"),
    908913
    909914  OWLCMD_VOID_CTX("edit:move-up-line", owl_editwin_key_up,
     
    918923
    919924  OWLCMD_VOID_CTX("edit:done", owl_command_edit_done,
    920                   OWL_CTX_EDITMULTI,
    921                   "completes the command (eg, sends message being composed)",
     925                  OWL_CTX_EDIT,
     926                  "Finishes entering text in the editwin.",
    922927                  "", ""),
    923928
     
    12361241      argc-=2; argv+=2;
    12371242    } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) {
    1238       filter = owl_function_smartfilter(0);
     1243      filter = owl_function_smartfilter(0, 0);
    12391244      argc-=2; argv+=2;
    12401245    } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) {
    1241       filter = owl_function_smartfilter(1);
     1246      filter = owl_function_smartfilter(1, 0);
    12421247      argc-=2; argv+=2;
    12431248    } else {
     
    12661271      argc-=2; argv+=2;
    12671272    } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) {
    1268       filter = owl_function_smartfilter(0);
     1273      filter = owl_function_smartfilter(0, 0);
    12691274      argc-=2; argv+=2;
    12701275    } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) {
    1271       filter = owl_function_smartfilter(1);
     1276      filter = owl_function_smartfilter(1, 0);
    12721277      argc-=2; argv+=2; 
    12731278   } else {
     
    12851290  char *filtname = NULL;
    12861291
    1287   if (argc == 1) {
    1288     filtname = owl_function_smartfilter(0);
    1289   } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) {
    1290     filtname = owl_function_smartfilter(1);
    1291   } else {
    1292     owl_function_makemsg("Wrong number of arguments for %s", argv[0]);   
    1293   }
     1292  char opt;
     1293  int instance = 0, related = 0, i;
     1294  char **tmp_argv = owl_malloc(sizeof(char *) * argc);
     1295
     1296  for (i = 0; i < argc; i++)
     1297    tmp_argv[i] = owl_strdup(argv[i]);
     1298
     1299  static struct option options[] = {
     1300    {"instance", 0, 0, 'i'},
     1301    {"related",  0, 0, 'r'},
     1302    {NULL,       0, 0, 0}};
     1303  while ((opt = getopt_long(argc, tmp_argv, "ir", options, NULL)) != -1) {
     1304    switch (opt) {
     1305      case 'i':
     1306        instance = 1;
     1307        break;
     1308      case 'r':
     1309        related = 1;
     1310        break;
     1311      default:
     1312        owl_function_makemsg("Wrong number of arguments for %s (%c)", argv[0], opt);
     1313        goto done;
     1314    }
     1315  }
     1316
     1317  for (i = 0; i < argc; i++)
     1318    owl_free(tmp_argv[i]);
     1319  owl_free(tmp_argv);
     1320
     1321  filtname = owl_function_smartfilter(instance, related);
     1322
    12941323  if (filtname) {
    12951324    owl_function_change_currentview_filter(filtname);
    12961325    owl_free(filtname);
    12971326  }
     1327
     1328done:
     1329  optind = 0; /* reset getopt */
    12981330  return NULL;
    12991331}
     
    13041336
    13051337  if (argc == 1) {
    1306     filtname = owl_function_smartfilter(0);
     1338    filtname = owl_function_smartfilter(0, 0);
    13071339  } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) {
    1308     filtname = owl_function_smartfilter(1);
     1340    filtname = owl_function_smartfilter(1, 0);
    13091341  } else {
    13101342    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);   
     
    16721704  return NULL;
    16731705}
     1706
     1707
     1708char *owl_command_unbindkey(int argc, const char *const *argv, const char *buf)
     1709{
     1710  owl_keymap *km;
     1711  int ret;
     1712
     1713  if (argc < 3) {
     1714    owl_function_makemsg("Usage: bindkey <keymap> <binding>");
     1715    return NULL;
     1716  }
     1717  km = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), argv[1]);
     1718  if (!km) {
     1719    owl_function_makemsg("No such keymap '%s'", argv[1]);
     1720    return NULL;
     1721  }
     1722  ret = owl_keymap_remove_binding(km, argv[2]);
     1723  if (ret == -1) {
     1724    owl_function_makemsg("Unable to unbind '%s' in keymap '%s'.",
     1725                         argv[2], argv[1]);
     1726    return NULL;
     1727  } else if (ret == -2) {
     1728    owl_function_makemsg("No such binding '%s' in keymap '%s'.",
     1729                         argv[2], argv[1]);
     1730  }
     1731  return NULL;
     1732}
     1733
    16741734
    16751735void owl_command_quit(void)
     
    22202280    return NULL;
    22212281  }
    2222   filtname = owl_function_classinstfilt(argv[1], NULL);
     2282  filtname = owl_function_classinstfilt(argv[1], NULL, owl_global_is_narrow_related(&g));
    22232283  owl_function_change_currentview_filter(filtname);
    22242284  owl_free(filtname);
     
    23322392  }
    23332393
    2334   filtname=owl_function_classinstfilt(argv[1], NULL);
     2394  filtname=owl_function_classinstfilt(argv[1], NULL, owl_global_is_narrow_related(&g));
    23352395  (void) owl_function_color_filter(filtname, argv[2], (argc == 4 ? argv[3] : NULL));
    23362396  return NULL;
     
    25242584  /* if we get two arguments, ask for the password */
    25252585  if (argc==2) {
    2526     owl_global_set_buffercommand(&g, argv[1]);
    2527     owl_global_set_buffercallback(&g, &owl_callback_aimlogin);
    2528     owl_function_start_password("AIM Password: ");
     2586    owl_editwin *e = owl_function_start_password("AIM Password: ");
     2587    owl_editwin_set_cbdata(e, owl_strdup(argv[1]), owl_free);
     2588    owl_editwin_set_callback(e, owl_callback_aimlogin);
    25292589    return(NULL);
    25302590  } else {
     
    26552715  }
    26562716
    2657   owl_editwin_fullclear(e);
    26582717  owl_global_set_needrefresh(&g);
     2718  owl_global_pop_context(&g);
     2719
    26592720  owl_global_set_typwin_inactive(&g);
    2660   owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL);
    2661 
    2662   owl_global_pop_context(&g);
     2721  owl_editwin_delete(e);
    26632722}
    26642723
     
    27102769}
    27112770
    2712 void owl_command_editline_done(owl_editwin *e)
     2771void owl_command_edit_done(owl_editwin *e)
    27132772{
    27142773  owl_history *hist=owl_editwin_get_history(e);
    2715   char *rv, *cmd;
    2716 
    2717   owl_history_store(hist, owl_editwin_get_text(e));
    2718   owl_history_reset(hist);
    2719   owl_global_set_typwin_inactive(&g);
    2720   owl_global_pop_context(&g);
    2721   cmd = owl_strdup(owl_editwin_get_text(e));
    2722   owl_editwin_fullclear(e);
    2723   rv = owl_function_command(cmd);
    2724   owl_free(cmd);
    2725 
    2726   owl_global_set_needrefresh(&g);
    2727 
    2728   if (rv) {
    2729     owl_function_makemsg("%s", rv);
    2730     owl_free(rv);
    2731   }
    2732 }
    2733 
    2734 
    2735 void owl_command_editresponse_done(owl_editwin *e)
    2736 {
    2737   owl_function_run_buffercommand();
    2738 
    2739   owl_global_set_typwin_inactive(&g);
    2740   owl_global_pop_context(&g);
    2741   owl_editwin_fullclear(e);
    2742   owl_global_set_needrefresh(&g);
    2743 }
    2744 
    2745 
    2746 void owl_command_edit_done(owl_editwin *e)
    2747 {
    2748   owl_history *hist=owl_editwin_get_history(e);
    2749 
    2750   owl_history_store(hist, owl_editwin_get_text(e));
    2751   owl_history_reset(hist);
    2752 
    2753   owl_function_run_buffercommand();
    2754   owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL);
    2755   owl_editwin_fullclear(e);
     2774
     2775  if (hist) {
     2776    owl_history_store(hist, owl_editwin_get_text(e));
     2777    owl_history_reset(hist);
     2778  }
     2779
    27562780  owl_global_set_typwin_inactive(&g);
    27572781  owl_global_pop_context(&g);
    27582782  owl_global_set_needrefresh(&g);
     2783
     2784  owl_editwin_do_callback(e);
     2785  owl_editwin_delete(e);
    27592786}
    27602787
  • configure.ac

    r9a7b4f2 r9a7b4f2  
    9898AC_MSG_NOTICE([Adding perl LIBS ${FOO}])
    9999LIBS=${LIBS}\ ${FOO}
     100AC_CHECK_LIB([perl], [perl_alloc],, AC_MSG_ERROR([No libperl found]))
     101
     102AX_PROG_PERL_MODULES([Class::Accessor::Fast],,
     103                     [AC_MSG_ERROR([cannot find perl module Class::Accessor::Fast.])])
     104AX_PROG_PERL_MODULES([PAR],,
     105                     [AC_MSG_WARN([PAR.pm not found. Loadable modules will be disabled.])])
    100106
    101107dnl Add CFLAGS and LDFLAGS for glib-2.0
     
    135141AC_PROG_INSTALL
    136142AC_PROG_RANLIB
     143AC_CHECK_PROG([HAVE_ZIP], [zip], [yes], [no])
     144if test "x${HAVE_ZIP}" = "xno"; then
     145   AC_MSG_ERROR([cannot find a 'zip' binary.])
     146fi
    137147
    138148AC_CONFIG_FILES([Makefile libfaim/Makefile perl/Makefile perl/modules/Makefile])
  • editwin.c

    rf449096 r21dd391  
    3535  oe_excursion *excursions;
    3636
    37   char *command;
    3837  void (*callback)(struct _owl_editwin*);
     38  void (*destroy_cbdata)(void *);
    3939  void *cbdata;
    4040};
     
    4545static void oe_restore_excursion(owl_editwin *e, oe_excursion *x);
    4646static void oe_restore_mark_only(owl_editwin *e, oe_excursion *x);
    47 static int oe_count_glyphs(const char *s);
    4847static int oe_char_width(gunichar c, int column);
    4948static int oe_region_width(owl_editwin *e, int start, int end, int width);
     
    5857static int oe_copy_region(owl_editwin *e);
    5958static char *oe_chunk(owl_editwin *e, int start, int end);
     59static void oe_destroy_cbdata(owl_editwin *e);
    6060
    6161#define INCR 4096
     
    6363#define WHITESPACE " \n\t"
    6464
    65 owl_editwin *owl_editwin_allocate(void)
     65static owl_editwin *owl_editwin_allocate(void)
    6666{
    6767  owl_editwin *e;
     
    7575  owl_free(e->buff);
    7676  owl_free(e->killbuf);
    77   owl_free(e->command);
    7877  /* just in case someone forgot to clean up */
    7978  while (e->excursions) {
    8079    oe_release_excursion(e, e->excursions);
    8180  }
     81  oe_destroy_cbdata(e);
    8282
    8383  owl_free(e);
    84 }
    85 
    86 static int oe_count_glyphs(const char *s)
    87 {
    88   int count = 0;
    89   const char *p;
    90 
    91   for(p = s; *p != 0; p = g_utf8_find_next_char(p, NULL))
    92     if (!g_unichar_ismark(g_utf8_get_char(p)))
    93       count++;
    94 
    95   return count;
    9684}
    9785
     
    116104}
    117105
    118 /* initialize the editwin e.
    119  * 'win' is an already initialzed curses window that will be used by editwin
    120  */
    121 void owl_editwin_init(owl_editwin *e, WINDOW *win, int winlines, int wincols, int style, owl_history *hist)
     106static void _owl_editwin_init(owl_editwin *e,
     107                              WINDOW *win,
     108                              int winlines,
     109                              int wincols,
     110                              int style,
     111                              owl_history *hist)
    122112{
    123113  e->buff=owl_malloc(INCR);
     
    145135  e->echochar='\0';
    146136
    147   /* We get initialized multiple times, but we need to hold on to
    148      the callbacks, so we can't NULL them here. */
    149   /*
    150     e->command = NULL;
    151     e->callback = NULL;
    152     e->cbdata = NULL;
    153   */
    154137  if (win) werase(win);
     138}
     139
     140owl_editwin *owl_editwin_new(WINDOW *win, int winlines, int wincols, int style, owl_history *hist)
     141{
     142  owl_editwin *e = owl_editwin_allocate();
     143
     144  _owl_editwin_init(e, win, winlines, wincols, style, hist);
     145  return e;
    155146}
    156147
     
    188179}
    189180
    190 void owl_editwin_set_command(owl_editwin *e, const char *command)
    191 {
    192   if(e->command) owl_free(e->command);
    193   e->command = owl_strdup(command);
    194 }
    195 
    196 const char *owl_editwin_get_command(owl_editwin *e)
    197 {
    198   if(e->command) return e->command;
    199   return "";
    200 }
    201 
    202181void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin*))
    203182{
     
    210189}
    211190
    212 void owl_editwin_set_cbdata(owl_editwin *e, void *data)
    213 {
     191static void oe_destroy_cbdata(owl_editwin *e) {
     192  if (e->destroy_cbdata)
     193    e->destroy_cbdata(e->cbdata);
     194  e->cbdata = NULL;
     195  e->destroy_cbdata = NULL;
     196}
     197
     198void owl_editwin_set_cbdata(owl_editwin *e, void *data, void (*destroy)(void *))
     199{
     200  oe_destroy_cbdata(e);
    214201  e->cbdata = data;
     202  e->destroy_cbdata = destroy;
    215203}
    216204
     
    259247}
    260248
    261 void owl_editwin_new_style(owl_editwin *e, int newstyle, owl_history *h)
    262 {
    263   e->hist = h;
    264 
    265   if (e->style==newstyle) return;
    266 
    267   if (newstyle==OWL_EDITWIN_STYLE_MULTILINE) {
    268     e->style=newstyle;
    269   } else if (newstyle==OWL_EDITWIN_STYLE_ONELINE) {
    270     e->style=newstyle;
    271 
    272     /* nuke everything after the first line */
    273     owl_editwin_move_to_top(e);
    274     owl_editwin_move_to_end_of_line(e);
    275     owl_editwin_replace(e, oe_count_glyphs(e->buff + e->index),  "");
    276   }
    277 }
    278 
    279 /* completly reinitialize the buffer */
    280 void owl_editwin_fullclear(owl_editwin *e)
    281 {
    282   owl_free(e->buff);
    283   owl_editwin_init(e, e->curswin, e->winlines, e->wincols, e->style, e->hist);
    284 }
    285 
    286249/* clear all text except for locktext and put the cursor at the
    287250 * beginning
     
    302265
    303266  owl_free(e->buff);
    304   owl_editwin_init(e, e->curswin, e->winlines, e->wincols, e->style, e->hist);
     267  _owl_editwin_init(e, e->curswin, e->winlines, e->wincols, e->style, e->hist);
    305268
    306269  if (lock > 0) {
  • functions.c

    r9a7b4f2 r9a7b4f2  
    278278}
    279279
    280 void owl_function_start_edit_win(const char *line, void (*callback)(owl_editwin *), void *data)
     280void owl_function_start_edit_win(const char *line, void (*callback)(owl_editwin *), void *data, void (*cleanup)(void *))
    281281{
    282282  owl_editwin *e;
     
    284284
    285285  /* create and setup the editwin */
    286   e = owl_global_get_typwin(&g);
    287   owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE,
    288                         owl_global_get_msg_history(&g));
    289   owl_editwin_clear(e);
     286  e = owl_global_set_typwin_active(&g, OWL_EDITWIN_STYLE_MULTILINE,
     287                                   owl_global_get_msg_history(&g));
    290288  owl_editwin_set_dotsend(e);
    291289  s = owl_sprintf("----> %s\n", line);
     
    293291  owl_free(s);
    294292
    295   /* make it active */
    296   owl_global_set_typwin_active(&g);
    297 
    298   owl_editwin_set_cbdata(owl_global_get_typwin(&g), data);
    299   owl_global_set_buffercallback(&g, callback);
     293  owl_editwin_set_cbdata(e, data, cleanup);
     294  owl_editwin_set_callback(e, callback);
    300295  owl_global_push_context(&g, OWL_CTX_EDITMULTI, e, "editmulti");
    301296}
     
    313308                         noun);
    314309
    315   owl_function_start_edit_win(line, callback, NULL);
    316   owl_global_set_buffercommand(&g, line);
     310  owl_function_start_edit_win(line, callback,
     311                              owl_strdup(line),
     312                              owl_free);
    317313}
    318314
     
    350346
    351347void owl_callback_zwrite(owl_editwin *e) {
    352   owl_function_zwrite(owl_editwin_get_command(e),
     348  char *command = owl_editwin_get_cbdata(e);
     349  owl_function_zwrite(command,
    353350                      owl_editwin_get_text(e));
    354351}
     
    459456
    460457void owl_callback_aimwrite(owl_editwin *e) {
    461   owl_function_aimwrite(owl_editwin_get_command(e),
     458  char *command = owl_editwin_get_cbdata(e);
     459  owl_function_aimwrite(command,
    462460                        owl_editwin_get_text(e));
    463461}
     
    894892
    895893void owl_callback_aimlogin(owl_editwin *e) {
    896   owl_function_aimlogin(owl_editwin_get_command(e),
     894  char *user = owl_editwin_get_cbdata(e);
     895  owl_function_aimlogin(user,
    897896                        owl_editwin_get_text(e));
    898897}
     
    11931192{
    11941193  owl_global_set_resize_pending(&g);
    1195 }
    1196 
    1197 void owl_function_run_buffercommand(void)
    1198 {
    1199   owl_editwin_do_callback(owl_global_get_typwin(&g));
    12001194}
    12011195
     
    19171911}
    19181912
     1913void owl_callback_command(owl_editwin *e)
     1914{
     1915  char *rv;
     1916  const char *line = owl_editwin_get_text(e);
     1917
     1918  rv = owl_function_command(line);
     1919   if (rv) {
     1920    owl_function_makemsg("%s", rv);
     1921    owl_free(rv);
     1922  }
     1923}
     1924
    19191925void owl_function_start_command(const char *line)
    19201926{
    19211927  owl_editwin *tw;
    19221928
    1923   tw=owl_global_get_typwin(&g);
    1924   owl_global_set_typwin_active(&g);
    1925   owl_editwin_new_style(tw, OWL_EDITWIN_STYLE_ONELINE,
    1926                         owl_global_get_cmd_history(&g));
     1929  tw = owl_global_set_typwin_active(&g, OWL_EDITWIN_STYLE_ONELINE, owl_global_get_cmd_history(&g));
    19271930
    19281931  owl_editwin_set_locktext(tw, "command: ");
     
    19331936
    19341937  owl_global_push_context(&g, OWL_CTX_EDITLINE, tw, "editline");
    1935 }
    1936 
    1937 void owl_function_start_question(const char *line)
     1938  owl_editwin_set_callback(tw, owl_callback_command);
     1939}
     1940
     1941owl_editwin *owl_function_start_question(const char *line)
    19381942{
    19391943  owl_editwin *tw;
    19401944
    1941   tw=owl_global_get_typwin(&g);
    1942   owl_global_set_typwin_active(&g);
    1943   owl_editwin_new_style(tw, OWL_EDITWIN_STYLE_ONELINE, owl_global_get_cmd_history(&g));
     1945  tw = owl_global_set_typwin_active(&g, OWL_EDITWIN_STYLE_ONELINE, owl_global_get_cmd_history(&g));
    19441946
    19451947  owl_editwin_set_locktext(tw, line);
     
    19481950  owl_editwin_redisplay(tw);
    19491951
    1950   owl_global_push_context(&g, OWL_CTX_EDITRESPONSE, tw, "editline");
    1951 }
    1952 
    1953 void owl_function_start_password(const char *line)
     1952  owl_global_push_context(&g, OWL_CTX_EDITRESPONSE, tw, "editresponse");
     1953  return tw;
     1954}
     1955
     1956owl_editwin *owl_function_start_password(const char *line)
    19541957{
    19551958  owl_editwin *tw;
    19561959
    1957   tw=owl_global_get_typwin(&g);
    1958   owl_global_set_typwin_active(&g);
    1959   owl_editwin_new_style(tw, OWL_EDITWIN_STYLE_ONELINE, owl_global_get_cmd_history(&g));
     1960  tw = owl_global_set_typwin_active(&g, OWL_EDITWIN_STYLE_ONELINE, NULL);
     1961
    19601962  owl_editwin_set_echochar(tw, '*');
    19611963
     
    19661968
    19671969  owl_global_push_context(&g, OWL_CTX_EDITRESPONSE, tw, "editresponse");
     1970  return tw;
    19681971}
    19691972
     
    22892292 * instance is NULL then catch all messgaes in the class.  Returns the
    22902293 * name of the filter, which the caller must free.
     2294 * If 'related' is nonzero, encompass unclasses and .d classes as well.
    22912295 */
    2292 char *owl_function_classinstfilt(const char *c, const char *i)
     2296char *owl_function_classinstfilt(const char *c, const char *i, int related)
    22932297{
    22942298  owl_filter *f;
     
    22972301  char *class, *instance = NULL;
    22982302
    2299   class = owl_util_baseclass(c);
    2300   if(i) {
    2301     instance = owl_util_baseclass(i);
     2303  if (related) {
     2304    class = owl_util_baseclass(c);
     2305    if (i) {
     2306      instance = owl_util_baseclass(i);
     2307    }
     2308  } else {
     2309    class = owl_strdup(c);
     2310    if (i) {
     2311      instance = owl_strdup(i);
     2312    }
    23022313  }
    23032314
    23042315  /* name for the filter */
    23052316  if (!instance) {
    2306     filtname = owl_sprintf("class-%s", class);
    2307   } else {
    2308     filtname = owl_sprintf("class-%s-instance-%s", class, instance);
     2317    filtname = owl_sprintf("%sclass-%s", related ? "related-" : "", class);
     2318  } else {
     2319    filtname = owl_sprintf("%sclass-%s-instance-%s", related ? "related-" : "", class, instance);
    23092320  }
    23102321  /* downcase it */
     
    23382349  }
    23392350
    2340   argbuff = owl_sprintf("class ^(un)*%s(\\.d)*$", tmpclass);
     2351  argbuff = owl_sprintf(related ? "class ^(un)*%s(\\.d)*$" : "class ^%s$", tmpclass);
    23412352  if (tmpinstance) {
    23422353    char *tmp = argbuff;
    2343     argbuff = owl_sprintf("%s and ( instance ^(un)*%s(\\.d)*$ )", tmp, tmpinstance);
     2354    argbuff = owl_sprintf(related ? "%s and ( instance ^(un)*%s(\\.d)*$ )" : "%s and instance ^%s$", tmp, tmpinstance);
    23442355    owl_free(tmp);
    23452356  }
     
    25122523 *    name to the AIM conversation with that user
    25132524 */
    2514 char *owl_function_smartfilter(int type)
     2525char *owl_function_smartfilter(int type, int invert_related)
    25152526{
    25162527  const owl_view *v;
    25172528  const owl_message *m;
    25182529  char *zperson, *filtname=NULL;
    2519   const char *argv[1];
    2520  
     2530  const char *argv[2];
     2531  int related = owl_global_is_narrow_related(&g) ^ invert_related;
     2532
    25212533  v=owl_global_get_current_view(&g);
    25222534  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
     
    25622574    /* narrow class MESSAGE, instance foo, recip * messages to class, inst */
    25632575    if (!strcasecmp(owl_message_get_class(m), "message")) {
    2564       filtname=owl_function_classinstfilt(owl_message_get_class(m), owl_message_get_instance(m));
     2576      filtname=owl_function_classinstfilt(owl_message_get_class(m), owl_message_get_instance(m), related);
    25652577      return(filtname);
    25662578    }
     
    25682580    /* otherwise narrow to the class */
    25692581    if (type==0) {
    2570       filtname=owl_function_classinstfilt(owl_message_get_class(m), NULL);
     2582      filtname=owl_function_classinstfilt(owl_message_get_class(m), NULL, related);
    25712583    } else if (type==1) {
    2572       filtname=owl_function_classinstfilt(owl_message_get_class(m), owl_message_get_instance(m));
     2584      filtname=owl_function_classinstfilt(owl_message_get_class(m), owl_message_get_instance(m), related);
    25732585    }
    25742586    return(filtname);
     
    25762588
    25772589  /* pass it off to perl */
    2578   if(type) {
    2579     argv[0] = "-i";
    2580   };
    2581   return owl_perlconfig_message_call_method(m, "smartfilter", type ? 1 : 0, argv);
     2590  argv[0] = type ? "1" : "0";
     2591  argv[1] = related ? "1" : "0";
     2592  return owl_perlconfig_message_call_method(m, "smartfilter", 2, argv);
    25822593}
    25832594
     
    34183429  int i, j;
    34193430  owl_list anyone;
    3420   owl_message *m;
    34213431  owl_zbuddylist *zbl;
     3432  GList **zaldlist;
     3433  GList *zaldptr;
     3434  ZAsyncLocateData_t *zald;
    34223435  const char *user;
    3423   ZLocations_t location[200];
    3424   int numlocs, ret;
    34253436
    34263437  if (!owl_global_is_havezephyr(&g)) return;
    3427 
    3428   zbl=owl_global_get_zephyr_buddylist(&g);
     3438  owl_global_set_pseudologin_notify(&g, notify);
     3439  zbl = owl_global_get_zephyr_buddylist(&g);
     3440  zaldlist = owl_global_get_zaldlist(&g);
     3441
     3442  /* Clear the existing ZALDs first. */
     3443  zaldptr = g_list_first(*zaldlist);
     3444  while (zaldptr) {
     3445    ZFreeALD(zaldptr->data);
     3446    owl_free(zaldptr->data);
     3447    zaldptr = g_list_next(zaldptr);
     3448  }
     3449  g_list_free(*zaldlist);
     3450  *zaldlist = NULL;
    34293451
    34303452  owl_list_create(&anyone);
    3431   ret=owl_zephyr_get_anyone_list(&anyone, NULL);
    3432 
    3433   j=owl_list_get_size(&anyone);
    3434   for (i=0; i<j; i++) {
    3435     user=owl_list_get_element(&anyone, i);
    3436     ret=ZLocateUser(zstr(user), &numlocs, ZAUTH);
    3437     if (ret!=ZERR_NONE) {
    3438       owl_function_error("Error getting location for %s", user);
    3439       continue;
    3440     }
    3441     numlocs=200;
    3442     ret=ZGetLocations(location, &numlocs);
    3443     if (ret==0) {
    3444       if ((numlocs>0) && !owl_zbuddylist_contains_user(zbl, user)) {
    3445         /* Send a PSEUDO LOGIN! */
    3446         if (notify) {
    3447           m=owl_malloc(sizeof(owl_message));
    3448           owl_message_create_pseudo_zlogin(m, 0, user, location[0].host, location[0].time, location[0].tty);
    3449           owl_global_messagequeue_addmsg(&g, m);
    3450         }
    3451         owl_zbuddylist_adduser(zbl, user);
    3452         owl_function_debugmsg("owl_function_zephyr_buddy_check: login for %s ", user);
    3453       } else if ((numlocs==0) && owl_zbuddylist_contains_user(zbl, user)) {
    3454         /* I don't think this ever happens (if there are 0 locations we should get an error from
    3455          * ZGetLocations)
    3456          */
    3457         owl_function_error("owl_function_zephyr_buddy_check: exceptional case logout for %s ",user);
    3458       }
    3459     } else if ((ret==ZERR_NOLOCATIONS) && owl_zbuddylist_contains_user(zbl, user)) {
    3460       /* Send a PSEUDO LOGOUT! */
    3461       if (notify) {
    3462         m=owl_malloc(sizeof(owl_message));
    3463         owl_message_create_pseudo_zlogin(m, 1, user, "", "", "");
    3464         owl_global_messagequeue_addmsg(&g, m);
    3465       }
    3466       owl_zbuddylist_deluser(zbl, user);
    3467       owl_function_debugmsg("owl_function_zephyr_buddy_check: logout for %s ",user);
     3453  owl_zephyr_get_anyone_list(&anyone, NULL);
     3454  j = owl_list_get_size(&anyone);
     3455  for (i = 0; i < j; i++) {
     3456    user = owl_list_get_element(&anyone, i);
     3457    zald = owl_malloc(sizeof(ZAsyncLocateData_t));
     3458    if (ZRequestLocations(zstr(user), zald, UNACKED, ZAUTH) == ZERR_NONE) {
     3459      *zaldlist = g_list_append(*zaldlist, zald);
     3460    } else {
     3461      owl_free(zald);
    34683462    }
    34693463  }
  • global.c

    r2ee9e8d r98d296d  
    4545  g->rightshift=0;
    4646
    47   g->tw = owl_editwin_allocate();
    48   owl_editwin_init(g->tw, NULL, owl_global_get_typwin_lines(g), g->cols, OWL_EDITWIN_STYLE_ONELINE, NULL);
     47  g->tw = NULL;
    4948
    5049  owl_keyhandler_init(&g->kh);
     
    5857  g->curmsg_vert_offset=0;
    5958  g->resizepending=0;
    60   g->typwinactive=0;
    6159  g->direction=OWL_DIRECTION_DOWNWARDS;
    6260  g->zaway=0;
     
    111109  owl_zbuddylist_create(&(g->zbuddies));
    112110
     111  g->zaldlist = NULL;
     112  g->pseudologin_notify = 0;
     113
    113114  owl_obarray_init(&(g->obarray));
    114115
     
    171172  _owl_panel_set_window(&g->typpan, newwin(typwin_lines, cols, g->recwinlines+2, 0));
    172173
    173   owl_editwin_set_curswin(g->tw, owl_global_get_curs_typwin(g), typwin_lines, g->cols);
     174  if (g->tw)
     175      owl_editwin_set_curswin(g->tw, owl_global_get_curs_typwin(g), typwin_lines, g->cols);
    174176
    175177  idlok(owl_global_get_curs_typwin(g), FALSE);
     
    324326}
    325327
    326 /* buffercommand */
    327 
    328 void owl_global_set_buffercommand(owl_global *g, const char *command) {
    329   owl_editwin_set_command(owl_global_get_typwin(g), command);
    330 }
    331 
    332 const char *owl_global_get_buffercommand(const owl_global *g) {
    333   return owl_editwin_get_command(owl_global_get_typwin(g));
    334 }
    335 
    336 void owl_global_set_buffercallback(owl_global *g, void (*cb)(owl_editwin*)) {
    337   owl_editwin_set_callback(owl_global_get_typwin(g), cb);
    338 }
    339 
    340 void (*owl_global_get_buffercallback(const owl_global *g))(owl_editwin*) {
    341   return owl_editwin_get_callback(owl_global_get_typwin(g));
    342 }
    343 
    344328/* refresh */
    345329
     
    381365/* typwin */
    382366
    383 int owl_global_is_typwin_active(const owl_global *g) {
    384   if (g->typwinactive==1) return(1);
    385   return(0);
    386 }
    387 
    388 void owl_global_set_typwin_active(owl_global *g) {
    389   int d = owl_global_get_typewindelta(g);
    390   if (d > 0)
     367owl_editwin *owl_global_set_typwin_active(owl_global *g, int style, owl_history *hist) {
     368  int d;
     369  d = owl_global_get_typewindelta(g);
     370  if (d > 0 && style == OWL_EDITWIN_STYLE_MULTILINE)
    391371      owl_function_resize_typwin(owl_global_get_typwin_lines(g) + d);
    392372
    393   g->typwinactive=1;
     373  g->tw = owl_editwin_new(owl_global_get_curs_typwin(g),
     374                          owl_global_get_typwin_lines(g),
     375                          g->cols,
     376                          style,
     377                          hist);
     378  return g->tw;
    394379}
    395380
    396381void owl_global_set_typwin_inactive(owl_global *g) {
    397382  int d = owl_global_get_typewindelta(g);
    398   if (d > 0)
     383  if (d > 0 && owl_editwin_get_style(g->tw) == OWL_EDITWIN_STYLE_MULTILINE)
    399384      owl_function_resize_typwin(owl_global_get_typwin_lines(g) - d);
    400385
    401   g->typwinactive=0;
     386  werase(owl_global_get_curs_typwin(g));
     387  g->tw = NULL;
    402388}
    403389
     
    531517  owl_mainwin_redisplay(&(g->mw));
    532518  sepbar(NULL);
    533   owl_editwin_redisplay(g->tw);
     519  if (g->tw)
     520      owl_editwin_redisplay(g->tw);
     521  else
     522    werase(owl_global_get_curs_typwin(g));
     523
    534524  owl_function_full_redisplay();
    535525
     
    968958}
    969959
     960GList **owl_global_get_zaldlist(owl_global *g)
     961{
     962  return &(g->zaldlist);
     963}
     964
     965int owl_global_get_pseudologin_notify(owl_global *g)
     966{
     967  return g->pseudologin_notify;
     968}
     969
     970void owl_global_set_pseudologin_notify(owl_global *g, int notify)
     971{
     972  g->pseudologin_notify = notify;
     973}
     974
    970975struct termios *owl_global_get_startup_tio(owl_global *g)
    971976{
  • keybinding.c

    r920201c r8a921b5  
    1414int owl_keybinding_init(owl_keybinding *kb, const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
    1515{
    16   char **ktokens;
    17   int    nktokens, i;
    18  
    1916  owl_function_debugmsg("owl_keybinding_init: creating binding for <%s> with desc: <%s>", keyseq, desc);
    2017  if (command && !function_fn) {
     
    2522    return(-1);
    2623  }
     24
     25  if (owl_keybinding_make_keys(kb, keyseq) != 0) {
     26    return(-1);
     27  }
     28
     29  if (command) kb->command = owl_strdup(command);
     30  kb->function_fn = function_fn;
     31  if (desc) kb->desc = owl_strdup(desc);
     32  else kb->desc = NULL;
     33  return(0);
     34}
     35
     36int owl_keybinding_make_keys(owl_keybinding *kb, const char *keyseq)
     37{
     38  char **ktokens;
     39  int    nktokens, i;
    2740
    2841  ktokens = atokenize(keyseq, " ", &nktokens);
     
    4255  }
    4356  kb->len = nktokens;
    44 
    4557  atokenize_delete(ktokens, nktokens);
    46 
    47   if (command) kb->command = owl_strdup(command);
    48   kb->function_fn = function_fn;
    49   if (desc) kb->desc = owl_strdup(desc);
    50   else kb->desc = NULL;
    5158  return(0);
    5259}
  • keymap.c

    rbb0d439 r8a921b5  
    5151  }
    5252  return owl_list_append_element(&km->bindings, kb); 
    53 }
     53
     54}
     55
     56/* removes the binding associated with the keymap */
     57int owl_keymap_remove_binding(owl_keymap *km, const char *keyseq)
     58{
     59  owl_keybinding *kb, *curkb;
     60  int i;
     61
     62  if ((kb = owl_malloc(sizeof(owl_keybinding))) == NULL) return(-1);
     63  if (0 != owl_keybinding_make_keys(kb, keyseq)) {
     64    owl_free(kb);
     65    return(-1);
     66  }
     67
     68  for (i = owl_list_get_size(&km->bindings)-1; i >= 0; i--) {
     69    curkb = owl_list_get_element(&km->bindings, i);
     70    if (owl_keybinding_equal(curkb, kb)) {
     71      owl_list_remove_element(&km->bindings, i);
     72      owl_keybinding_delete(curkb);
     73      return(0);
     74    }
     75  }
     76  return(-2);
     77}
     78
    5479
    5580/* returns a summary line describing this keymap.  the caller must free. */
  • keys.c

    r8830df47 r8a5b5a1  
    246246  BIND_CMD("M-n", "smartnarrow",      "narrow to a view based on the current message");
    247247  BIND_CMD("M-N", "smartnarrow -i",   "narrow to a view based on the current message, and consider instance pair");
     248  BIND_CMD("M-m", "smartnarrow -r",   "like M-n but with 'narrow-related' temporarily flipped.");
     249  BIND_CMD("M-M", "smartnarrow -ri",  "like M-N but with 'narrow-related' temporarily flipped.");
    248250  BIND_CMD("M-p", "view personal", "");
    249251 
  • owl.c

    rf449096 r98d296d  
    629629      /* leave the cursor in the appropriate window */
    630630      if (!owl_popwin_is_active(owl_global_get_popwin(&g))
    631           && owl_global_is_typwin_active(&g)) {
     631          && owl_global_get_typwin(&g)) {
    632632        owl_function_set_cursor(typwin);
    633633      } else {
  • owl.h

    r03c5bdd r98d296d  
    559559  int resizepending;
    560560  int recwinlines;
    561   int typwinactive;
    562561  char *thishost;
    563562  char *homedir;
     
    604603  owl_zbuddylist zbuddies;
    605604  owl_timer zephyr_buddycheck_timer;
     605  GList *zaldlist;
     606  int pseudologin_notify;
    606607  struct termios startup_tio;
    607608  owl_obarray obarray;
  • perl/lib/BarnOwl/Style/Default.pm

    rad0dedd r0fe69d2  
    168168    ? '@color(cyan)' : '';
    169169
    170   my $chars = $oneline ? qr/[[:cntrl:]]/ : qr/[^[:print:]]|[\r\cK\f]/;
     170  my $chars = $oneline ? qr/[[:cntrl:]]/ : qr/[^[:print:]\n]|[\r\cK\f]/;
    171171
    172172  $s =~ s/($chars)/
     
    179179
    180180As above, but always be conservative, and replace with a '?' instead
    181 of something mmore elaborate.
     181of something more elaborate.
    182182
    183183=cut
  • perlconfig.c

    r8f2d9bf r1b1cd2c  
    574574  FREETMPS;
    575575  LEAVE;
    576 
    577   SvREFCNT_dec(cb);
    578   owl_editwin_set_cbdata(e, NULL);
     576}
     577
     578void owl_perlconfig_dec_refcnt(void *data)
     579{
     580  SV *v = data;
     581  SvREFCNT_dec(v);
    579582}
    580583
  • perlglue.xs

    r8c59178 r9186c75  
    172172        SV *callback
    173173        PREINIT:
     174                owl_editwin *e;
    174175        CODE:
    175176        {
     
    177178                        croak("Callback must be a subref");
    178179
    179                 owl_function_start_question(line);
    180 
    181                 owl_editwin_set_cbdata(owl_global_get_typwin(&g), newSVsv(callback));
    182                 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
     180                e = owl_function_start_question(line);
     181
     182                owl_editwin_set_cbdata(e,
     183                                       newSVsv(callback),
     184                                       owl_perlconfig_dec_refcnt);
     185                owl_editwin_set_callback(e, owl_perlconfig_edit_callback);
    183186        }
    184187
     
    188191        SV *callback
    189192        PREINIT:
     193                owl_editwin *e;
    190194        CODE:
    191195        {
     
    193197                        croak("Callback must be a subref");
    194198
    195                 owl_function_start_password(line);
    196 
    197                 owl_editwin_set_cbdata(owl_global_get_typwin(&g), newSVsv(callback));
    198                 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
     199                e = owl_function_start_password(line);
     200
     201                owl_editwin_set_cbdata(e,
     202                                       newSVsv(callback),
     203                                       owl_perlconfig_dec_refcnt);
     204                owl_editwin_set_callback(e, owl_perlconfig_edit_callback);
    199205        }
    200206
     
    208214                        croak("Callback must be a subref");
    209215
    210                 owl_function_start_edit_win(line, owl_perlconfig_edit_callback, newSVsv(callback));
     216                owl_function_start_edit_win(line,
     217                                            owl_perlconfig_edit_callback,
     218                                            newSVsv(callback),
     219                                            owl_perlconfig_dec_refcnt);
    211220        }
    212221
     
    542551        int count;
    543552        const char *string;
    544         CODE:
    545                 RETVAL = owl_editwin_replace(owl_global_get_typwin(&g), count, string);
     553        PREINIT:
     554                owl_editwin *e;
     555        CODE:
     556                e = owl_global_get_typwin(&g);
     557                if (e) {
     558                        RETVAL = owl_editwin_replace(e, count, string);
     559                } else {
     560                        RETVAL = 0;
     561                }
    546562        OUTPUT:
    547563                RETVAL
     
    550566point_move(delta)
    551567        int delta;
    552         CODE:
    553                 RETVAL = owl_editwin_point_move(owl_global_get_typwin(&g), delta);
     568        PREINIT:
     569                owl_editwin *e;
     570        CODE:
     571                e = owl_global_get_typwin(&g);
     572                if (e) {
     573                        RETVAL = owl_editwin_point_move(e, delta);
     574                } else {
     575                        RETVAL = 0;
     576                }
    554577        OUTPUT:
    555578                RETVAL
     
    558581replace_region(string)
    559582        const char *string;
    560         CODE:
    561                 RETVAL = owl_editwin_replace_region(owl_global_get_typwin(&g), string);
     583        PREINIT:
     584                owl_editwin *e;
     585        CODE:
     586                e = owl_global_get_typwin(&g);
     587                if (e) {
     588                        RETVAL = owl_editwin_replace_region(e, string);
     589                } else {
     590                        RETVAL = 0;
     591                }
    562592        OUTPUT:
    563593                RETVAL
     
    567597        PREINIT:
    568598                char *region;
    569         CODE:
    570                 region = owl_editwin_get_region(owl_global_get_typwin(&g));
     599                owl_editwin *e;
     600        CODE:
     601                e = owl_global_get_typwin(&g);
     602                if (e) {
     603                        region = owl_editwin_get_region(owl_global_get_typwin(&g));
     604                } else {
     605                        region = NULL;
     606                }
    571607                RETVAL = region;
    572608        OUTPUT:
     
    581617        PREINIT:
    582618                int count;
     619                owl_editwin *e;
    583620                owl_editwin_excursion *x;
    584621        CODE:
    585622        {
     623                e = owl_global_get_typwin(&g);
     624                if(!e)
     625                        croak("The edit window is not currently active!");
     626
    586627                x = owl_editwin_begin_excursion(owl_global_get_typwin(&g));
    587628                PUSHMARK(SP);
     
    605646int
    606647current_column()
    607         CODE:
    608                 RETVAL = owl_editwin_current_column(owl_global_get_typwin(&g));
     648        PREINIT:
     649                owl_editwin *e;
     650        CODE:
     651                e = owl_global_get_typwin(&g);
     652                if (e) {
     653                        RETVAL = owl_editwin_current_column(e);
     654                } else {
     655                        RETVAL = 0;
     656                }
    609657        OUTPUT:
    610658                RETVAL
     
    612660int
    613661point()
    614         CODE:
    615                 RETVAL = owl_editwin_get_point(owl_global_get_typwin(&g));
     662        PREINIT:
     663                owl_editwin *e;
     664        CODE:
     665                e = owl_global_get_typwin(&g);
     666                if (e) {
     667                        RETVAL = owl_editwin_get_point(e);
     668                } else {
     669                        RETVAL = 0;
     670                }
    616671        OUTPUT:
    617672                RETVAL
     
    619674int
    620675mark()
    621         CODE:
    622                 RETVAL = owl_editwin_get_mark(owl_global_get_typwin(&g));
    623         OUTPUT:
    624                 RETVAL
     676        PREINIT:
     677                owl_editwin *e;
     678        CODE:
     679                e = owl_global_get_typwin(&g);
     680                if (e) {
     681                        RETVAL = owl_editwin_get_mark(e);
     682                } else {
     683                        RETVAL = 0;
     684                }
     685        OUTPUT:
     686                RETVAL
  • popexec.c

    r4cca591 r125fd21  
    9696  if (!pe->pid && !pe->winactive) {
    9797    owl_select_remove_io_dispatch(d);
     98    pe->dispatch = NULL;
    9899    return;
    99100  }
     
    114115    }
    115116    owl_select_remove_io_dispatch(d);
     117    pe->dispatch = NULL;
    116118    return;
    117119  }
     
    157159
    158160  pe->winactive = 0;
    159   if (pe->dispatch->fd > 0) {
     161  if (pe->dispatch) {
    160162    owl_select_remove_io_dispatch(pe->dispatch);
     163    pe->dispatch = NULL;
    161164  }
    162165  if (pe->pid) {
  • scripts/add-changelog

    r68ab07c r51dbfb5  
    11#!/bin/sh
    22version=$1; shift
     3
     4if [ -z "$version" ] || [ "$#" = 0 ];  then
     5    echo "Usage: $0 VERSION REV-LIST-ARGS" > &2
     6    exit 1;
     7fi
    38
    49(
  • scripts/do-release

    rd771d1b r51dbfb5  
    44    echo "$@" >&2
    55    exit 1
     6}
     7
     8usage() {
     9    cat >&2 <<EOF
     10Usage: %0 [options]
     11Generate a barnowl release tarball.
     12
     13OPTIONS:
     14  -f            Don't require a changelog entry for the new release.
     15  --no-tag      Don't create and sign a git tag for the new release
     16  --git         Do a beta release for the current git revision.
     17EOF
    618}
    719
     
    1527        --no-tag) no_tag=1 ;;
    1628        --git) git=1 ;;
     29        -h|--help) usage ;;
    1730    esac
    1831done
  • scripts/locker-build

    r2b6622a6 r51dbfb5  
    33#########################################################
    44# Build script to build BarnOwl for the locker.
    5 
    6 # Usage: locker-build [-n] [-o OUTPUT-TGZ] SOURCE-TARBALL
    7 # -n is a dry-run, and drops to a shell in the build directory
    8 # -o does the install into a temporary directory and tars it into the
    9 #    specified tarball instead.
    10 # SOURCE-TARBALL is a source tarball, created by do-release
    11 
    125die() {
    136    echo "$@" 2>&1;
     
    2215
    2316usage () {
    24     echo "Usage: $0 [-n] [-o OUTPUT-TGZ] SOURCE-TARBALL"
     17    cat >&2 <<EOF
     18Usage: $0 [-n] [-o OUTPUT-TGZ] SOURCE-TARBALL
     19 -n is a dry-run, and drops to a shell in the build directory
     20 -o does the install into a temporary directory and tars it into the
     21    specified tarball instead.
     22
     23SOURCE-TARBALL is a source tarball, created by do-release.
     24EOF
    2525    exit 2;
    2626}
  • variable.c

    r66a8cd6 r66e409c  
    358358               "normal,top,neartop,center,paged,pagedcenter" ),
    359359
     360  OWLVAR_BOOL( "narrow-related" /* %OwlVarStub:narrow_related */, 1,
     361               "Make smartnarrow use broader filters",
     362               "Causes smartfiler to narrow to messages \"related\" to \n"
     363               "the current message, as well as ones to the same place.\n\n"
     364               "for Zephyr, this controls whether to narrow to e.g. class-help or\n"
     365               "class-help.d alone, or to related-class-help, which includes\n"
     366               "help, unhelp, help.d, etc.\n\nDefault is true (include unclasses, etc.).\n" ),
    360367
    361368  OWLVAR_BOOL( "_followlast" /* %OwlVarStub */, 0,
  • zephyr.c

    rc230bc1 rf25812b  
    12991299}
    13001300
     1301#ifdef HAVE_LIBZEPHYR
     1302void owl_zephyr_process_pseudologin(ZNotice_t *n)
     1303{
     1304  owl_message *m;
     1305  owl_zbuddylist *zbl;
     1306  GList **zaldlist;
     1307  GList *zaldptr;
     1308  ZAsyncLocateData_t *zald = NULL;
     1309  ZLocations_t location;
     1310  int numlocs, ret, notify;
     1311
     1312  /* Find a ZALD to match this notice. */
     1313  zaldlist = owl_global_get_zaldlist(&g);
     1314  zaldptr = g_list_first(*zaldlist);
     1315  while (zaldptr) {
     1316    if (ZCompareALDPred(n, zaldptr->data)) {
     1317      zald = zaldptr->data;
     1318      *zaldlist = g_list_remove(*zaldlist, zaldptr->data);
     1319      break;
     1320    }
     1321    zaldptr = g_list_next(zaldptr);
     1322  }
     1323  if (zald) {
     1324    /* Deal with notice. */
     1325    notify = owl_global_get_pseudologin_notify(&g);
     1326    zbl = owl_global_get_zephyr_buddylist(&g);
     1327    ret = ZParseLocations(n, zald, &numlocs, NULL);
     1328    if (ret == ZERR_NONE) {
     1329      if (numlocs > 0 && !owl_zbuddylist_contains_user(zbl, zald->user)) {
     1330        if (notify) {
     1331          numlocs = 1;
     1332          ret = ZGetLocations(&location, &numlocs);
     1333          if (ret == ZERR_NONE) {
     1334            /* Send a PSEUDO LOGIN! */
     1335            m = owl_malloc(sizeof(owl_message));
     1336            owl_message_create_pseudo_zlogin(m, 0, zald->user,
     1337                                             location.host,
     1338                                             location.time,
     1339                                             location.tty);
     1340            owl_global_messagequeue_addmsg(&g, m);
     1341          }
     1342          owl_zbuddylist_adduser(zbl, zald->user);
     1343          owl_function_debugmsg("owl_function_zephyr_buddy_check: login for %s ", zald->user);
     1344        }
     1345      } else if (numlocs == 0 && owl_zbuddylist_contains_user(zbl, zald->user)) {
     1346        /* Send a PSEUDO LOGOUT! */
     1347        if (notify) {
     1348          m = owl_malloc(sizeof(owl_message));
     1349          owl_message_create_pseudo_zlogin(m, 1, zald->user, "", "", "");
     1350          owl_global_messagequeue_addmsg(&g, m);
     1351        }
     1352        owl_zbuddylist_deluser(zbl, zald->user);
     1353        owl_function_debugmsg("owl_function_zephyr_buddy_check: logout for %s ", zald->user);
     1354      }
     1355    }
     1356    ZFreeALD(zald);
     1357    owl_free(zald);
     1358  }
     1359}
     1360#else
     1361void owl_zephyr_process_pseudologin(void *n)
     1362{
     1363}
     1364#endif
     1365
    13011366/*
    13021367 * Process zephyrgrams from libzephyr's queue. To prevent starvation,
     
    13331398      }
    13341399
     1400      /* if it is a LOCATE message, it's for pseudologins. */
     1401      if (strcmp(notice.z_opcode, LOCATE_LOCATE) == 0) {
     1402        owl_zephyr_process_pseudologin(&notice);
     1403        ZFreeNotice(&notice);
     1404        continue;
     1405      }
     1406
    13351407      /* create the new message */
    13361408      m=owl_malloc(sizeof(owl_message));
Note: See TracChangeset for help on using the changeset viewer.