Changeset 098376e


Ignore:
Timestamp:
Jan 24, 2009, 8:53:45 PM (11 years ago)
Author:
Evan Broder <broder@mit.edu>
Children:
92f8fc2
Parents:
209ea94 (diff), b940b91 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge commit 'barnowl-1.0.4.1' into debian
Files:
12 added
33 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r43a306c rb940b91  
     11.0.4
     2 * Added a ':show quickstart' command. -geofft
     3 * Allow filters that reference a sub filter more than once non-cyclically. -nelhage
     4 * Make 'version' return 'BarnOwl' not 'Owl'
     5 * Escape interpolated regexes in filters. -andersk
     6 * Various code cleanups. -andersk
     7 * Fix format string injection bugs. -andersk
     8 * Clean up various code warnings. -nelhage
     9 * Replace questionable sprintf(buf, "%s...", buf, ...) pattern. -andersk
     10 * Show IRC /me messages with the conventional * instead of bold. -andersk
     11 * Rip out the openurl function and webbrowser variable. -andersk
     12
    1131.0.3
    214 * Moved BarnOwl source control to git on github.
  • Makefile.in

    r3e9485d r098376e  
    55prefix = @prefix@
    66exec_prefix = @exec_prefix@
     7datarootdir = @datarootdir@
    78datadir = @datadir@/barnowl
    89bindir = @bindir@
     
    5354        $(ATHSTATIC) $(CC) -o $(EXE) owl.o $(OBJS) $(LDFLAGS) $(LIBS)
    5455
    55 tester: $(AUTOGEN) $(OBJS) tester.o
     56tester: $(AUTOGEN) $(OBJS) tester.o libfaim
    5657        $(ATHSTATIC) $(CC) -o tester tester.o $(OBJS) $(LDFLAGS) $(LIBS)
    5758
  • aim.c

    rdb0ac7e r554a2b8  
    239239{
    240240  if (message) {
    241     owl_function_error(message);
     241    owl_function_error("%s", message);
    242242  } else {
    243243    owl_function_error("Authentication error on login");
     
    252252  int ret;
    253253
    254   ret=aim_im_sendch1(owl_global_get_aimsess(&g), to, NULL, msg);
     254  ret=aim_im_sendch1(owl_global_get_aimsess(&g), to, 0, msg);
    255255   
    256256  /* I don't know how to check for an error yet */
     
    16981698 
    16991699  /* printf("snac threw error (reason 0x%04x: %s)\n", reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */
    1700   if (reason<msgerrreasonslen) owl_function_error(msgerrreasons[reason]);
     1700  if (reason<msgerrreasonslen) owl_function_error("%s", msgerrreasons[reason]);
    17011701 
    17021702  return 1;
     
    17151715 
    17161716  /* printf("message to %s bounced (reason 0x%04x: %s)\n", destsn, reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */
    1717   if (reason<msgerrreasonslen) owl_function_error(msgerrreasons[reason]);
     1717  if (reason<msgerrreasonslen) owl_function_error("%s", msgerrreasons[reason]);
    17181718
    17191719  if (reason==4) {
     
    17361736 
    17371737  /* printf("user information for %s unavailable (reason 0x%04x: %s)\n", destsn, reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */
    1738   if (reason<msgerrreasonslen) owl_function_error(msgerrreasons[reason]);
     1738  if (reason<msgerrreasonslen) owl_function_error("%s", msgerrreasons[reason]);
    17391739 
    17401740  return 1;
     
    23092309  aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie);
    23102310  return;       
     2311}
     2312
     2313void owl_process_aim()
     2314{
     2315  if (owl_global_is_doaimevents(&g)) {
     2316    owl_aim_process_events();
     2317
     2318    if (owl_global_is_aimloggedin(&g)) {
     2319      if (owl_timer_is_expired(owl_global_get_aim_buddyinfo_timer(&g))) {
     2320        /* owl_buddylist_request_idletimes(owl_global_get_buddylist(&g)); */
     2321        owl_timer_reset(owl_global_get_aim_buddyinfo_timer(&g));
     2322      }
     2323    }
     2324  }
    23112325}
    23122326
  • commands.c

    r451db9e r9b70dd4  
    453453  OWLCMD_VOID("pop-message", owl_command_pop_message, OWL_CTX_RECWIN,
    454454              "pops up a message in a window", "", ""),
    455 
    456   OWLCMD_VOID("openurl", owl_command_openurl, OWL_CTX_INTERACTIVE,
    457               "opens up a URL from the current message",
    458               "",
    459               "Uses the 'webbrowser' variable to determine\n"
    460               "which browser to use.  Currently, 'netscape'\n"
    461               "and 'galeon' are supported.\n"),
    462455
    463456  OWLCMD_ARGS("zaway", owl_command_zaway, OWL_CTX_INTERACTIVE,
     
    641634              "show keymap <keymap>\n"
    642635              "show license\n"
     636              "show quickstart\n"
    643637              "show startup\n"
    644638              "show status\n"
     
    10461040void owl_command_version()
    10471041{
    1048   char buff[1024];
    1049 
    1050   sprintf(buff, "Owl version %s", OWL_VERSION_STRING);
    1051   owl_function_makemsg(buff);
     1042  owl_function_makemsg("BarnOwl version %s", OWL_VERSION_STRING);
    10521043}
    10531044
     
    14611452    owl_function_aaway_on();
    14621453    owl_function_zaway_on();
    1463     owl_function_makemsg("Away messages set.", owl_global_get_aaway_msg_default(&g));
     1454    owl_function_makemsg("Away messages set.");
    14641455    return NULL;
    14651456  }
     
    16911682  }
    16921683
    1693   owl_function_debugmsg(argv[1]);
     1684  owl_function_debugmsg("%s", argv[1]);
    16941685  return(NULL);
    16951686}
     
    22072198  } else if (!strcmp(argv[1], "license")) {
    22082199    owl_function_show_license();
     2200  } else if (!strcmp(argv[1], "quickstart")) {
     2201    owl_function_show_quickstart();
    22092202  } else if (!strcmp(argv[1], "startup")) {
    22102203    char *filename;
     
    22512244{
    22522245  owl_function_curmsg_to_popwin();
    2253 }
    2254 
    2255 void owl_command_openurl(void)
    2256 {
    2257   owl_function_openurl();
    22582246}
    22592247
     
    25802568{
    25812569    buff = skiptokens(buff, 1);
    2582     owl_function_error(buff);
     2570    owl_function_error("%s", buff);
    25832571    return NULL;
    25842572}
     
    25872575{
    25882576    buff = skiptokens(buff, 1);
    2589     owl_function_makemsg(buff);
     2577    owl_function_makemsg("%s", buff);
    25902578    return NULL;
    25912579}
  • examples/owlconf.erik

    r5d9c664 r160d3f4  
    147147    owl::command("set -q rxping on");
    148148    owl::command("set -q typewinsize 5");
    149     if ($ENV{"DISPLAY"} eq ":0.0") {
    150       owl::command("set -q webbrowser galeon");
    151     }
    152149    owl::command("filter me recipient %me% or ( sender %me% and class message and instance personal ) or class mail or type aim");
    153150    owl::command("filter owl instance ^owl.*");
  • examples/owlconf.simple

    r2b14303 r160d3f4  
    9393    # owl::command('set -q view_home all');
    9494
    95 
    96     ## Which webbrowser to use to launch URLs with the 'w' key.
    97     # owl::command('set -q webbrowser netscape');
    98     # owl::command('set -q webbrowser galeon');
    99     # owl::command('set -q webbrowser none');
    10095
    10196    ## Default message to send when zaway is on (toggle with 'A')
  • filter.c

    rcdc6ff1 r9711a6e  
    33
    44static const char fileIdent[] = "$Id$";
    5 
    6 #define OWL_FILTER_MAXRECURSE 20
    75
    86int owl_filter_init_fromstring(owl_filter *f, char *name, char *string)
     
    5048  /* Now check for recursion. */
    5149  if (owl_filter_is_toodeep(f)) {
    52     owl_function_error("Filter loop or exceeds recursion depth");
     50    owl_function_error("Filter loop!");
    5351    owl_filter_free(f);
    5452    return(-1);
     
    313311  int numfailed=0;
    314312  owl_message m;
    315   owl_filter f1, f2, f3, f4;
     313  owl_filter f1, f2, f3, f4, f5;
    316314
    317315  owl_list_create(&(g.filterlist));
     
    365363  FAIL_UNLESS("mutual recursion",   owl_filter_init_fromstring(&f4, "f4", "filter f3"));
    366364
     365  /* support referencing a filter several times */
     366  FAIL_UNLESS("DAG", !owl_filter_init_fromstring(&f5, "dag", "filter f1 or filter f1"));
     367
    367368  return 0;
    368369}
  • filterelement.c

    r0504f63 rf446454  
    279279}
    280280
     281static int fe_visiting = 0;
     282static int fe_visited  = 1;
     283
    281284int owl_filterelement_is_toodeep(owl_filter *f, owl_filterelement *fe)
    282285{
    283   int one = 1;
    284   owl_list nodes;
     286  int rv;
    285287  owl_dict filters;
    286   owl_list_create(&nodes);
    287288  owl_dict_create(&filters);
    288  
    289   owl_list_append_element(&nodes, fe);
    290   owl_dict_insert_element(&filters, f->name, &one, NULL);
    291   while(owl_list_get_size(&nodes)) {
    292     fe = owl_list_get_element(&nodes, 0);
    293     owl_list_remove_element(&nodes, 0);
    294     if(fe->left) owl_list_append_element(&nodes, fe->left);
    295     if(fe->right) owl_list_append_element(&nodes, fe->right);
    296     if(fe->match_message == owl_filterelement_match_filter) {
    297       if(owl_dict_find_element(&filters, fe->field)) return 1;
    298       owl_dict_insert_element(&filters, fe->field, &one, NULL);
     289
     290  owl_dict_insert_element(&filters, f->name, &fe_visiting, owl_dict_noop_free);
     291
     292  rv = _owl_filterelement_is_toodeep(fe, &filters);
     293
     294  owl_dict_free_simple(&filters);
     295  return rv;
     296}
     297
     298int _owl_filterelement_is_toodeep(owl_filterelement *fe, owl_dict *seen)
     299{
     300  int rv = 0;
     301  owl_filter *f;
     302
     303  if(fe->match_message == owl_filterelement_match_filter) {
     304    int *nval = owl_dict_find_element(seen, fe->field);
     305    if(nval == &fe_visiting) {
     306      return 1;
     307    } else if (nval == NULL) {
    299308      f = owl_global_get_filter(&g, fe->field);
    300       if(f) owl_list_append_element(&nodes, f->root);
     309      owl_dict_insert_element(seen, fe->field, &fe_visiting, owl_dict_noop_free);
     310      if(f) rv = _owl_filterelement_is_toodeep(f->root, seen);
     311      owl_dict_insert_element(seen, fe->field, &fe_visited, owl_dict_noop_free);
    301312    }
    302   }
    303 
    304   owl_list_free_simple(&nodes);
    305   owl_dict_free_simple(&filters);
    306   return 0;
     313  } else {
     314    if(fe->left)
     315      rv = rv || _owl_filterelement_is_toodeep(fe->left, seen);
     316    if(fe->right)
     317      rv = rv || _owl_filterelement_is_toodeep(fe->right, seen);
     318  }
     319  return rv;
    307320}
    308321
  • fmtext.c

    r6f6330b r2aaca94  
    763763 * If format_fn is specified, passes it the list element value
    764764 * and it will return a string which this needs to free. */
    765 void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(void*))
     765void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(char *))
    766766{
    767767  int i, size;
    768   void *elem;
     768  char *elem;
    769769  char *text;
    770770
  • functions.c

    r3f3ee61 r9b70dd4  
    9999}
    100100
    101 char *owl_function_style_describe(void *name) {
     101char *owl_function_style_describe(char *name) {
    102102  char *desc, *s;
    103103  owl_style *style;
     
    114114}
    115115
    116 char *owl_function_cmd_describe(void *name)
     116char *owl_function_cmd_describe(char *name)
    117117{
    118118  owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
     
    172172}
    173173
     174void owl_function_show_quickstart()
     175{
     176    char *message =
     177    "Move between messages with the arrow keys, and press 'r' to reply.\n"
     178    "For more info, press 'h' or visit http://barnowl.mit.edu/\n\n"
     179#ifdef HAVE_LIBZEPHYR
     180    "@b(Zephyr:)\n"
     181    "To send a message to a user, type ':zwrite @b(username)'. You can also\n"
     182    "press 'z' and then type the username. To subscribe to a class, type\n"
     183    "':sub @b(class)', and then type ':zwrite -c @b(class)' to send.\n\n"
     184#endif
     185    "@b(AIM:)\n"
     186    "Log in to AIM with ':aimlogin @b(screenname)'. Use ':aimwrite @b(screenname)',\n"
     187    "or 'a' and then the screen name, to send someone a message.\n\n"
     188    ;
     189
     190    if (owl_perlconfig_is_function("BarnOwl::Hooks::_get_quickstart")) {
     191        char *perlquickstart = owl_perlconfig_execute("BarnOwl::Hooks::_get_quickstart()");
     192        if (perlquickstart) {
     193            char *result = owl_sprintf("%s%s", message, perlquickstart);
     194            owl_function_adminmsg("BarnOwl Quickstart", result);
     195            owl_free(result);
     196            owl_free(perlquickstart);
     197            return;
     198        }
     199    }
     200    owl_function_adminmsg("BarnOwl Quickstart", message);
     201}
     202
     203
    174204/* Create an admin message, append it to the global list of messages
    175205 * and redisplay if necessary.
     
    602632
    603633  if (!found) {
    604     owl_function_makemsg("already at last%s message%s%s",
     634    owl_function_makemsg("already at last%s message%s%s%s",
    605635                         skip_deleted?" non-deleted":"",
    606                          filter?" in ":"", filter?filter:"");
     636                         filter?" in ":"", filter?filter:"",
     637                         owl_mainwin_is_curmsg_truncated(owl_global_get_mainwin(&g)) ?
     638                         ", press Enter to scroll" : "");
    607639    /* if (!skip_deleted) owl_function_beep(); */
    608640  }
     
    10191051  owl_function_debugmsg("Quitting Owl");
    10201052  exit(0);
    1021 }
    1022 
    1023 void owl_function_openurl()
    1024 {
    1025   /* visit the first url in the current message */
    1026   owl_message *m;
    1027   owl_view *v;
    1028   char *ptr1, *ptr2, *text, url[LINE], tmpbuff[LINE];
    1029   int webbrowser;
    1030 
    1031   webbrowser = owl_global_get_webbrowser(&g);
    1032 
    1033   if (webbrowser < 0 || webbrowser == OWL_WEBBROWSER_NONE) {
    1034     owl_function_error("No browser selected");
    1035     return;
    1036   }
    1037 
    1038   v=owl_global_get_current_view(&g);
    1039  
    1040   m=owl_view_get_element(v, owl_global_get_curmsg(&g));
    1041 
    1042   if (!m || owl_view_get_size(v)==0) {
    1043     owl_function_error("No current message selected");
    1044     return;
    1045   }
    1046 
    1047   text=owl_message_get_text(m);
    1048 
    1049   /* First look for a good URL */ 
    1050   if ((ptr1=strstr(text, "http://"))!=NULL) {
    1051     ptr2=strpbrk(ptr1, " \n\t");
    1052     if (ptr2) {
    1053       strncpy(url, ptr1, ptr2-ptr1+1);
    1054       url[ptr2-ptr1+1]='\0';
    1055     } else {
    1056       strcpy(url, ptr1);
    1057     }
    1058 
    1059     /* if we had <http strip a trailing > */
    1060     if (ptr1>text && ptr1[-1]=='<') {
    1061       if (url[strlen(url)-1]=='>') {
    1062         url[strlen(url)-1]='\0';
    1063       }
    1064     }
    1065   } else if ((ptr1=strstr(text, "https://"))!=NULL) {
    1066     /* Look for an https URL */ 
    1067     ptr2=strpbrk(ptr1, " \n\t");
    1068     if (ptr2) {
    1069       strncpy(url, ptr1, ptr2-ptr1+1);
    1070       url[ptr2-ptr1+1]='\0';
    1071     } else {
    1072       strcpy(url, ptr1);
    1073     }
    1074    
    1075     /* if we had <http strip a trailing > */
    1076     if (ptr1>text && ptr1[-1]=='<') {
    1077       if (url[strlen(url)-1]=='>') {
    1078         url[strlen(url)-1]='\0';
    1079       }
    1080     }
    1081   } else if ((ptr1=strstr(text, "www."))!=NULL) {
    1082     /* if we can't find a real url look for www.something */
    1083     ptr2=strpbrk(ptr1, " \n\t");
    1084     if (ptr2) {
    1085       strncpy(url, ptr1, ptr2-ptr1+1);
    1086       url[ptr2-ptr1+1]='\0';
    1087     } else {
    1088       strcpy(url, ptr1);
    1089     }
    1090   } else {
    1091     owl_function_beep();
    1092     owl_function_error("Could not find URL to open.");
    1093     return;
    1094   }
    1095 
    1096   /* Make sure there aren't any quotes or \'s in the url */
    1097   for (ptr1 = url; *ptr1; ptr1++) {
    1098     if (*ptr1 == '"' || *ptr1 == '\\') {
    1099       owl_function_beep();
    1100       owl_function_error("URL contains invalid characters.");
    1101       return;
    1102     }
    1103   }
    1104  
    1105   /* NOTE: There are potentially serious security issues here... */
    1106 
    1107   /* open the page */
    1108   owl_function_makemsg("Opening %s", url);
    1109   if (webbrowser == OWL_WEBBROWSER_NETSCAPE) {
    1110     snprintf(tmpbuff, LINE, "netscape -remote \"openURL(%s)\" > /dev/null 2> /dev/null", url);
    1111     system(tmpbuff);
    1112   } else if (webbrowser == OWL_WEBBROWSER_GALEON) {
    1113     snprintf(tmpbuff, LINE, "galeon \"%s\" > /dev/null 2> /dev/null &", url);
    1114     system(tmpbuff);
    1115   } else if (webbrowser == OWL_WEBBROWSER_OPERA) {
    1116     snprintf(tmpbuff, LINE, "opera \"%s\" > /dev/null 2> /dev/null &", url);
    1117     system(tmpbuff);
    1118   }
    11191053}
    11201054
     
    16101544        /* fix this */
    16111545        sprintf(buff, "  Checkd Ath: %i\n", n->z_checked_auth);
    1612         sprintf(buff, "%s  Multi notc: %s\n", buff, n->z_multinotice);
    1613         sprintf(buff, "%s  Num other : %i\n", buff, n->z_num_other_fields);
    1614         sprintf(buff, "%s  Msg Len   : %i\n", buff, n->z_message_len);
     1546        sprintf(buff + strlen(buff), "  Multi notc: %s\n", n->z_multinotice);
     1547        sprintf(buff + strlen(buff), "  Num other : %i\n", n->z_num_other_fields);
     1548        sprintf(buff + strlen(buff), "  Msg Len   : %i\n", n->z_message_len);
    16151549        owl_fmtext_append_normal(&fm, buff);
    16161550       
     
    19221856void owl_function_status()
    19231857{
    1924   char buff[5000];
     1858  char buff[MAXPATHLEN+1];
    19251859  time_t start;
    19261860  int up, days, hours, minutes;
     
    19421876
    19431877  owl_fmtext_append_normal(&fm, "  Current Directory: ");
    1944   (void) getcwd(buff, MAXPATHLEN);
    1945   owl_fmtext_append_normal(&fm, buff);
     1878  if(getcwd(buff, MAXPATHLEN) == NULL) {
     1879    owl_fmtext_append_normal(&fm, "<Error in getcwd>");
     1880  } else {
     1881    owl_fmtext_append_normal(&fm, buff);
     1882  }
    19461883  owl_fmtext_append_normal(&fm, "\n");
    19471884
     
    20521989        return;
    20531990      }
     1991    }
     1992
     1993    /* then check if it's a question and just bring up the command prompt */
     1994    if (owl_message_is_question(m)) {
     1995      owl_function_start_command("");
     1996      return;
    20541997    }
    20551998
     
    25482491  sprintf(argbuff, "class ^(un)*%s(\\.d)*$", tmpclass);
    25492492  if (tmpinstance) {
    2550     sprintf(argbuff, "%s and ( instance ^(un)*%s(\\.d)*$ )", argbuff, tmpinstance);
     2493    sprintf(argbuff + strlen(argbuff), " and ( instance ^(un)*%s(\\.d)*$ )", tmpinstance);
    25512494  }
    25522495  owl_free(tmpclass);
     
    25772520{
    25782521  owl_filter *f;
    2579   char *argbuff, *longuser, *shortuser, *filtname;
     2522  char *argbuff, *longuser, *esclonguser, *shortuser, *filtname;
    25802523
    25812524  /* stick the local realm on if it's not there */
     
    25842527
    25852528  /* name for the filter */
    2586   filtname=owl_malloc(strlen(shortuser)+20);
    2587   sprintf(filtname, "user-%s", shortuser);
     2529  filtname=owl_sprintf("user-%s", shortuser);
    25882530
    25892531  /* if it already exists then go with it.  This lets users override */
     
    25952537  f=owl_malloc(sizeof(owl_filter));
    25962538
    2597   argbuff=owl_malloc(strlen(longuser)+1000);
    2598   sprintf(argbuff, "( type ^zephyr$ and filter personal and ");
    2599   sprintf(argbuff, "%s ( ( direction ^in$ and sender ^%s$ ) or ( direction ^out$ and recipient ^%s$ ) ) )", argbuff, longuser, longuser);
    2600   sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) )", argbuff, longuser);
     2539  esclonguser = owl_text_quote(longuser, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     2540
     2541  argbuff=owl_sprintf("( type ^zephyr$ and filter personal and "
     2542      "( ( direction ^in$ and sender ^%1$s$ ) or ( direction ^out$ and "
     2543      "recipient ^%1$s$ ) ) ) or ( ( class ^login$ ) and ( sender ^%1$s$ ) )",
     2544      esclonguser);
    26012545
    26022546  owl_filter_init_fromstring(f, filtname, argbuff);
     
    26082552  owl_free(argbuff);
    26092553  owl_free(longuser);
     2554  owl_free(esclonguser);
    26102555  owl_free(shortuser);
    26112556
     
    26262571
    26272572  /* name for the filter */
    2628   filtname=owl_malloc(strlen(user)+40);
    2629   sprintf(filtname, "aimuser-%s", user);
     2573  filtname=owl_sprintf("aimuser-%s", user);
    26302574
    26312575  /* if it already exists then go with it.  This lets users override */
     
    26392583  escuser = owl_text_quote(user, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
    26402584
    2641   argbuff=owl_malloc(1000);
    2642   sprintf(argbuff,
    2643           "( type ^aim$ and ( ( sender ^%s$ and recipient ^%s$ ) or ( sender ^%s$ and recipient ^%s$ ) ) )",
    2644           escuser, owl_global_get_aim_screenname_for_filters(&g),
    2645           owl_global_get_aim_screenname_for_filters(&g), escuser);
     2585  argbuff = owl_sprintf(
     2586      "( type ^aim$ and ( ( sender ^%1$s$ and recipient ^%2$s$ ) or "
     2587      "( sender ^%2$s$ and recipient ^%1$s$ ) ) )",
     2588      escuser, owl_global_get_aim_screenname_for_filters(&g));
    26462589
    26472590  owl_filter_init_fromstring(f, filtname, argbuff);
     
    26602603{
    26612604  owl_filter *f;
    2662   char *argbuff, *filtname;
     2605  char *argbuff, *filtname, *esctype;
    26632606
    26642607  /* name for the filter */
     
    26732616  f=owl_malloc(sizeof(owl_filter));
    26742617
    2675   argbuff = owl_sprintf("type ^%s$", type);
     2618  esctype = owl_text_quote(type, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     2619
     2620  argbuff = owl_sprintf("type ^%s$", esctype);
    26762621
    26772622  owl_filter_init_fromstring(f, filtname, argbuff);
     
    26822627  /* free stuff */
    26832628  owl_free(argbuff);
     2629  owl_free(esctype);
    26842630
    26852631  return filtname;
     
    29552901    owl_text_tr(quoted, '\'', '.');
    29562902    owl_text_tr(quoted, '"', '.');
    2957     sprintf(buff, "%s ^(un)*%s(\\.d)*$", buff, quoted);
     2903    sprintf(buff + strlen(buff), " ^(un)*%s(\\.d)*$", quoted);
    29582904    owl_free(quoted);
    29592905  }
     
    29652911    owl_text_tr(quoted, '\'', '.');
    29662912    owl_text_tr(quoted, '"', '.');
    2967     sprintf(buff, "%s and instance ^(un)*%s(\\.d)*$", buff, quoted);
     2913    sprintf(buff + strlen(buff), " and instance ^(un)*%s(\\.d)*$", quoted);
    29682914    owl_free(quoted);
    29692915  }
     
    29732919    owl_text_tr(quoted, '\'', '.');
    29742920    owl_text_tr(quoted, '"', '.');
    2975     sprintf(buff, "%s and recipient ^%s$", buff, quoted);
     2921    sprintf(buff + strlen(buff), " and recipient ^%s$", quoted);
    29762922    owl_free(quoted);
    29772923  }
     
    30653011}
    30663012
    3067 char *owl_function_keymap_summary(void *name)
     3013char *owl_function_keymap_summary(char *name)
    30683014{
    30693015  owl_keymap *km
  • global.c

    rda466e0 r5547211b  
    139139  g->recwin=newwin(g->recwinlines, cols, 0, 0);
    140140  if (g->recwin==NULL) {
    141     owl_function_debugmsg("_owl_global_setup_windows: newwin returned NULL\n", g->recwinlines, cols);
     141    owl_function_debugmsg("_owl_global_setup_windows: newwin returned NULL\n");
    142142    endwin();
    143143    exit(50);
     
    570570  strcpy(g->startupargs, "");
    571571  for (i=0; i<argc; i++) {
    572     sprintf(g->startupargs, "%s%s ", g->startupargs, argv[i]);
     572    sprintf(g->startupargs + strlen(g->startupargs), "%s ", argv[i]);
    573573  }
    574574  g->startupargs[strlen(g->startupargs)-1]='\0';
  • help.c

    r0398d55 r799b60e  
    1818  owl_fmtext_append_normal
    1919    (&fm,
     20     "  If you're new to BarnOwl, the first thing you should type is\n\n"
     21     "    :show quickstart\n\n"
    2022     "  For help on a specific command use 'help <command>'\n"
    2123     "  For information on advanced keys, use 'show keymaps'.\n"
  • keys.c

    rdb0ac7e r9b70dd4  
    282282  BIND_CMD("M-r", "reply -e",         "reply to the current message, but allow editing of recipient");
    283283  BIND_CMD("M-R", "reply -e sender",  "reply to sender of the current message, but allow editing of recipient");
    284                  
    285   BIND_CMD("w",   "openurl",          "open a URL using a webbrowser");
    286284
    287285  BIND_CMD("W",   "start-command webzephyr ", "start a webzephyr command");
  • owl.c

    r5b37c063 r098376e  
    323323  sprintf(buff,      "Welcome to barnowl version %s.  Press 'h' for on-line help.            \n", OWL_VERSION_STRING);
    324324  strcat(startupmsg, buff);
     325  strcat(startupmsg, "To see a quick introduction, type ':show quickstart'.                  \n");
    325326  strcat(startupmsg, "                                                                       \n");
    326327  strcat(startupmsg, "BarnOwl is free software. Type ':show license' for more                \n");
    327   strcat(startupmsg, "information.                                                           \n");
    328   strcat(startupmsg, "                                                                 ^ ^   \n");
     328  strcat(startupmsg, "information.                                                     ^ ^   \n");
    329329  strcat(startupmsg, "                                                                 OvO   \n");
    330330  strcat(startupmsg, "Please report any bugs or suggestions to bug-barnowl@mit.edu    (   )  \n");
     
    511511      int signum;
    512512      if ((signum = owl_global_get_errsignal_and_clear(&g, &si)) > 0) {
    513         owl_function_error("Got unexpected signal: %d %s  (code: %d band: %d  errno: %d)",
     513        owl_function_error("Got unexpected signal: %d %s  (code: %d band: %ld  errno: %d)",
    514514                           signum, signum==SIGPIPE?"SIGPIPE":"SIG????",
    515515                           si.si_code, si.si_band, si.si_errno);
     
    612612
    613613  return 1;
    614 }
    615 
    616 void owl_process_aim()
    617 {
    618   if (owl_global_is_doaimevents(&g)) {
    619     owl_aim_process_events();
    620    
    621     if (owl_global_is_aimloggedin(&g)) {
    622       if (owl_timer_is_expired(owl_global_get_aim_buddyinfo_timer(&g))) {
    623         /* owl_buddylist_request_idletimes(owl_global_get_buddylist(&g)); */
    624         owl_timer_reset(owl_global_get_aim_buddyinfo_timer(&g));
    625       }
    626     }
    627   }
    628614}
    629615
  • owl.h

    r43a306c rb940b91  
    5252
    5353#ifndef OWL_VERSION_STRING
    54 #define OWL_VERSION_STRING "1.0.3"
     54#define OWL_VERSION_STRING "1.0.4.1"
    5555#endif
    5656
     
    320320
    321321typedef struct _owl_pair {
    322   void *key;
    323   void *value;
     322  char *key;
     323  char *value;
    324324} owl_pair;
    325325
  • pair.c

    r160ea47 rde1c8a5  
    11#include "owl.h"
    22
    3 void owl_pair_create(owl_pair *p, void *key, void *value) {
     3void owl_pair_create(owl_pair *p, char *key, char *value) {
    44  p->key=key;
    55  p->value=value;
    66}
    77
    8 void owl_pair_set_key(owl_pair *p, void *key) {
     8void owl_pair_set_key(owl_pair *p, char *key) {
    99  p->key=key;
    1010}
    1111
    12 void owl_pair_set_value(owl_pair *p, void *value) {
     12void owl_pair_set_value(owl_pair *p, char *value) {
    1313  p->value=value;
    1414}
    1515
    16 void *owl_pair_get_key(owl_pair *p) {
     16char *owl_pair_get_key(owl_pair *p) {
    1717  return(p->key);
    1818}
    1919
    20 void *owl_pair_get_value(owl_pair *p) {
     20char *owl_pair_get_value(owl_pair *p) {
    2121  return(p->value);
    2222}
  • perl/modules/IRC/lib/BarnOwl/Message/IRC.pm

    r38a7f22 rf79d6a2  
    3333        @filter  =
    3434             (qw{( type ^irc$ and filter personal and },
    35               qw{( ( direction ^in$ and sender}, "^$who\$",
    36               qw{ ) or ( direction ^out$ and recipient}, "^$who\$",
     35              qw{( ( direction ^in$ and sender}, "^\Q$who\E\$",
     36              qw{ ) or ( direction ^out$ and recipient}, "^\Q$who\E\$",
    3737              qw{) ) ) });
    3838        BarnOwl::command("filter", "$filter", @filter);
     
    4747            $filter = "irc-$network-channel-$channel-$sender-$1";
    4848            @filter =
    49                  (qw{type ^irc$ and network}, "^$network\$",
    50                   qw{and channel}, "^$channel\$",
    51                   qw{and ( sender}, "^$sender\$",
    52                   qw{or sender}, "^$1\$",qq{)});
     49                 (qw{type ^irc$ and network}, "^\Q$network\E\$",
     50                  qw{and channel}, "^\Q$channel\E\$",
     51                  qw{and ( sender}, "^\Q$sender\E\$",
     52                  qw{or sender}, "^\Q$1\E\$",qq{)});
    5353        } else {
    5454            $filter = "irc-$network-channel-$channel";
    55             @filter = (qw{type ^irc$ and network}, "^$network\$",
    56                        qw{and channel}, "^$channel\$");
     55            @filter = (qw{type ^irc$ and network}, "^\Q$network\E\$",
     56                       qw{and channel}, "^\Q$channel\E\$");
    5757        }
    5858        BarnOwl::command("filter", "$filter", @filter);
  • perl/modules/IRC/lib/BarnOwl/Module/IRC.pm

    r167044b r1c014eec  
    214214    if ($body =~ /^\/me (.*)/) {
    215215        $conn->conn->me($to, $1);
    216         $body = BarnOwl::Style::boldify($conn->nick.' '.$1);
     216        $body = '* '.$conn->nick.' '.$1;
    217217    } else {
    218218        $conn->conn->privmsg($to, $body);
  • perl/modules/Jabber/lib/BarnOwl/Message/Jabber.pm

    r96134cb r9375f8c  
    7070        $filter = "jabber-room-$room";
    7171        BarnOwl::command(qw[filter], $filter,
    72                          qw[type ^jabber$ and room], "^$room\$");
     72                         qw[type ^jabber$ and room], "^\Q$room\E\$");
    7373        return $filter;
    7474    } elsif ($self->login ne 'none') {
     
    8484    my $filter = "jabber-user-$user";
    8585    BarnOwl::command(qw[filter], $filter, qw[type ^jabber$],
    86                      qw[and ( ( direction ^in$ and from], "^$user",
    87                      qw[) or ( direction ^out$ and to ], "^$user",
     86                     qw[and ( ( direction ^in$ and from], "^\Q$user\E(/.*)?\$",
     87                     qw[) or ( direction ^out$ and to ], "^\Q$user\E(/.*)?\$",
    8888                     qw[ ) ) ]);
    8989    return $filter;
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    re979da9 r799b60e  
    7070        $BarnOwl::Hooks::mainLoop->add("BarnOwl::Module::Jabber::onMainLoop");
    7171        $BarnOwl::Hooks::getBuddyList->add("BarnOwl::Module::Jabber::onGetBuddyList");
     72        $BarnOwl::Hooks::getQuickstart->add("BarnOwl::Module::Jabber::onGetQuickstart");
    7273        $vars{show} = '';
    7374        BarnOwl::new_variable_bool("jabber:show_offline_buddies",
     
    222223}
    223224
     225sub onGetQuickstart {
     226    return <<'EOF'
     227@b(Jabber:)
     228Type ':jabberlogin @b(username@mit.edu)' to log in to Jabber. The command
     229':jroster sub @b(somebody@gmail.com)' will request that they let you message
     230them. Once you get a message saying you are subscribed, you can message
     231them by typing ':jwrite @b(somebody@gmail.com)' or just 'j @b(somebody)'.
     232EOF
     233}
     234
    224235################################################################################
    225236### Owl Commands
  • perlconfig.c

    r5b37c063 r098376e  
    4444  h = newHV();
    4545
    46 #define MSG2H(h,field) hv_store(h, #field, strlen(#field), \
    47                               newSVpv(owl_message_get_##field(m),0), 0)
     46#define MSG2H(h,field) (void)hv_store(h, #field, strlen(#field),        \
     47                                      newSVpv(owl_message_get_##field(m),0), 0)
    4848
    4949  if (owl_message_is_type_zephyr(m)
     
    5959      owl_free(ptr);
    6060    }
    61     hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);
    62 
    63     hv_store(h, "auth", strlen("auth"),
    64              newSVpv(owl_zephyr_get_authstr(owl_message_get_notice(m)),0),0);
     61    (void)hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);
     62
     63    (void)hv_store(h, "auth", strlen("auth"),
     64                   newSVpv(owl_zephyr_get_authstr(owl_message_get_notice(m)),0),0);
    6565  }
    6666
     
    6868  for(i=0; i<j; i++) {
    6969    pair=owl_list_get_element(&(m->attributes), i);
    70     hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)),
    71              newSVpv(owl_pair_get_value(pair),0),0);
     70    (void)hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)),
     71                   newSVpv(owl_pair_get_value(pair),0),0);
    7272  }
    7373 
     
    8888    MSG2H(h, header);
    8989  }
    90   hv_store(h, "time", strlen("time"), newSVpv(owl_message_get_timestr(m),0),0);
    91   hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0);
    92   hv_store(h, "deleted", strlen("deleted"), newSViv(owl_message_is_delete(m)),0);
    93   hv_store(h, "private", strlen("private"), newSViv(owl_message_is_private(m)),0);
    94   hv_store(h, "should_wordwrap",
    95            strlen("should_wordwrap"), newSViv(
    96                                               owl_filter_message_match(wrap, m)),0);
     90  (void)hv_store(h, "time", strlen("time"), newSVpv(owl_message_get_timestr(m),0),0);
     91  (void)hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0);
     92  (void)hv_store(h, "deleted", strlen("deleted"), newSViv(owl_message_is_delete(m)),0);
     93  (void)hv_store(h, "private", strlen("private"), newSViv(owl_message_is_private(m)),0);
     94  (void)hv_store(h, "should_wordwrap",
     95                 strlen("should_wordwrap"), newSViv(
     96                                                    owl_filter_message_match(wrap, m)),0);
    9797
    9898  type = owl_message_get_type(m);
     
    102102  blessas = owl_sprintf("BarnOwl::Message::%s", type);
    103103
    104   hr = sv_2mortal(newRV_noinc((SV*)h));
     104  hr = newRV_noinc((SV*)h);
    105105  stash =  gv_stashpv(blessas,0);
    106106  if(!stash) {
     
    182182  dSP ;
    183183  int count;
    184   unsigned int len;
    185184  SV *msgref, *srv;
    186   char *out, *preout;
     185  char *out;
    187186 
    188187  ENTER ;
     
    191190  PUSHMARK(SP) ;
    192191  msgref = owl_perlconfig_message2hashref(m);
    193   XPUSHs(msgref);
     192  XPUSHs(sv_2mortal(msgref));
    194193  PUTBACK ;
    195194 
     
    199198
    200199  if (SvTRUE(ERRSV)) {
    201     STRLEN n_a;
    202     owl_function_error("Perl Error: '%s'", SvPV(ERRSV, n_a));
     200    owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV));
    203201    /* and clear the error */
    204202    sv_setsv (ERRSV, &PL_sv_undef);
     
    213211
    214212  if (srv) {
    215     preout=SvPV(srv, len);
    216     out = owl_malloc(strlen(preout)+1);
    217     strncpy(out, preout, len);
    218     out[len] = '\0';
     213    out = owl_strdup(SvPV_nolen(srv));
    219214  } else {
    220215    out = NULL;
     
    235230{
    236231  dSP;
    237   unsigned int count, len, i;
     232  unsigned int count, i;
    238233  SV *msgref, *srv;
    239   char *out, *preout;
     234  char *out;
    240235
    241236  msgref = owl_perlconfig_message2hashref(m);
     
    245240
    246241  PUSHMARK(SP);
    247   XPUSHs(msgref);
     242  XPUSHs(sv_2mortal(msgref));
    248243  for(i=0;i<argc;i++) {
    249244    XPUSHs(sv_2mortal(newSVpv(argv[i], 0)));
     
    261256
    262257  if (SvTRUE(ERRSV)) {
    263     STRLEN n_a;
    264     owl_function_error("Error: '%s'", SvPV(ERRSV, n_a));
     258    owl_function_error("Error: '%s'", SvPV_nolen(ERRSV));
    265259    /* and clear the error */
    266260    sv_setsv (ERRSV, &PL_sv_undef);
     
    270264
    271265  if (srv) {
    272     preout=SvPV(srv, len);
    273     out = owl_malloc(strlen(preout)+1);
    274     strncpy(out, preout, len);
    275     out[len] = '\0';
     266    out = owl_strdup(SvPV_nolen(srv));
    276267  } else {
    277268    out = NULL;
     
    304295  ret=perl_parse(p, owl_perl_xs_init, 2, args, NULL);
    305296  if (ret || SvTRUE(ERRSV)) {
    306     STRLEN n_a;
    307     err=owl_strdup(SvPV(ERRSV, n_a));
     297    err=owl_strdup(SvPV_nolen(ERRSV));
    308298    sv_setsv(ERRSV, &PL_sv_undef);     /* and clear the error */
    309299    return(err);
     
    312302  ret=perl_run(p);
    313303  if (ret || SvTRUE(ERRSV)) {
    314     STRLEN n_a;
    315     err=owl_strdup(SvPV(ERRSV, n_a));
     304    err=owl_strdup(SvPV_nolen(ERRSV));
    316305    sv_setsv(ERRSV, &PL_sv_undef);     /* and clear the error */
    317306    return(err);
     
    342331
    343332  if (SvTRUE(ERRSV)) {
    344     STRLEN n_a;
    345     err=owl_strdup(SvPV(ERRSV, n_a));
     333    err=owl_strdup(SvPV_nolen(ERRSV));
    346334    sv_setsv (ERRSV, &PL_sv_undef);     /* and clear the error */
    347335    return(err);
     
    396384
    397385  if (SvTRUE(ERRSV)) {
    398     STRLEN n_a;
    399     owl_function_error("Perl Error: '%s'", SvPV(ERRSV, n_a));
     386    owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV));
    400387    sv_setsv (ERRSV, &PL_sv_undef);     /* and clear the error */
    401388  }
    402389
    403390  preout=SvPV(response, len);
    404   /* leave enough space in case we have to add a newline */
    405   out = owl_malloc(strlen(preout)+2);
    406   strncpy(out, preout, len);
    407   out[len] = '\0';
    408   if (!strlen(out) || out[strlen(out)-1]!='\n') {
    409     strcat(out, "\n");
    410   }
     391  if (len == 0 || preout[len - 1] != '\n')
     392    out = owl_sprintf("%s\n", preout);
     393  else
     394    out = owl_strdup(preout);
    411395
    412396  return(out);
     
    439423  char * ret = NULL;
    440424  SV *rv;
    441   STRLEN n_a;
    442425  dSP;
    443426
     
    458441
    459442  if(SvTRUE(ERRSV)) {
    460     owl_function_error("%s", SvPV(ERRSV, n_a));
     443    owl_function_error("%s", SvPV_nolen(ERRSV));
    461444    (void)POPs;
    462445  } else {
     
    465448    rv = POPs;
    466449    if(SvTRUE(rv)) {
    467       ret = owl_strdup(SvPV(rv, n_a));
     450      ret = owl_strdup(SvPV_nolen(rv));
    468451    }
    469452  }
     
    489472  SV *cb = (SV*)(e->cbdata);
    490473  SV *text;
    491   unsigned int n_a;
    492474  dSP;
    493475
     
    508490
    509491  if(SvTRUE(ERRSV)) {
    510     owl_function_error("%s", SvPV(ERRSV, n_a));
     492    owl_function_error("%s", SvPV_nolen(ERRSV));
    511493  }
    512494
     
    526508  call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
    527509  if(SvTRUE(ERRSV)) {
    528     STRLEN n_a;
    529     owl_function_error("%s", SvPV(ERRSV, n_a));
     510    owl_function_error("%s", SvPV_nolen(ERRSV));
    530511  }
    531512  return;
     
    535516{
    536517  SV *cb = d->pfunc;
    537   unsigned int n_a;
    538518  dSP;
    539519  if(cb == NULL) {
     
    550530
    551531  if(SvTRUE(ERRSV)) {
    552     owl_function_error("%s", SvPV(ERRSV, n_a));
     532    owl_function_error("%s", SvPV_nolen(ERRSV));
    553533  }
    554534
  • perlglue.xs

    r740d5f7 r5d2248c  
    2424         * complex argument processing or something, we define a
    2525         * simple version here that takes arguments in as flat a
    26          * manner as possible, to simplify the XS code, with a name
    27          * with a trailing `_internal', and write a perl wrapper in
    28          * perlwrap.pm that munges the arguments as appropriate and
    29          * calls the internal version.
     26         * manner as possible, to simplify the XS code, put it in
     27         * BarnOwl::Intenal::, and write a perl wrapper in perlwrap.pm
     28         * that munges the arguments as appropriate and calls the
     29         * internal version.
    3030         */
    3131
     
    6262getcurmsg()
    6363        CODE:
    64                 ST(0) = owl_perlconfig_curmessage2hashref();
     64                RETVAL = owl_perlconfig_curmessage2hashref();
     65        OUTPUT:
     66                RETVAL
    6567
    6668int
     
    141143                if (rv) owl_free(rv);
    142144
    143 void
    144 new_command_internal(name, func, summary, usage, description)
     145void queue_message(msg)
     146        SV *msg
     147        PREINIT:
     148                owl_message *m;
     149        CODE:
     150        {
     151                if(!SvROK(msg) || SvTYPE(SvRV(msg)) != SVt_PVHV) {
     152                        croak("Usage: BarnOwl::queue_message($message)");
     153                }
     154
     155                m = owl_perlconfig_hashref2message(msg);
     156
     157                owl_global_messagequeue_addmsg(&g, m);
     158        }
     159
     160void admin_message(header, body)
     161        char *header
     162        char *body
     163        CODE:
     164        {
     165                owl_function_adminmsg(header, body);           
     166        }
     167
     168void start_question(line, callback)
     169        char *line
     170        SV *callback
     171        PREINIT:
     172        CODE:
     173        {
     174                if(!SV_IS_CODEREF(callback))
     175                        croak("Callback must be a subref");
     176
     177                owl_function_start_question(line);
     178
     179                SvREFCNT_inc(callback);
     180                owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
     181                owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
     182        }
     183
     184void start_password(line, callback)
     185        char *line
     186        SV *callback
     187        PREINIT:
     188        CODE:
     189        {
     190                if(!SV_IS_CODEREF(callback))
     191                        croak("Callback must be a subref");
     192
     193                owl_function_start_password(line);
     194
     195                SvREFCNT_inc(callback);
     196                owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
     197                owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
     198        }
     199
     200void start_edit_win(line, callback)
     201        char *line
     202        SV *callback
     203        PREINIT:
     204                owl_editwin * e;
     205                char buff[1024];
     206        CODE:
     207        {
     208                if(!SV_IS_CODEREF(callback))
     209                        croak("Callback must be a subref");
     210
     211                e = owl_global_get_typwin(&g);
     212                owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE,
     213                                      owl_global_get_msg_history(&g));
     214                owl_editwin_clear(e);
     215                owl_editwin_set_dotsend(e);
     216                snprintf(buff, 1023, "----> %s\n", line);
     217                owl_editwin_set_locktext(e, buff);
     218
     219                owl_global_set_typwin_active(&g);
     220
     221                SvREFCNT_inc(callback);
     222                owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
     223                owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
     224        }
     225
     226
     227char *
     228get_data_dir ()
     229        CODE:
     230                RETVAL = (char *) owl_get_datadir();
     231        OUTPUT:
     232        RETVAL
     233
     234char *
     235get_config_dir ()
     236        CODE:
     237                RETVAL = (char *) owl_global_get_confdir(&g);
     238        OUTPUT:
     239        RETVAL 
     240
     241void
     242popless_text(text)
     243        char *text
     244        CODE:
     245        {
     246                owl_function_popless_text(text);
     247        }
     248
     249void
     250popless_ztext(text)
     251        char *text
     252        CODE:
     253        {
     254                owl_fmtext fm;
     255                owl_fmtext_init_null(&fm);
     256                owl_fmtext_append_ztext(&fm, text);
     257                owl_function_popless_fmtext(&fm);
     258                owl_fmtext_free(&fm);
     259        }
     260
     261void
     262error(text)
     263        char *text
     264        CODE:
     265        {
     266                owl_function_error("%s", text);
     267        }
     268
     269void
     270create_style(name, object)
     271     char *name
     272     SV  *object
     273     PREINIT:
     274                owl_style *s;
     275     CODE:
     276        {
     277                s = owl_malloc(sizeof(owl_style));
     278                owl_style_create_perl(s, name, object);
     279                owl_global_add_style(&g, s);
     280        }
     281
     282int
     283getnumcolors()
     284        CODE:
     285                RETVAL = owl_function_get_color_count();
     286        OUTPUT:
     287                RETVAL
     288
     289void
     290_remove_filter(filterName)
     291        char *filterName
     292        CODE:
     293        {
     294                /* Don't delete the current view, or the 'all' filter */
     295                if (strcmp(filterName, owl_view_get_filtname(owl_global_get_current_view(&g)))
     296                    && strcmp(filterName, "all")) {
     297                        owl_global_remove_filter(&g,filterName);
     298                }
     299        }
     300
     301char *
     302wordwrap(in, cols)
     303        char *in
     304        int cols
     305        PREINIT:
     306                char *rv = NULL;
     307        CODE:
     308                rv = owl_text_wordwrap(in, cols);
     309                RETVAL = rv;   
     310        OUTPUT:
     311                RETVAL
     312        CLEANUP:
     313                if (rv) owl_free(rv);
     314
     315void
     316add_dispatch(fd, cb)
     317        int fd
     318        SV * cb
     319        CODE:
     320        SvREFCNT_inc(cb);
     321        owl_select_add_perl_dispatch(fd, cb);
     322
     323void
     324remove_dispatch(fd)
     325        int fd
     326        CODE:
     327        owl_select_remove_perl_dispatch(fd);
     328
     329MODULE = BarnOwl                PACKAGE = BarnOwl::Internal
     330
     331
     332void
     333new_command(name, func, summary, usage, description)
    145334        char *name
    146335        SV *func
     
    172361           }
    173362
    174 void queue_message(msg)
    175         SV *msg
    176         PREINIT:
    177                 owl_message *m;
    178         CODE:
    179         {
    180                 if(!SvROK(msg) || SvTYPE(SvRV(msg)) != SVt_PVHV) {
    181                         croak("Usage: BarnOwl::queue_message($message)");
    182                 }
    183 
    184                 m = owl_perlconfig_hashref2message(msg);
    185 
    186                 owl_global_messagequeue_addmsg(&g, m);
    187         }
    188 
    189 void admin_message(header, body)
    190         char *header
    191         char *body
    192         CODE:
    193         {
    194                 owl_function_adminmsg(header, body);           
    195         }
    196 
    197 void start_question(line, callback)
    198         char *line
    199         SV *callback
    200         PREINIT:
    201         CODE:
    202         {
    203                 if(!SV_IS_CODEREF(callback))
    204                         croak("Callback must be a subref");
    205 
    206                 owl_function_start_question(line);
    207 
    208                 SvREFCNT_inc(callback);
    209                 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
    210                 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
    211         }
    212 
    213 void start_password(line, callback)
    214         char *line
    215         SV *callback
    216         PREINIT:
    217         CODE:
    218         {
    219                 if(!SV_IS_CODEREF(callback))
    220                         croak("Callback must be a subref");
    221 
    222                 owl_function_start_password(line);
    223 
    224                 SvREFCNT_inc(callback);
    225                 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
    226                 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
    227         }
    228 
    229 void start_edit_win(line, callback)
    230         char *line
    231         SV *callback
    232         PREINIT:
    233                 owl_editwin * e;
    234                 char buff[1024];
    235         CODE:
    236         {
    237                 if(!SV_IS_CODEREF(callback))
    238                         croak("Callback must be a subref");
    239 
    240                 e = owl_global_get_typwin(&g);
    241                 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE,
    242                                       owl_global_get_msg_history(&g));
    243                 owl_editwin_clear(e);
    244                 owl_editwin_set_dotsend(e);
    245                 snprintf(buff, 1023, "----> %s\n", line);
    246                 owl_editwin_set_locktext(e, buff);
    247 
    248                 owl_global_set_typwin_active(&g);
    249 
    250                 SvREFCNT_inc(callback);
    251                 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
    252                 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
    253         }
    254 
    255 
    256 char *
    257 get_data_dir ()
    258         CODE:
    259                 RETVAL = (char *) owl_get_datadir();
    260         OUTPUT:
    261         RETVAL
    262 
    263 char *
    264 get_config_dir ()
    265         CODE:
    266                 RETVAL = (char *) owl_global_get_confdir(&g);
    267         OUTPUT:
    268         RETVAL 
    269 
    270 void
    271 popless_text(text)
    272         char *text
    273         CODE:
    274         {
    275                 owl_function_popless_text(text);
    276         }
    277 
    278 void
    279 popless_ztext(text)
    280         char *text
    281         CODE:
    282         {
    283                 owl_fmtext fm;
    284                 owl_fmtext_init_null(&fm);
    285                 owl_fmtext_append_ztext(&fm, text);
    286                 owl_function_popless_fmtext(&fm);
    287                 owl_fmtext_free(&fm);
    288         }
    289 
    290 void
    291 error(text)
    292         char *text
    293         CODE:
    294         {
    295                 owl_function_error("%s", text);
    296         }
    297 
    298 void
    299 create_style(name, object)
    300      char *name
    301      SV  *object
    302      PREINIT:
    303                 owl_style *s;
    304      CODE:
    305         {
    306                 s = owl_malloc(sizeof(owl_style));
    307                 owl_style_create_perl(s, name, object);
    308                 owl_global_add_style(&g, s);
    309         }
    310 
    311 int
    312 getnumcolors()
    313         CODE:
    314                 RETVAL = owl_function_get_color_count();
    315         OUTPUT:
    316                 RETVAL
    317 
    318 void
    319 _remove_filter(filterName)
    320         char *filterName
    321         CODE:
    322         {
    323                 /* Don't delete the current view, or the 'all' filter */
    324                 if (strcmp(filterName, owl_view_get_filtname(owl_global_get_current_view(&g)))
    325                     && strcmp(filterName, "all")) {
    326                         owl_global_remove_filter(&g,filterName);
    327                 }
    328         }
    329 
    330 char *
    331 wordwrap(in, cols)
    332         char *in
    333         int cols
    334         PREINIT:
    335                 char *rv = NULL;
    336         CODE:
    337                 rv = owl_text_wordwrap(in, cols);
    338                 RETVAL = rv;   
    339         OUTPUT:
    340                 RETVAL
    341         CLEANUP:
    342                 if (rv) owl_free(rv);
    343 
    344 void
    345 new_variable_string_internal(name, ival, summ, desc)
     363void
     364new_variable_string(name, ival, summ, desc)
    346365        char * name
    347366        char * ival
     
    356375
    357376void
    358 new_variable_int_internal(name, ival, summ, desc)
     377new_variable_int(name, ival, summ, desc)
    359378        char * name
    360379        int ival
     
    369388
    370389void
    371 new_variable_bool_internal(name, ival, summ, desc)
     390new_variable_bool(name, ival, summ, desc)
    372391        char * name
    373392        int ival
     
    380399                                      desc,
    381400                                      ival);
    382 
    383 void
    384 add_dispatch(fd, cb)
    385         int fd
    386         SV * cb
    387         CODE:
    388         SvREFCNT_inc(cb);
    389         owl_select_add_perl_dispatch(fd, cb);
    390 
    391 void
    392 remove_dispatch(fd)
    393         int fd
    394         CODE:
    395         owl_select_remove_perl_dispatch(fd);
  • perlwrap.pm

    r740d5f7 r5d2248c  
    242242    );
    243243
    244     BarnOwl::new_command_internal($name, $func, $args{summary}, $args{usage}, $args{description});
     244    BarnOwl::Internal::new_command($name, $func, $args{summary}, $args{usage}, $args{description});
    245245}
    246246
     
    275275
    276276sub new_variable_int {
    277     unshift @_, \&BarnOwl::new_variable_int_internal, 0;
     277    unshift @_, \&BarnOwl::Internal::new_variable_int, 0;
    278278    goto \&_new_variable;
    279279}
    280280
    281281sub new_variable_bool {
    282     unshift @_, \&BarnOwl::new_variable_bool_internal, 0;
     282    unshift @_, \&BarnOwl::Internal::new_variable_bool, 0;
    283283    goto \&_new_variable;
    284284}
    285285
    286286sub new_variable_string {
    287     unshift @_, \&BarnOwl::new_variable_string_internal, "";
     287    unshift @_, \&BarnOwl::Internal::new_variable_string, "";
    288288    goto \&_new_variable;
    289289}
     
    810810displayed in a popup window, with zephyr formatting parsed.
    811811
     812=item $getQuickstart
     813
     814Called by :show quickstart to display 2-5 lines of help on how to
     815start using the protocol. The result from every function registered
     816with this hook will be appended and displayed in an admin message,
     817with zephyr formatting parsed. The format should be
     818"@b(Protocol:)\nSome text.\nMore text.\n"
     819
    812820=back
    813821
     
    818826our @EXPORT_OK = qw($startup $shutdown
    819827                    $receiveMessage $newMessage
    820                     $mainLoop $getBuddyList);
     828                    $mainLoop $getBuddyList
     829                    $getQuickstart);
    821830
    822831our %EXPORT_TAGS = (all => [@EXPORT_OK]);
     
    828837our $mainLoop = BarnOwl::Hook->new;
    829838our $getBuddyList = BarnOwl::Hook->new;
     839our $getQuickstart = BarnOwl::Hook->new;
    830840
    831841# Internal startup/shutdown routines called by the C code
     
    921931}
    922932
     933sub _get_quickstart {
     934    return join("\n", $getQuickstart->run);
     935}
     936
    923937################################################################################
    924938# Built-in perl styles
  • popexec.c

    r1971b59 r44fc93b  
    7373    dup2(child_write_fd, 2 /*stderr*/);
    7474    close(child_write_fd);
    75    
    76     while(0) {
    77       write(child_write_fd, "meep\n", 5);
    78       sleep(1);
    79     }
    8075
    8176    argv[0] = "sh";
  • regex.c

    r8b7466b r554a2b8  
    1313{
    1414  int ret;
    15   char buff1[LINE], buff2[LINE];
     15  char buff1[LINE];
    1616  char *ptr;
    1717 
     
    2929  if (ret) {
    3030    regerror(ret, NULL, buff1, LINE);
    31     sprintf(buff2, "Error in regular expression: %s", buff1);
    32     owl_function_makemsg(buff2);
     31    owl_function_makemsg("Error in regular expression: %s", buff1);
    3332    owl_free(re->string);
    3433    re->string=NULL;
  • tester.c

    r1cf3f8d3 r3381399  
    66
    77owl_global g;
    8 
    9 void screeninit()
    10 {
    11   char buff[1024];
    12  
    13   sprintf(buff, "TERMINFO=%s", TERMINFO);
    14   putenv(buff);
    15 
    16   initscr();
    17   start_color();
    18   /* cbreak(); */
    19   raw();
    20   noecho();
    21   intrflush(stdscr,FALSE);
    22   keypad(stdscr,TRUE);
    23   nodelay(stdscr,1);
    24   clear();
    25   refresh();
    26   meta(stdscr, TRUE);
    27 }
    28 
    29 void test1()
    30 {
    31   int j;
    32   owl_editwin e;
    33 
    34   screeninit();
    35 
    36   owl_editwin_init(&e, stdscr, LINES, COLS, OWL_EDITWIN_STYLE_MULTILINE, NULL);
    37   /* owl_editwin_set_locktext(&e, "Here is some locktext:\n");*/
    38   doupdate();
    39   while (1) {
    40     usleep(50);
    41 
    42     j=getch();
    43 
    44     if (j==ERR) continue;
    45 
    46     if (j==3) break;
    47 
    48     if (j==27) {
    49       j=getch();
    50       if (j==ERR) continue;
    51       owl_editwin_process_char(&e, j);
    52       doupdate();
    53     } else {
    54       owl_editwin_process_char(&e, j);
    55       doupdate();
    56     }
    57   }
    58   endwin();
    59   printf("Had:\n%s", owl_editwin_get_text(&e));
    60 }
    61 
    62 void test2(char *in)
    63 {
    64   owl_fmtext t;
    65 
    66   screeninit();
    67 
    68   owl_fmtext_init_null(&t);
    69   owl_fmtext_append_ztext(&t, in);
    70   owl_fmtext_curs_waddstr(&t, stdscr);
    71   wrefresh(stdscr);
    72   sleep(5000);
    73   endwin();
    74 }
    75 
    76 void test3()
    77 {
    78   ZNotice_t *n;
    79 
    80   printf("%i\n", sizeof(n->z_uid.zuid_addr));
    81   /* gethostbyaddr((char *) &(n->z_uid.zuid_addr), sizeof(n->z_uid.zuid_addr), AF_INET); */
    82 }
    83 
    84 void colorinfo()
    85 {
    86   char buff[1024];
    87  
    88   screeninit();
    89   sprintf(buff, "Have %i COLOR_PAIRS\n", COLOR_PAIRS);
    90   addstr(buff);
    91   refresh();
    92   sleep(10);
    93   endwin(); 
    94 }
    95 
    96 void test4()
    97 {
    98   int j;
    99   char buff[1024];
    100 
    101   screeninit();
    102  
    103   while (1) {
    104     usleep(100);
    105 
    106     j=getch();
    107 
    108     if (j==ERR) continue;
    109 
    110     if (j==3) break;
    111     sprintf(buff, "%o\n", j);
    112     addstr(buff);
    113   }
    114   endwin();
    115 }
    116 
    117 void test_keypress()
    118 {
    119   int j, rev;
    120   char buff[1024], buff2[64];
    121 
    122   screeninit();
    123  
    124   while (1) {
    125     usleep(100);
    126 
    127     j=wgetch(stdscr);
    128 
    129     if (j==ERR) continue;
    130 
    131     if (j==3) break;
    132     if (0 == owl_keypress_tostring(j, 0, buff2, 1000)) {
    133       rev = owl_keypress_fromstring(buff2);
    134       sprintf(buff, "%s : 0x%x 0%o %d %d %s\n", buff2, j, j, j, rev,
    135               (j==rev?"matches":"*** WARNING: Does Not Reverse"));
    136     } else {
    137       sprintf(buff, "UNKNOWN : 0x%x 0%o %d\n", j, j, j);
    138     }
    139       addstr(buff);
    140   }
    141   endwin();
    142 }
    143 
    1448
    1459#define OWL_DICT_NTESTS  20
     
    15519
    15620  int numfailures=0;
    157   if (argc==1 || (argc==2 && 0==strcmp(argv[1],"reg"))) {
    158     printf("1..%d\n", OWL_UTIL_NTESTS+OWL_DICT_NTESTS+OWL_VARIABLE_NTESTS
    159            +OWL_FILTER_NTESTS+OWL_OBARRAY_NTESTS);
    160     numfailures += owl_util_regtest();
    161     numfailures += owl_dict_regtest();
    162     numfailures += owl_variable_regtest();
    163     numfailures += owl_filter_regtest();
    164     numfailures += owl_obarray_regtest();
    165     if (numfailures) {
     21  printf("1..%d\n", OWL_UTIL_NTESTS+OWL_DICT_NTESTS+OWL_VARIABLE_NTESTS
     22         +OWL_FILTER_NTESTS+OWL_OBARRAY_NTESTS);
     23  numfailures += owl_util_regtest();
     24  numfailures += owl_dict_regtest();
     25  numfailures += owl_variable_regtest();
     26  numfailures += owl_filter_regtest();
     27  numfailures += owl_obarray_regtest();
     28  if (numfailures) {
    16629      fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
    167     }
    168     return(numfailures);
    169   } else if (argc==2 && 0==strcmp(argv[1],"test1")) {
    170     test1();
    171   } else if (argc==2 && 0==strcmp(argv[1],"colorinfo")) {
    172     colorinfo();
    173   } else if (argc==2 && 0==strcmp(argv[1],"test4")) {
    174     test4();
    175   } else if (argc==2 && 0==strcmp(argv[1],"keypress")) {
    176     test_keypress();
    177   } else {
    178     fprintf(stderr, "No test specified.  Current options are: reg test1\n");
    17930  }
    180   return(0);
     31  return(numfailures);
    18132}
  • util.c

    r601733d r6eaf35b  
    373373
    374374  if (days>0) {
    375     out=owl_sprintf("%i d %2.2i:%2.2i", days, hours, run);
     375    out=owl_sprintf("%i d %2.2i:%2.2li", days, hours, run);
    376376  } else {
    377     out=owl_sprintf("    %2.2i:%2.2i", hours, run);
     377    out=owl_sprintf("    %2.2i:%2.2li", hours, run);
    378378  }
    379379  return(out);
  • variable.c

    r451db9e r160d3f4  
    351351               "                 the cursor will be near the center.\n",
    352352               "normal,top,neartop,center,paged,pagedcenter" ),
    353 
    354   OWLVAR_ENUM( "webbrowser" /* %OwlVarStub */, OWL_WEBBROWSER_NETSCAPE,
    355                "web browser to use to launch URLs",
    356                "When the 'w' key is pressed, this browser is used\n"
    357                "to display the requested URL.\n",
    358                "none,netscape,galeon,opera" ),
    359353
    360354
     
    10561050  FAIL_UNLESS("get int 7", 9==owl_variable_get_int(&vd,"typewinsize"));
    10571051
    1058   FAIL_UNLESS("get enum", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));
    1059   FAIL_UNLESS("get enum as string 1", 0==owl_variable_get_tostring(&vd,"webbrowser", buf, 1024));
    1060   FAIL_UNLESS("get enum as string 2", 0==strcmp(buf,"netscape"));
    1061   FAIL_UNLESS("set enum 1", 0==owl_variable_set_int(&vd,"webbrowser",OWL_WEBBROWSER_GALEON));
    1062   FAIL_UNLESS("get enum 2", OWL_WEBBROWSER_GALEON==owl_variable_get_int(&vd,"webbrowser"));
    1063   FAIL_UNLESS("set enum 1b", -1==owl_variable_set_int(&vd,"webbrowser",-3));
    1064   FAIL_UNLESS("set enum 1b", -1==owl_variable_set_int(&vd,"webbrowser",209));
    1065   FAIL_UNLESS("get enum 2b", OWL_WEBBROWSER_GALEON==owl_variable_get_int(&vd,"webbrowser"));
    1066   FAIL_UNLESS("set enum 3", 0==owl_variable_set_fromstring(&vd,"webbrowser","none",0,0));
    1067   FAIL_UNLESS("get enum 4", OWL_WEBBROWSER_NONE==owl_variable_get_int(&vd,"webbrowser"));
    1068   FAIL_UNLESS("set enum 5", 0==owl_variable_set_fromstring(&vd,"webbrowser","netscape",0,0));
    1069   FAIL_UNLESS("get enum 6", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));
    1070   FAIL_UNLESS("set enum 7", -1==owl_variable_set_fromstring(&vd,"webbrowser","xxx",0,0));
    1071   FAIL_UNLESS("set enum 8", -1==owl_variable_set_fromstring(&vd,"webbrowser","",0,0));
    1072   FAIL_UNLESS("set enum 9", -1==owl_variable_set_fromstring(&vd,"webbrowser","netscapey",0,0));
    1073   FAIL_UNLESS("get enum 10", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));
    1074 
    10751052  owl_variable_dict_newvar_string(&vd, "stringvar", "", "", "testval");
    10761053  FAIL_UNLESS("get new string var", NULL != (v = owl_variable_get(&vd, "stringvar", OWL_VARIABLE_STRING)));
  • wcwidth.c

    r47519e1b r44fc93b  
    6262#include <wchar.h>
    6363
    64 static struct interval {
     64struct interval {               /* noproto */
    6565  int first;
    6666  int last;
  • zcrypt.c

    r34509d5 r5547211b  
    375375
    376376    for (i = 0; i < 8; i++) {
    377       sprintf(out, "%s%c", out, ((output[i] & 0xf0) >> 4) + BASE_CODE);
    378       sprintf(out, "%s%c", out, (output[i] & 0x0f)        + BASE_CODE);
     377      sprintf(out + strlen(out), "%c", ((output[i] & 0xf0) >> 4) + BASE_CODE);
     378      sprintf(out + strlen(out), "%c", (output[i] & 0x0f)        + BASE_CODE);
    379379    }
    380380
  • zephyr.c

    r451db9e r5547211b  
    814814    ZGetLocations(&locations,&one);
    815815    myuser=short_zuser(user);
    816     sprintf(out, "%s%s: %s\t%s\t%s\n", out, myuser,
     816    sprintf(out + strlen(out), "%s: %s\t%s\t%s\n", myuser,
    817817            locations.host ? locations.host : "?",
    818818            locations.tty ? locations.tty : "?",
  • zwrite.c

    r3f3ee61 r5547211b  
    231231    for (i=0; i<j; i++) {
    232232      if (strcmp(z->realm, "")) {
    233         sprintf(toline, "%s%s@%s ", toline, (char *) owl_list_get_element(&(z->recips), i), z->realm);
     233        sprintf(toline + strlen(toline), "%s@%s ", (char *) owl_list_get_element(&(z->recips), i), z->realm);
    234234      } else {
    235         sprintf(toline, "%s%s ", toline, (char *) owl_list_get_element(&(z->recips), i));
     235        sprintf(toline + strlen(toline), "%s ", (char *) owl_list_get_element(&(z->recips), i));
    236236      }
    237237    }
  • .gitignore

    ree0574c r3e9485d  
     1*~
    12*.a
    23autom4te.cache
     
    1011core
    1112jabber.log
     13libfaim/rxhandlers.c.orig
    1214Makefile
    1315META.yml
Note: See TracChangeset for help on using the changeset viewer.