Changes in / [dec60b4:95414bf]


Ignore:
Files:
1 added
19 deleted
22 edited

Legend:

Unmodified
Added
Removed
  • Makefile.am

    r5aa33fd r5aa33fd  
    11ACLOCAL_AMFLAGS = -I m4
    2 CFLAGS += $(EXTRA_CFLAGS)
    32
    43GIT_DESCRIPTION := $(if $(wildcard .git),$(shell git describe --match='barnowl-*' HEAD 2>/dev/null))
     
    4241     keypress.c keymap.c keybinding.c cmd.c context.c \
    4342     aim.c buddy.c buddylist.c style.c errqueue.c \
    44      zbuddylist.c popexec.c select.c wcwidth.c \
     43     zbuddylist.c popexec.c obarray.c select.c wcwidth.c \
    4544     glib_compat.c filterproc.c
    4645
  • commands.c

    r89ce405 r7ba9e0de  
    106106  OWLCMD_ARGS("zwrite", owl_command_zwrite, OWL_CTX_INTERACTIVE,
    107107              "send a zephyr",
    108               "zwrite [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcode] [<user> ...] [-m <message...>]",
     108              "zwrite [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [<user> ...] [-m <message...>]",
    109109              "Zwrite send a zephyr to the one or more users specified.\n\n"
    110110              "The following options are available:\n\n"
     
    138138  OWLCMD_ARGS("zcrypt", owl_command_zcrypt, OWL_CTX_INTERACTIVE,
    139139              "send an encrypted zephyr",
    140               "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcode] [-m <message...>]\n",
     140              "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [-m <message...>]\n",
    141141              "Behaves like zwrite but uses encryption.  Not for use with\n"
    142142              "personal messages\n"),
     
    148148              "allow editing.\n\n"
    149149              "If 'sender' is specified, reply to the sender.\n\n"
    150               "If 'all' or no args are specified, reply publicly to the\n"
     150              "If 'all' or no args are specified, reply publically to the\n"
    151151              "same class/instance for non-personal messages and to the\n"
    152152              "sender for personal messages.\n\n"
     
    266266              "zpunt <class> <instance> [recipient]\n"
    267267              "zpunt <instance>",
    268               "The zpunt command will suppress messages to the specified\n"
     268              "The zpunt command will supress message to the specified\n"
    269269              "zephyr triplet.  In the second usage messages are suppressed\n"
    270270              "for class MESSAGE and the named instance.\n\n"
     
    283283              "punt <filter-text>",
    284284              "punt <filter-text (multiple words)>\n"
    285               "The punt command will suppress messages to the specified\n"
     285              "The punt command will supress message to the specified\n"
    286286              "filter\n\n"
    287287              "SEE ALSO:  unpunt, zpunt, show zpunts\n"),
     
    586586              "name style after the -s argument.\n"
    587587              "\n"
    588               "The other usages listed above are abbreviated forms that simply set\n"
     588              "The other usages listed above are abbreivated forms that simply set\n"
    589589              "the filter of the current view. The -d option allows you to write a\n"
    590590              "filter expression that will be dynamically created by owl and then\n"
     
    594594  OWLCMD_ARGS("smartnarrow", owl_command_smartnarrow, OWL_CTX_INTERACTIVE,
    595595              "view only messages similar to the current message",
    596               "smartnarrow [-i | --instance]  [-r | --related]",
     596              "smartnarrow [-i | --instance]  [-r | --relatde]",
    597597              "If the curmsg is a personal message narrow\n"
    598598              "   to the conversation with that user.\n"
     
    614614              "   message, the filter is to that instance.\n"
    615615              "If the curmsg is a class message, the filter is that class.\n"
    616               "If the curmsg is a class message and '-i' is specified\n"
     616              "If the curmsg is a class message and '-i' is specied\n"
    617617              "    the filter is to that class and instance.\n"),
    618618
     
    674674              "for formatting messages.\n\n"
    675675              "Show variables will list the names of all variables.\n\n"
    676               "Show errors will show a list of errors encountered by Owl.\n\n"
     676              "Show errors will show a list of errors ecountered by Owl.\n\n"
    677677              "SEE ALSO: filter, view, alias, bindkey, help\n"),
    678678 
     
    743743              "set the search highlight string without searching",
    744744              "setsearch <string>",
    745               "The setsearch command highlights all occurrences of its\n"
     745              "The setsearch command highlights all occurences of its\n"
    746746          "argument and makes it the default argument for future\n"
    747747          "search commands, but does not move the cursor.  With\n"
     
    21842184      argc--;
    21852185      argv++;
     2186    } else if (!strcmp(argv[0], "-r")) {
     2187      const char *foo;
     2188      foo=owl_function_create_negative_filter(owl_view_get_filtname(owl_global_get_current_view(&g)));
     2189      owl_function_change_currentview_filter(foo);
    21862190    } else if (!strcmp(argv[0], "-s")) {
    21872191      if (argc<2) {
  • doc/code.txt

    r44cc9ab r1286893  
    8686             Meta.  At any one time, there is exactly one active
    8787             keymap which determines where keybindings are looked for
    88              (along with its parents).
     88             (along with its submaps).
    8989
    9090list:        Simple list abstraction.  (Uses realloc to resize the list.)
  • functions.c

    r13ebf92 r7ba9e0de  
    19991999    pclose(p);
    20002000   
    2001     if (type == OWL_OUTPUT_RETURN) {
     2001    if (type == OWL_OUTPUT_POPUP) {
     2002      owl_function_popless_text(out);
     2003    } else if (type == OWL_OUTPUT_RETURN) {
    20022004      owl_free(newbuff);
    20032005      return out;
    20042006    } else if (type == OWL_OUTPUT_ADMINMSG) {
    20052007      owl_function_adminmsg(buff, out);
     2008    } else {
     2009      owl_function_popless_text(out);
    20062010    }
    20072011    owl_free(out);
     
    20362040    } else if (type == OWL_OUTPUT_RETURN) {
    20372041      return perlout;
     2042    } else {
     2043      owl_function_popless_text(perlout);
    20382044    }
    20392045    owl_free(perlout);
     
    24992505
    25002506  owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 
    2501 }
    2502 
    2503 static 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;
    25292507}
    25302508
     
    25822560  if (owl_message_is_type_zephyr(m)) {
    25832561    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 
    25882562      if (owl_message_is_direction_in(m)) {
    25892563        zperson=short_zuser(owl_message_get_sender(m));
     
    28792853    km = owl_keyhandler_get_keymap(kh, kmname);
    28802854    owl_fmtext_append_bold(&fm, "\n\n----------------------------------------------------------------------------------------------------\n\n");
    2881     owl_keymap_get_details(km, &fm, 0);
     2855    owl_keymap_get_details(km, &fm);   
    28822856  }
    28832857  owl_fmtext_append_normal(&fm, "\n");
     
    29052879  km = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), name);
    29062880  if (km) {
    2907     owl_keymap_get_details(km, &fm, 1);
     2881    owl_keymap_get_details(km, &fm);
    29082882  } else {
    29092883    owl_fmtext_append_normal(&fm, "No such keymap...\n");
  • global.c

    r68e5464 r04b16f8  
    1818  char *cd;
    1919
     20  g->malloced=0;
     21  g->freed=0;
     22
    2023  gethostname(hostname, MAXHOSTNAMELEN);
    2124  hent=gethostbyname(hostname);
     
    5053  g->filterlist = NULL;
    5154  owl_list_create(&(g->puntlist));
    52   g->messagequeue = g_queue_new();
     55  owl_list_create(&(g->messagequeue));
    5356  owl_dict_create(&(g->styledict));
    5457  g->curmsg_vert_offset=0;
     
    110113  g->pseudologin_notify = 0;
    111114
     115  owl_obarray_init(&(g->obarray));
     116
    112117  owl_message_init_fmtext_cache();
    113118  owl_list_create(&(g->io_dispatch_list));
     
    859864void owl_global_messagequeue_addmsg(owl_global *g, owl_message *m)
    860865{
    861   g_queue_push_tail(g->messagequeue, m);
     866  owl_list_append_element(&(g->messagequeue), m);
    862867}
    863868
     
    870875  owl_message *out;
    871876
    872   if (g_queue_is_empty(g->messagequeue))
    873     return NULL;
    874   out = g_queue_pop_head(g->messagequeue);
    875   return out;
     877  if (owl_list_get_size(&(g->messagequeue))==0) return(NULL);
     878  out=owl_list_get_element(&(g->messagequeue), 0);
     879  owl_list_remove_element(&(g->messagequeue), 0);
     880  return(out);
    876881}
    877882
    878883int owl_global_messagequeue_pending(owl_global *g)
    879884{
    880   return !g_queue_is_empty(g->messagequeue);
     885  if (owl_list_get_size(&(g->messagequeue))==0) return(0);
     886  return(1);
    881887}
    882888
     
    10041010{
    10051011  return(&(g->startup_tio));
     1012}
     1013
     1014const char * owl_global_intern(owl_global *g, const char * string)
     1015{
     1016  return owl_obarray_insert(&(g->obarray), string);
    10061017}
    10071018
  • keymap.c

    r44cc9ab r8a921b5  
    11#include <string.h>
    22#include "owl.h"
    3 
    4 static void _owl_keymap_format_bindings(const owl_keymap *km, owl_fmtext *fm);
    5 static void _owl_keymap_format_with_parents(const owl_keymap *km, owl_fmtext *fm);
    63
    74/* returns 0 on success */
     
    129  if ((km->desc = owl_strdup(desc)) == NULL) return(-1);
    1310  if (0 != owl_list_create(&km->bindings)) return(-1);
    14   km->parent = NULL;
     11  km->submap = NULL;
    1512  km->default_fn = default_fn;
    1613  km->prealways_fn = prealways_fn;
     
    2724}
    2825
    29 void owl_keymap_set_parent(owl_keymap *km, const owl_keymap *parent)
    30 {
    31   km->parent = parent;
     26void owl_keymap_set_submap(owl_keymap *km, const owl_keymap *submap)
     27{
     28  km->submap = submap;
    3229}
    3330
     
    8986
    9087/* Appends details about the keymap to fm */
    91 void owl_keymap_get_details(const owl_keymap *km, owl_fmtext *fm, int recurse)
    92 {
     88void owl_keymap_get_details(const owl_keymap *km, owl_fmtext *fm)
     89{
     90  int i, nbindings;
     91  const owl_keybinding *kb;
     92 
    9393  owl_fmtext_append_bold(fm, "KEYMAP - ");
    9494  owl_fmtext_append_bold(fm, km->name);
     
    9999    owl_fmtext_append_normal(fm, "\n");
    100100  }
    101   if (km->parent) {
    102     owl_fmtext_append_normal(fm, OWL_TABSTR "Has parent: ");
    103     owl_fmtext_append_normal(fm, km->parent->name);
     101  if (km->submap) {
     102    owl_fmtext_append_normal(fm, OWL_TABSTR "Has submap: ");
     103    owl_fmtext_append_normal(fm, km->submap->name);
    104104    owl_fmtext_append_normal(fm, "\n");
    105105  }
     
    119119
    120120  owl_fmtext_append_bold(fm, "\nKey bindings:\n\n"); 
    121   if (recurse) {
    122     _owl_keymap_format_with_parents(km, fm);
    123   } else {
    124     _owl_keymap_format_bindings(km, fm);
    125   }
    126 }
    127 
    128 static void _owl_keymap_format_with_parents(const owl_keymap *km, owl_fmtext *fm)
    129 {
    130   while (km) {
    131     _owl_keymap_format_bindings(km, fm);
    132     km = km->parent;
    133     if (km) {
    134       owl_fmtext_append_bold(fm, "\nInherited from ");
    135       owl_fmtext_append_bold(fm, km->name);
    136       owl_fmtext_append_bold(fm, ":\n\n");
    137     }
    138   }
    139 }
    140 
    141 static void _owl_keymap_format_bindings(const owl_keymap *km, owl_fmtext *fm)
    142 {
    143   int i, nbindings;
    144   const owl_keybinding *kb;
    145  
    146121  nbindings = owl_list_get_size(&km->bindings);
    147122  for (i=0; i<nbindings; i++) {
     
    273248  }
    274249
    275   /* deal with the always_fn for the map and parents */
    276   for (km=kh->active; km; km=km->parent) {
     250  /* deal with the always_fn for the map and submaps */
     251  for (km=kh->active; km; km=km->submap) {
    277252    if (km->prealways_fn) {
    278253      km->prealways_fn(j);
     
    281256
    282257  /* search for a match.  goes through active keymap and then
    283    * through parents... TODO:  clean this up so we can pull
     258   * through submaps... TODO:  clean this up so we can pull
    284259   * keyhandler and keymap apart.  */
    285   for (km=kh->active; km; km=km->parent) {
     260  for (km=kh->active; km; km=km->submap) {
    286261    for (i=owl_list_get_size(&km->bindings)-1; i>=0; i--) {
    287262      kb = owl_list_get_element(&km->bindings, i);
  • keys.c

    r44cc9ab r8a5b5a1  
    3030       "Text editing and command window",
    3131       owl_keys_editwin_default, NULL, owl_keys_editwin_postalways);
    32   owl_keymap_set_parent(km_editwin, km_global);
     32  owl_keymap_set_submap(km_editwin, km_global);
    3333  /*
    3434  BIND_CMD("F1",          "help",            "");
     
    9999       "Multi-line text editing",
    100100       owl_keys_editwin_default, NULL, owl_keys_editwin_postalways);
    101   owl_keymap_set_parent(km_ew_multi, km_editwin);
     101  owl_keymap_set_submap(km_ew_multi, km_editwin);
    102102
    103103  BIND_CMD("UP",      "edit:move-up-line", "");
     
    129129       "Single-line text editing",
    130130       owl_keys_editwin_default, NULL, owl_keys_editwin_postalways);
    131   owl_keymap_set_parent(km_ew_onel, km_editwin);
     131  owl_keymap_set_submap(km_ew_onel, km_editwin);
    132132
    133133  BIND_CMD("C-u",         "edit:delete-all", "Clears the entire line");
     
    154154       "Single-line response to question",
    155155       owl_keys_editwin_default, NULL, owl_keys_editwin_postalways);
    156   owl_keymap_set_parent(km_ew_onel, km_editwin);
     156  owl_keymap_set_submap(km_ew_onel, km_editwin);
    157157
    158158  BIND_CMD("C-u",         "edit:delete-all", "Clears the entire line");
     
    169169       "Pop-up window (eg, help)",
    170170       owl_keys_default_invalid, NULL, owl_keys_popless_postalways);
    171   owl_keymap_set_parent(km_viewwin, km_global);
     171  owl_keymap_set_submap(km_viewwin, km_global);
    172172
    173173  BIND_CMD("SPACE",       "popless:scroll-down-page", "");
     
    222222        "Main window / message list",
    223223        owl_keys_default_invalid, owl_keys_recwin_prealways, NULL);
    224   owl_keymap_set_parent(km_mainwin, km_global);
     224  owl_keymap_set_submap(km_mainwin, km_global);
    225225  BIND_CMD("C-x C-c", "start-command quit", "");
    226226  BIND_CMD("F1",      "help",           "");
  • logging.c

    r839697d r91634ec  
    128128  char filename[MAXPATHLEN], *logpath;
    129129  char *to, *temp;
    130   GList *cc;
    131130
    132131  /* expand ~ in path names */
     
    136135  if (owl_message_is_type_zephyr(m)) {
    137136    /* If this has CC's, do all but the "recipient" which we'll do below */
    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 
     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    }
    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 *temp;
    328     GList *cc;
     327    char *cc, *temp;
    329328    cc = owl_message_get_cc_without_recipient(m);
    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);
     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, " ");
    335338      }
    336 
    337       owl_free(cc->data);
    338       cc = g_list_delete_link(cc, cc);
     339      owl_free(cc);
    339340    }
    340341  }
  • message.c

    rc314f39 r9a7b4f2  
    6161  owl_pair *p = NULL, *pair = NULL;
    6262
    63   attrname = g_intern_string(attrname);
    64 
    6563  /* look for an existing pair with this key, */
    6664  j=owl_list_get_size(&(m->attributes));
    6765  for (i=0; i<j; i++) {
    6866    p=owl_list_get_element(&(m->attributes), i);
    69     if (owl_pair_get_key(p) == attrname) {
     67    if (!strcmp(owl_pair_get_key(p), attrname)) {
    7068      owl_free(owl_pair_get_value(p));
    7169      pair = p;
     
    7674  if(pair ==  NULL) {
    7775    pair = owl_malloc(sizeof(owl_pair));
    78     owl_pair_create(pair, attrname, NULL);
     76    owl_pair_create(pair, owl_global_intern(&g, attrname), NULL);
    7977    owl_list_append_element(&(m->attributes), pair);
    8078  }
     
    8987  int i, j;
    9088  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);
    9889
    9990  j=owl_list_get_size(&(m->attributes));
    10091  for (i=0; i<j; i++) {
    10192    p=owl_list_get_element(&(m->attributes), i);
    102     if (owl_pair_get_key(p) == attrname) {
     93    if (!strcmp(owl_pair_get_key(p), attrname)) {
    10394      return(owl_pair_get_value(p));
    10495    }
     
    505496void owl_message_set_hostname(owl_message *m, const char *hostname)
    506497{
    507   m->hostname = g_intern_string(hostname);
     498  m->hostname=owl_global_intern(&g, hostname);
    508499}
    509500
     
    593584
    594585/* caller must free return value */
    595 GList *owl_message_get_cc_without_recipient(const owl_message *m)
    596 {
    597   char *cc, *shortuser, *recip;
     586char *owl_message_get_cc_without_recipient(const owl_message *m)
     587{
     588  char *cc, *out, *end, *shortuser, *recip;
    598589  const char *user;
    599   GList *out = NULL;
    600590
    601591  cc = owl_message_get_cc(m);
     
    604594
    605595  recip = short_zuser(owl_message_get_recipient(m));
     596  out = owl_malloc(strlen(cc) + 2);
     597  end = out;
    606598
    607599  user = strtok(cc, " ");
     
    609601    shortuser = short_zuser(user);
    610602    if (strcasecmp(shortuser, recip) != 0) {
    611       out = g_list_prepend(out, owl_strdup(user));
     603      strcpy(end, user);
     604      end[strlen(user)] = ' ';
     605      end += strlen(user) + 1;
    612606    }
    613607    owl_free(shortuser);
    614608    user = strtok(NULL, " ");
    615609  }
     610  end[0] = '\0';
    616611
    617612  owl_free(recip);
    618613  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 
    736 void 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   }
    769734}
    770735
     
    904869    }
    905870  }
    906 
    907   owl_message_save_ccs(m);
    908871}
    909872#else
     
    1000963    owl_message_set_isprivate(m);
    1001964  }
    1002 
    1003   owl_message_save_ccs(m);
    1004965}
    1005966
  • owl.c

    r04b16f8 r04b16f8  
    589589  owl_global_push_context(&g, OWL_CTX_READCONFIG|OWL_CTX_RECV, NULL, "recv");
    590590
     591  /* If we ever deprecate the mainloop hook, remove this. */
     592  owl_select_add_timer(0, 1, owl_perlconfig_mainloop, NULL, NULL);
     593
    591594  owl_select_add_pre_select_action(owl_refresh_pre_select_action, NULL, NULL);
    592595  owl_select_add_pre_select_action(owl_process_messages, NULL, NULL);
  • owl.h

    r68e5464 r7ba9e0de  
    476476  char     *desc;               /* description */
    477477  owl_list  bindings;           /* key bindings */
    478   const struct _owl_keymap *parent;     /* parent */
     478  const struct _owl_keymap *submap;     /* submap */
    479479  void (*default_fn)(owl_input j);      /* default action (takes a keypress) */
    480480  void (*prealways_fn)(owl_input  j);   /* always called before a keypress is received */
     
    521521  short **pairs;
    522522} owl_colorpair_mgr;
     523
     524typedef struct _owl_obarray {
     525  owl_list strings;
     526} owl_obarray;
    523527
    524528typedef struct _owl_io_dispatch {
     
    595599  owl_colorpair_mgr cpmgr;
    596600  pid_t newmsgproc_pid;
     601  int malloced, freed;
    597602  owl_regex search_re;
    598603  aim_session_t aimsess;
     
    605610  char *aim_screenname_for_filters;     /* currently logged in AIM screen name */
    606611  owl_buddylist buddylist;  /* list of logged in AIM buddies */
    607   GQueue *messagequeue;     /* for queueing up aim and other messages */
     612  owl_list messagequeue;    /* for queueing up aim and other messages */
    608613  owl_dict styledict;       /* global dictionary of available styles */
    609614  char *response;           /* response to the last question asked */
     
    618623  int pseudologin_notify;
    619624  struct termios startup_tio;
     625  owl_obarray obarray;
    620626  owl_list io_dispatch_list;
    621627  owl_list psa_list;
  • perl/lib/BarnOwl/Hooks.pm

    r3aa0522 rb30c256  
    7979our %EXPORT_TAGS = (all => [@EXPORT_OK]);
    8080
    81 use BarnOwl::MainLoopCompatHook;
    82 
    8381our $startup = BarnOwl::Hook->new;
    8482our $shutdown = BarnOwl::Hook->new;
    8583our $receiveMessage = BarnOwl::Hook->new;
    8684our $newMessage = BarnOwl::Hook->new;
    87 our $mainLoop = BarnOwl::MainLoopCompatHook->new;
     85our $mainLoop = BarnOwl::Hook->new;
    8886our $getBuddyList = BarnOwl::Hook->new;
    8987our $getQuickstart = BarnOwl::Hook->new;
     
    164162    }
    165163   
    166     $mainLoop->check_owlconf();
    167164    $startup->run(0);
    168165    BarnOwl::startup() if *BarnOwl::startup{CODE};
     
    189186   
    190187    BarnOwl::new_msg($m) if *BarnOwl::new_msg{CODE};
     188}
     189
     190sub _mainloop_hook {
     191    $mainLoop->run;
     192    BarnOwl::mainloop_hook() if *BarnOwl::mainloop_hook{CODE};
    191193}
    192194
  • perl/lib/BarnOwl/Message/Generic.pm

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

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

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

    r2f25537 rc854e74  
    2020sub to { shift->{to} };
    2121sub room { shift->{room} };
    22 sub nick { shift->{nick} };
    2322sub subject { shift->{subject} };
    2423sub status { shift->{status} }
     
    4241sub long_sender {
    4342    my $self = shift;
    44     if ($self->jtype eq 'groupchat' && $self->nick) {
    45         my $from_jid = Net::Jabber::JID->new($self->from);
    46         if ($from_jid->GetJID('base') eq $self->room &&
    47             $from_jid->GetResource() eq $self->nick) {
    48             return $self->nick;
    49         }
    50     }
    5143    return $self->from;
    5244}
     
    8577    } elsif ($self->jtype eq 'groupchat') {
    8678        my $room = $self->room;
    87         if ($inst) {
    88             my $subject = $self->subject;
    89             $filter = "jabber-room-$room-subject-$subject";
    90             BarnOwl::command(qw[filter], $filter,
    91                              qw[type ^jabber$ and room], "^\Q$room\E\$",
    92                              qw[and subject], "^\Q$subject\E\$");
    93         } else {
    94             $filter = "jabber-room-$room";
    95             BarnOwl::command(qw[filter], $filter,
    96                              qw[type ^jabber$ and room], "^\Q$room\E\$");
    97         }
     79        $filter = "jabber-room-$room";
     80        BarnOwl::command(qw[filter], $filter,
     81                         qw[type ^jabber$ and room], "^\Q$room\E\$");
    9882        return $filter;
    9983    } elsif ($self->login ne 'none') {
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    r2f25537 r8789410  
    285285        {
    286286            summary => "Send a Jabber Message",
    287             usage   => "jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>] [-m <message>]"
     287            usage   => "jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]"
    288288        }
    289289    );
     
    308308            description => "jmuc sends Jabber commands related to MUC.\n\n"
    309309              . "The following commands are available\n\n"
    310               . "join <muc>[/<nick>]\n"
    311               . "            Join a MUC (with a given nickname, or otherwise your JID).\n\n"
     310              . "join <muc>  Join a MUC.\n\n"
    312311              . "part <muc>  Part a MUC.\n"
    313312              . "            The MUC is taken from the current message if not supplied.\n\n"
     
    378377        my $cjidStr = $conn->baseJIDExists($jidStr);
    379378        if ($cjidStr) {
    380             die("Already logged in as $cjidStr.\n");
     379            BarnOwl::error("Already logged in as $cjidStr.");
     380            return;
    381381        }
    382382    }
     
    387387
    388388    if ( !$uid || !$componentname ) {
    389         die("usage: $cmd JID\n");
     389        BarnOwl::error("usage: $cmd JID");
     390        return;
    390391    }
    391392
    392393    if ( $conn->jidActive($jidStr) ) {
    393         die("Already logged in as $jidStr.\n");
     394        BarnOwl::error("Already logged in as $jidStr.");
     395        return;
    394396    } elsif ($conn->jidExists($jidStr)) {
    395397        return $conn->tryReconnect($jidStr, 1);
     
    524526sub cmd_jlist {
    525527    if ( !( scalar $conn->getJIDs() ) ) {
    526         die("You are not logged in to Jabber.\n");
     528        BarnOwl::error("You are not logged in to Jabber.");
     529        return;
    527530    }
    528531    BarnOwl::popless_ztext( onGetBuddyList() );
     
    531534sub cmd_jwrite {
    532535    if ( !$conn->connected() ) {
    533         die("You are not logged in to Jabber.\n");
     536        BarnOwl::error("You are not logged in to Jabber.");
     537        return;
    534538    }
    535539
     
    539543    my $jwrite_thread  = "";
    540544    my $jwrite_subject = "";
    541     my $jwrite_body;
    542545    my ($to, $from);
    543546    my $jwrite_type    = "chat";
     
    551554        'subject=s' => \$jwrite_subject,
    552555        'account=s' => \$from,
    553         'id=s'      => \$jwrite_sid,
    554         'message=s' => \$jwrite_body,
     556        'id=s'     =>  \$jwrite_sid,
    555557    ) or die("Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]\n");
    556558    $jwrite_type = 'groupchat' if $gc;
    557559
    558560    if ( scalar @ARGV != 1 ) {
    559         die("Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]\n");
     561        BarnOwl::error(
     562            "Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]");
     563        return;
    560564    }
    561565    else {
     
    566570
    567571    unless(scalar @candidates) {
    568         die("Unable to resolve JID $to\n");
     572        die("Unable to resolve JID $to");
    569573    }
    570574
     
    573577    unless(scalar @candidates) {
    574578        if(!$from) {
    575             die("You must specify an account with -a\n");
     579            die("You must specify an account with -a");
    576580        } else {
    577             die("Unable to resolve account $from\n");
     581            die("Unable to resolve account $from");
    578582        }
    579583    }
     
    590594        type    => $jwrite_type
    591595    };
    592 
    593     if (defined($jwrite_body)) {
    594         process_owl_jwrite($jwrite_body);
    595         return;
    596     }
    597596
    598597    if(scalar @candidates > 1) {
     
    632631    my $func = $jmuc_commands{$cmd};
    633632    if ( !$func ) {
    634         die("jmuc: Unknown command: $cmd\n");
     633        BarnOwl::error("jmuc: Unknown command: $cmd");
     634        return;
    635635    }
    636636
     
    654654        }
    655655        else {
    656             die("You must specify an account with -a <jid>\n");
     656            BarnOwl::error('You must specify an account with -a <jid>');
    657657        }
    658658        return $func->( $jid, $muc, @ARGV );
     
    667667
    668668    $muc = shift @ARGV
    669       or die("Usage: jmuc join <muc> [-p <password>] [-a <account>]\n");
     669      or die("Usage: jmuc join <muc> [-p <password>] [-a <account>]");
    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->GetJID('base')} = 1;
     682    $completion_jids{$muc} = 1;
    683683    return;
    684684}
     
    688688
    689689    $muc = shift @args if scalar @args;
    690     die("Usage: jmuc part [<muc>] [-a <account>]\n") unless $muc;
     690    die("Usage: jmuc part [<muc>] [-a <account>]") 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\n");
     695        die("Error: Not joined to $muc");
    696696    }
    697697}
     
    703703    $muc = shift @args if scalar @args;
    704704
    705     die("Usage: jmuc invite <jid> [<muc>] [-a <account>]\n")
     705    die('Usage: jmuc invite <jid> [<muc>] [-a <account>]')
    706706      unless $muc && $invite_jid;
    707707
     
    718718    my ( $jid, $muc, @args ) = @_;
    719719    $muc = shift @args if scalar @args;
    720     die("Usage: jmuc configure [<muc>]\n") unless $muc;
     720    die("Usage: jmuc configure [<muc>]") 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>]\n") unless $muc;
     761    die("Usage: jmuc presence [<muc>]") 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\n") unless $m;
     776        die("No such muc: $muc") unless $m;
    777777        BarnOwl::popless_ztext(jmuc_presence_single($m));
    778778    }
     
    801801    my $func = $jroster_commands{$cmd};
    802802    if ( !$func ) {
    803         die("jroster: Unknown command: $cmd\n");
     803        BarnOwl::error("jroster: Unknown command: $cmd");
     804        return;
    804805    }
    805806
     
    824825        }
    825826        else {
    826             die("You must specify an account with -a <jid>\n");
     827            BarnOwl::error('You must specify an account with -a <jid>');
    827828        }
    828829        return $func->( $jid, $name, \@groups, $purgeGroups,  @ARGV );
     
    848849    }
    849850    else {
    850         die("You must specify an account with -a <jid>\n");
     851        BarnOwl::error('You must specify an account with -a <jid>');
    851852    }
    852853
     
    12331234        $completion_jids{$room} = 1;
    12341235
    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) || $props{from};
    12441236        $props{sender} = $nick || $room;
    12451237        $props{recipient} = $room;
     
    13391331        return $givenJIDStr if ($conn->jidExists($givenJIDStr) );
    13401332        return resolveConnectedJID($givenJID->GetJID('base')) if $loose;
    1341         die("Invalid account: $givenJIDStr\n");
     1333        die("Invalid account: $givenJIDStr");
    13421334    }
    13431335
     
    13921384        # Not one of ours.
    13931385        else {
    1394             die("Invalid account: $givenJIDStr\n");
     1386            die("Invalid account: $givenJIDStr");
    13951387        }
    13961388
     
    14381430    if($from) {
    14391431        $from_jid = resolveConnectedJID($from, 1);
    1440         die("Unable to resolve account $from\n") unless $from_jid;
     1432        die("Unable to resolve account $from") unless $from_jid;
    14411433        $to_jid = resolveDestJID($to, $from_jid);
    14421434        push @matches, [$from_jid, $to_jid] if $to_jid;
  • perl/modules/Makefile.am

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

    r5aa33fd r5aa33fd  
    584584}
    585585
     586void owl_perlconfig_mainloop(owl_timer *t, void *data)
     587{
     588  dSP;
     589  if (!owl_perlconfig_is_function("BarnOwl::Hooks::_mainloop_hook"))
     590    return;
     591  PUSHMARK(SP) ;
     592  call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
     593  if(SvTRUE(ERRSV)) {
     594    owl_function_error("%s", SvPV_nolen(ERRSV));
     595  }
     596  return;
     597}
     598
    586599void owl_perlconfig_io_dispatch(const owl_io_dispatch *d, void *data)
    587600{
  • tester.c

    r95414bf r95414bf  
    105105  numfailures += owl_variable_regtest();
    106106  numfailures += owl_filter_regtest();
     107  numfailures += owl_obarray_regtest();
    107108  numfailures += owl_editwin_regtest();
    108109  if (numfailures) {
     
    367368}
    368369
     370
     371int owl_obarray_regtest(void) {
     372  int numfailed = 0;
     373  const char *p,*p2;
     374
     375  owl_obarray oa;
     376  owl_obarray_init(&oa);
     377
     378  printf("# BEGIN testing owl_obarray\n");
     379
     380  p = owl_obarray_insert(&oa, "test");
     381  FAIL_UNLESS("returned string is equal", p && !strcmp(p, "test"));
     382  p2 = owl_obarray_insert(&oa, "test");
     383  FAIL_UNLESS("returned string is equal", p2 && !strcmp(p2, "test"));
     384  FAIL_UNLESS("returned the same string", p2 && p == p2);
     385
     386  p = owl_obarray_insert(&oa, "test2");
     387  FAIL_UNLESS("returned string is equal", p && !strcmp(p, "test2"));
     388  p2 = owl_obarray_find(&oa, "test2");
     389  FAIL_UNLESS("returned the same string", p2 && !strcmp(p2, "test2"));
     390
     391  p = owl_obarray_find(&oa, "nothere");
     392  FAIL_UNLESS("Didn't find a string that isn't there", p == NULL);
     393
     394  printf("# END testing owl_obarray (%d failures)\n", numfailed);
     395
     396  return numfailed;
     397}
     398
    369399int owl_editwin_regtest(void) {
    370400  int numfailed = 0;
  • variable.c

    rd544237 r3687413  
    110110
    111111  OWLVAR_ENUM( "loggingdirection" /* %OwlVarStub */, OWL_LOGGING_DIRECTION_BOTH,
    112                "specifies which kind of messages should be logged",
     112               "specifices 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 will be created\n",
     140                    "logout message, a pseudo login or logout message wil 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 mechanism from the other logging\n"
     153                 "This is a completely separate mechanisim 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 receives new\n"
     200               "The named program will be run when owl recevies 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                  "described in the documentation for the 'zsig' variable.\n"),
     215                 "descripted in the documentation for the 'zsig' variable.\n"),
    216216
    217217  OWLVAR_STRING( "zsig" /* %OwlVarStub */, "",
     
    297297              "number of seconds after AIM login to ignore login messages",
    298298              "This specifies the number of seconds to wait after an\n"
    299               "AIM login before allowing the receipt of AIM login notifications.\n"
     299              "AIM login before allowing the recipt of AIM login notifications.\n"
    300300              "By default this is set to 15.  If you would like to view login\n"
    301301              "notifications of buddies as soon as you login, set it to 0 instead."),
  • zephyr.c

    r922f589 r3687413  
    258258
    259259  if (stat(subsfile, &statbuff) != 0) {
    260     owl_free(subsfile);
    261260    if (error_on_nofile == 1)
    262261      return -1;
     
    374373  subsfile = owl_zephyr_dotfile(".anyone", filename);
    375374
    376   if (stat(subsfile, &statbuff) == -1) {
    377     owl_free(subsfile);
     375  if (stat(subsfile, &statbuff) == -1)
    378376    return 0;
    379   }
    380377
    381378  ZResetAuthentication();
Note: See TracChangeset for help on using the changeset viewer.