Changeset 811644f


Ignore:
Timestamp:
Oct 23, 2010, 1:14:08 AM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
c38bfe0
Parents:
12a6616
git-author:
David Benjamin <davidben@mit.edu> (10/19/10 17:09:28)
git-committer:
David Benjamin <davidben@mit.edu> (10/23/10 01:14:08)
Message:
Correctly narrow on personals from realm-less senders

Fixes bug #38. Also, avoid leaking shortuser when the filter already
exists.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    rc6adf17 r811644f  
    23552355/* Create a filter for personal zephyrs to or from the specified
    23562356 * zephyr user.  Includes login/logout notifications for the user.
    2357  * The name of the filter will be 'user-<user>'.  If a filter already
     2357 * The name of the filter will be 'user-<shortuser>'.  If a filter already
    23582358 * exists with this name, no new filter will be created.  This allows
    23592359 * the configuration to override this function.  Returns the name of
    23602360 * the filter, which the caller must free.
    23612361 */
    2362 char *owl_function_zuserfilt(const char *user)
     2362char *owl_function_zuserfilt(const char *longuser)
    23632363{
    23642364  owl_filter *f;
    2365   char *argbuff, *longuser, *esclonguser, *shortuser, *filtname;
    2366 
    2367   /* stick the local realm on if it's not there */
    2368   longuser=long_zuser(user);
    2369   shortuser=short_zuser(user);
     2365  char *argbuff, *esclonguser, *shortuser, *filtname;
    23702366
    23712367  /* name for the filter */
    2372   filtname=owl_sprintf("user-%s", shortuser);
     2368  shortuser = short_zuser(longuser);
     2369  filtname = owl_sprintf("user-%s", shortuser);
     2370  owl_free(shortuser);
    23732371
    23742372  /* if it already exists then go with it.  This lets users override */
     
    23922390  /* free stuff */
    23932391  owl_free(argbuff);
    2394   owl_free(longuser);
    23952392  owl_free(esclonguser);
    2396   owl_free(shortuser);
    23972393
    23982394  return(filtname);
     
    25372533  const owl_view *v;
    25382534  const owl_message *m;
    2539   char *zperson, *filtname=NULL;
    2540   const char *argv[2];
     2535  char *filtname = NULL;
     2536  const char *argv[2], *zperson;
    25412537  int related = owl_global_is_narrow_related(&g) ^ invert_related;
    25422538
     
    25772573
    25782574      if (owl_message_is_direction_in(m)) {
    2579         zperson=short_zuser(owl_message_get_sender(m));
     2575        zperson = owl_message_get_sender(m);
    25802576      } else {
    2581         zperson=short_zuser(owl_message_get_recipient(m));
     2577        zperson = owl_message_get_recipient(m);
    25822578      }
    2583       filtname=owl_function_zuserfilt(zperson);
    2584       owl_free(zperson);
    2585       return(filtname);
     2579      filtname = owl_function_zuserfilt(zperson);
     2580      return filtname;
    25862581    }
    25872582
Note: See TracChangeset for help on using the changeset viewer.