Changeset 87d7e14


Ignore:
Timestamp:
Feb 1, 2012, 1:43:40 PM (13 years ago)
Author:
GitHub Merge Button <merge-button@github.com>
Parents:
39a531d (diff), 822e9bd (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 822e9bd3723b41b99b95e23a2e7c84e7b76add0d into 39a531dbab5fa35e3e3ad8b92a43e40ecac6012d
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Jabber/lib/XML/Stream.pm

    ra8d5a39 r822e9bd  
    21122112
    21132113    return unless defined($mechanisms);
     2114
     2115    # Here we assume that if 'to' is available, then a domain is being
     2116    # specified that does not match the hostname of the jabber server
     2117    # and that we should use that to form the bare JID for SASL auth.
     2118    my $domain .=  $self->{SIDS}->{$sid}->{to}
     2119        ? $self->{SIDS}->{$sid}->{to}
     2120        : $self->{SIDS}->{$sid}->{hostname};
     2121
     2122    my $authname = $username . '@' . $domain;
    21142123   
    21152124    my $sasl = new Authen::SASL(mechanism=>join(" ",@{$mechanisms}),
    21162125                                callback=>{
    2117 #                                           authname => $username."@".$self->{SIDS}->{$sid}->{hostname},
     2126                                           authname => $authname,
     2127
    21182128                                           user     => $username,
    21192129                                           pass     => $password
     
    21212131                               );
    21222132
    2123     $self->{SIDS}->{$sid}->{sasl}->{client} = $sasl->client_new('xmpp', $self->{SIDS}->{$sid}->{hostname});
     2133    $self->{SIDS}->{$sid}->{sasl}->{client} = $sasl->client_new('xmpp', $domain);
    21242134    $self->{SIDS}->{$sid}->{sasl}->{username} = $username;
    21252135    $self->{SIDS}->{$sid}->{sasl}->{password} = $password;
  • commands.c

    rf89cc6f r39a531d  
    9696  OWLCMD_ARGS("unbindkey", owl_command_unbindkey, OWL_CTX_ANY,
    9797              "removes a binding in a keymap",
    98               "bindkey <keymap> <keyseq>",
     98              "unbindkey <keymap> <keyseq>",
    9999              "Removes a binding of a key sequence within a keymap.\n"
    100100              "Use 'show keymaps' to see the existing keymaps.\n"
     
    17781778
    17791779  if (argc < 3) {
    1780     owl_function_makemsg("Usage: bindkey <keymap> <binding>");
     1780    owl_function_makemsg("Usage: unbindkey <keymap> <binding>");
    17811781    return NULL;
    17821782  }
  • doc/barnowl.1

    rbad4496 r8135737  
    3535.TP
    3636\fB\-c\fP, \fB\-\-config\-file\fP=\fIFILE\fP
    37 Specify an alternate config file for \fBBarnOwl\fP to use.  By default,
    38 \fBBarnOwl\fP uses \fI~/.barnowlconf\fP if it exists, and \fI~/.owlconf\fP otherwise.
     37Specify an alternate config file for \fBBarnOwl\fP to use.  The config file is
     38an arbitrary Perl script evaluated in the \fImain\fP package, and if it
     39overrides the \fIBarnOwl::startup\fP method that is run when \fBBarnOwl\fP
     40starts.  (Compare \fI~/.owl/startup\fP, which contains \fBBarnOwl\fP commands
     41that are run at startup after the config file is loaded.)
     42
     43By default, \fBBarnOwl\fP uses the first of \fI~/.owl/init.pl\fP,
     44\fI~/.barnowlconf\fP, or \fI~/.owlconf\fP that exists.
    3945
    4046.TP
  • functions.c

    r7803326 rbd482c3  
    216216void owl_function_add_outgoing_zephyrs(const owl_zwrite *z)
    217217{
    218   if (z->cc || owl_zwrite_get_numrecips(z) == 0) {
     218  if (z->cc && owl_zwrite_is_personal(z)) {
    219219    /* create the message */
    220220    owl_message *m = g_new(owl_message, 1);
     
    225225    int i;
    226226    for (i = 0; i < owl_zwrite_get_numrecips(z); i++) {
     227      owl_message *m;
     228
     229      if (!owl_zwrite_recip_is_personal(owl_zwrite_get_recip_n(z, i)))
     230        continue;
     231
    227232      /* create the message */
    228       owl_message *m = g_new(owl_message, 1);
     233      m = g_new(owl_message, 1);
    229234      owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), i);
    230235
     
    373378  owl_function_makemsg("Waiting for ack...");
    374379
    375   /* If it's personal */
    376   if (owl_zwrite_is_personal(z)) {
    377     /* create the outgoing message */
    378     owl_function_add_outgoing_zephyrs(z);
    379   }
     380  /* create the outgoing message */
     381  owl_function_add_outgoing_zephyrs(z);
    380382}
    381383#else
     
    427429  owl_function_makemsg("Waiting for ack...");
    428430
    429   /* If it's personal */
    430   if (owl_zwrite_is_personal(z)) {
    431     /* Create the outgoing message. Restore the un-crypted message for display. */
    432     owl_zwrite_set_message_raw(z, old_msg);
    433     owl_function_add_outgoing_zephyrs(z);
    434   }
    435 
    436   /* free the zwrite */
     431  /* Create the outgoing message. Restore the un-crypted message for display. */
     432  owl_zwrite_set_message_raw(z, old_msg);
     433  owl_function_add_outgoing_zephyrs(z);
     434
     435  /* Clean up. */
    437436  g_free(cryptmsg);
     437  g_free(old_msg);
    438438}
    439439
  • global.c

    r9078f69 r219f52c  
    7575  g_free(cd);
    7676
    77   owl_messagelist_create(&(g->msglist));
     77  g->msglist = owl_messagelist_new();
    7878
    7979  _owl_global_init_windows(g);
     
    109109
    110110  /* Create the widgets */
    111   owl_mainwin_init(&(g->mw), g->mainpanel.recwin);
     111  g->mw = owl_mainwin_new(g->mainpanel.recwin);
    112112  owl_msgwin_init(&(g->msgwin), g->mainpanel.msgwin);
    113113  owl_sepbar_init(g->mainpanel.sepwin);
     
    241241/* windows */
    242242
    243 owl_mainwin *owl_global_get_mainwin(owl_global *g) {
    244   return(&(g->mw));
     243owl_mainwin *owl_global_get_mainwin(owl_global *g)
     244{
     245  return g->mw;
    245246}
    246247
     
    256257
    257258owl_messagelist *owl_global_get_msglist(owl_global *g) {
    258   return(&(g->msglist));
     259  return g->msglist;
    259260}
    260261
  • mainwin.c

    r099597c rab88b05  
    44static void owl_mainwin_resized(owl_window *w, void *user_data);
    55
    6 void owl_mainwin_init(owl_mainwin *mw, owl_window *window)
     6CALLER_OWN owl_mainwin *owl_mainwin_new(owl_window *window)
    77{
     8  owl_mainwin *mw = g_new(owl_mainwin, 1);
    89  mw->curtruncated=0;
    910  mw->lastdisplayed=-1;
     
    1617  /* For now, we do not bother with connecting up dependencies; that'll be a
    1718   * future refactor of the mainwin */
     19
     20  return mw;
    1821}
    1922
  • message.c

    r6646fdb rbff1f22  
    836836
    837837 
    838   /* set the "isprivate" attribute if it's a private zephyr.
    839    ``private'' means recipient is non-empty and doesn't start wit
    840    `@' */
    841   if (*n->z_recipient && *n->z_recipient != '@') {
     838  /* set the "isprivate" attribute if it's a private zephyr. */
     839  if (owl_zwrite_recip_is_personal(n->z_recipient)) {
    842840    owl_message_set_isprivate(m);
    843841  }
  • messagelist.c

    rf271129 r219f52c  
    11#include "owl.h"
    22
    3 void owl_messagelist_create(owl_messagelist *ml)
     3CALLER_OWN owl_messagelist *owl_messagelist_new(void)
    44{
     5  owl_messagelist *ml = g_new(owl_messagelist, 1);
    56  ml->list = g_ptr_array_new();
     7  return ml;
    68}
    79
    8 void owl_messagelist_cleanup(owl_messagelist *ml, bool free_messages)
     10void owl_messagelist_delete(owl_messagelist *ml, bool free_messages)
    911{
    1012  if (free_messages)
    1113    g_ptr_array_foreach(ml->list, (GFunc)owl_message_delete, NULL);
    1214  g_ptr_array_free(ml->list, true);
     15  g_free(ml);
    1316}
    1417
  • owl.c

    r3b17b57 r8135737  
    4141  fprintf(stderr, "  -v,--version        print the Barnowl version number and exit\n");
    4242  fprintf(stderr, "  -h,--help           print this help message\n");
    43   fprintf(stderr, "  -c,--config-file    specify an alternate config file\n");
    4443  fprintf(stderr, "  -s,--config-dir     specify an alternate config dir (default ~/.owl)\n");
     44  fprintf(stderr, "  -c,--config-file    specify an alternate config file (default ~/.owl/init.pl)\n");
    4545  fprintf(stderr, "  -t,--tty            set the tty name\n");
    4646}
     
    585585  );
    586586
     587  owl_function_debugmsg("startup: setting context interactive");
     588
     589  owl_global_pop_context(&g);
     590  owl_global_push_context(&g, OWL_CTX_INTERACTIVE|OWL_CTX_RECV, NULL, "recv", NULL);
     591
    587592  /* process the startup file */
    588593  owl_function_debugmsg("startup: processing startup file");
     
    596601      owl_function_error("No such style: %s", owl_global_get_default_style(&g));
    597602
    598   owl_function_debugmsg("startup: setting context interactive");
    599 
    600   owl_global_pop_context(&g);
    601   owl_global_push_context(&g, OWL_CTX_INTERACTIVE|OWL_CTX_RECV, NULL, "recv", NULL);
    602 
    603603  source = owl_window_redraw_source_new();
    604604  g_source_attach(source, NULL);
  • owl.h

    rb9517cf r219f52c  
    452452  char *name;
    453453  owl_filter *filter;
    454   owl_messagelist ml;
     454  owl_messagelist *ml;
    455455  const owl_style *style;
    456456  int cachedmsgid;
     
    533533
    534534typedef struct _owl_global {
    535   owl_mainwin mw;
     535  owl_mainwin *mw;
    536536  owl_popwin *pw;
    537537  owl_msgwin msgwin;
     
    551551  int curmsg_vert_offset;
    552552  owl_view current_view;
    553   owl_messagelist msglist;
     553  owl_messagelist *msglist;
    554554  WINDOW *input_pad;
    555555  owl_mainpanel mainpanel;
  • perl/lib/BarnOwl.pm

    r7803326 r8135737  
    329329our @all_commands;
    330330
    331 if(!$configfile && -f $ENV{HOME} . "/.barnowlconf") {
    332     $configfile = $ENV{HOME} . "/.barnowlconf";
    333 }
    334 $configfile ||= $ENV{HOME}."/.owlconf";
     331if(!$configfile) {
     332    if (-f get_config_dir() . "/init.pl") {
     333        $configfile = get_config_dir() . "/init.pl";
     334    } elsif (-f $ENV{HOME} . "/.barnowlconf") {
     335        $configfile = $ENV{HOME} . "/.barnowlconf";
     336    } else {
     337        $configfile = $ENV{HOME}."/.owlconf";
     338    }
     339}
    335340
    336341# populate global variable space for legacy owlconf files
  • perl/lib/BarnOwl/Message/Zephyr.pm

    redd0be7 rbf70350  
    171171        $class = $self->class;
    172172        $instance = $self->instance;
    173         if ($self->recipient eq '*' || $self->recipient eq '') {
    174             $to = '';
    175         } elsif ($self->recipient =~ /^@/) {
     173        if ($self->recipient eq '' || $self->recipient =~ /^@/) {
    176174            $to = $self->recipient;
    177175        } else {
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    rb8a3e00 r678f607  
    14821482}
    14831483
     1484sub complete_jabberlogout {
     1485    my $ctx = shift;
     1486    if($ctx->word == 1) {
     1487        return ("-A", complete_account() );
     1488    } else {
     1489        return ();
     1490    }
     1491}
     1492
    14841493BarnOwl::Completion::register_completer(jwrite => sub { BarnOwl::Module::Jabber::complete_jwrite(@_) });
     1494BarnOwl::Completion::register_completer(jabberlogout => sub { BarnOwl::Module::Jabber::complete_jabberlogout(@_) });
    14851495
    148614961;
  • variable.c

    rf271129 rd126a19  
    116116               "both,in,out"),
    117117
    118   OWLVAR_BOOL( "colorztext" /* %OwlVarStub */, 1,
    119                "allow @color() in zephyrs to change color",
    120                "Note that only messages received after this variable\n"
    121                "is set will be affected." ),
     118  OWLVAR_BOOL_FULL( "colorztext" /* %OwlVarStub */, 1,
     119                    "allow @color() in zephyrs to change color",
     120                    NULL, NULL, owl_variable_colorztext_set, NULL),
    122121
    123122  OWLVAR_BOOL( "fancylines" /* %OwlVarStub */, 1,
     
    496495  }
    497496  return owl_variable_bool_set_default(v, newval);
     497}
     498
     499int owl_variable_colorztext_set(owl_variable *v, const void *newval)
     500{
     501  int ret = owl_variable_bool_set_default(v, newval);
     502  /* flush the format cache so that we see the update, but only if we're done initializing BarnOwl */
     503  if (owl_global_get_msglist(&g) != NULL)
     504    owl_messagelist_invalidate_formats(owl_global_get_msglist(&g));
     505  if (owl_global_get_mainwin(&g) != NULL) {
     506    owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS);
     507    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
     508  }
     509  return ret;
    498510}
    499511
  • view.c

    rf271129 r219f52c  
    66  v->filter=f;
    77  v->style=s;
    8   owl_messagelist_create(&(v->ml));
     8  v->ml = owl_messagelist_new();
    99  owl_view_recalculate(v);
    1010}
     
    1919{
    2020  if (owl_filter_message_match(v->filter, m)) {
    21     owl_messagelist_append_element(&(v->ml), m);
     21    owl_messagelist_append_element(v->ml, m);
    2222  }
    2323}
     
    3030  int i, j;
    3131  const owl_messagelist *gml;
    32   owl_messagelist *ml;
    3332  owl_message *m;
    3433
    3534  gml=owl_global_get_msglist(&g);
    36   ml=&(v->ml);
    3735
    3836  /* nuke the old list, don't free the messages */
    39   owl_messagelist_cleanup(ml, false);
    40   owl_messagelist_create(&(v->ml));
     37  owl_messagelist_delete(v->ml, false);
     38  v->ml = owl_messagelist_new();
    4139
    4240  /* find all the messages we want */
     
    4543    m=owl_messagelist_get_element(gml, i);
    4644    if (owl_filter_message_match(v->filter, m)) {
    47       owl_messagelist_append_element(ml, m);
     45      owl_messagelist_append_element(v->ml, m);
    4846    }
    4947  }
     
    7270owl_message *owl_view_get_element(const owl_view *v, int index)
    7371{
    74   return(owl_messagelist_get_element(&(v->ml), index));
     72  return owl_messagelist_get_element(v->ml, index);
    7573}
    7674
    7775void owl_view_delete_element(owl_view *v, int index)
    7876{
    79   owl_messagelist_delete_element(&(v->ml), index);
     77  owl_messagelist_delete_element(v->ml, index);
    8078}
    8179
    8280void owl_view_undelete_element(owl_view *v, int index)
    8381{
    84   owl_messagelist_undelete_element(&(v->ml), index);
     82  owl_messagelist_undelete_element(v->ml, index);
    8583}
    8684
    8785int owl_view_get_size(const owl_view *v)
    8886{
    89   return(owl_messagelist_get_size(&(v->ml)));
     87  return owl_messagelist_get_size(v->ml);
    9088}
    9189
     
    158156void owl_view_cleanup(owl_view *v)
    159157{
    160   owl_messagelist_cleanup(&v->ml, false);
     158  owl_messagelist_delete(v->ml, false);
    161159  g_free(v->name);
    162160}
  • zephyr.c

    rd953ede rf183917  
    697697  Code_t ret;
    698698  ZNotice_t notice;
     699  char *zsender = NULL;
    699700   
    700701  memset(&notice, 0, sizeof(notice));
     
    708709  notice.z_class=zstr(class);
    709710  notice.z_class_inst=zstr(instance);
    710   notice.z_sender=NULL;
    711   if (!strcmp(recipient, "*") || !strcmp(recipient, "@")) {
     711  if (!strcmp(recipient, "@")) {
    712712    notice.z_recipient=zstr("");
    713     if (*owl_global_get_zsender(&g))
    714         notice.z_sender=zstr(owl_global_get_zsender(&g));
    715713  } else {
    716714    notice.z_recipient=zstr(recipient);
    717715  }
     716  if (!owl_zwrite_recip_is_personal(recipient) && *owl_global_get_zsender(&g))
     717    notice.z_sender = zsender = long_zuser(owl_global_get_zsender(&g));
    718718  notice.z_default_format=zstr("Class $class, Instance $instance:\nTo: @bold($recipient) at $time $date\nFrom: @bold{$1 <$sender>}\n\n$2");
    719719  if (opcode) notice.z_opcode=zstr(opcode);
     
    730730  g_free(notice.z_message);
    731731  ZFreeNotice(&notice);
     732  g_free(zsender);
    732733  if (ret != ZERR_NONE) {
    733734    owl_function_error("Error sending zephyr: %s", error_message(ret));
     
    789790  } else if (!strcmp(retnotice->z_message, ZSRVACK_NOTSENT)) {
    790791    if (retnotice->z_recipient == NULL
    791         || *retnotice->z_recipient == 0
    792         || *retnotice->z_recipient == '@') {
     792        || !owl_zwrite_recip_is_personal(retnotice->z_recipient)) {
    793793      char *buff;
    794794      owl_function_error("No one subscribed to class %s", retnotice->z_class);
  • zwrite.c

    ref4074b r919cbf2  
    182182  }
    183183
    184   /* if there are no recipients we won't send a ping, which
    185      is what we want */
    186184  for (i = 0; i < z->recips->len; i++) {
    187185    to = owl_zwrite_get_recip_n_with_realm(z, i);
    188     send_ping(to, z->class, z->inst);
     186    if (owl_zwrite_recip_is_personal(to))
     187      send_ping(to, z->class, z->inst);
    189188    g_free(to);
    190189  }
     
    207206  g_free(z->message);
    208207
    209   if (z->recips->len > 0 && z->cc) {
     208  if (z->cc && owl_zwrite_is_personal(z)) {
    210209    message = g_string_new("CC: ");
    211210    for (i = 0; i < z->recips->len; i++) {
     
    338337}
    339338
    340 int owl_zwrite_is_personal(const owl_zwrite *z)
     339bool owl_zwrite_recip_is_personal(const char *recipient)
     340{
     341  return recipient[0] && recipient[0] != '@';
     342}
     343
     344bool owl_zwrite_is_personal(const owl_zwrite *z)
    341345{
    342346  /* return true if at least one of the recipients is personal */
    343347  int i;
    344   char *recip;
    345 
    346   for (i = 0; i < z->recips->len; i++) {
    347     recip = z->recips->pdata[i];
    348     if (recip[0] != '@') return 1;
    349   }
    350   return(0);
     348
     349  for (i = 0; i < z->recips->len; i++)
     350    if (owl_zwrite_recip_is_personal(z->recips->pdata[i]))
     351      return true;
     352  return false;
    351353}
    352354
Note: See TracChangeset for help on using the changeset viewer.