Changeset 315babf


Ignore:
Timestamp:
May 16, 2009, 2:55:30 AM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
d73e3af
Parents:
b8bf727 (diff), 73ba824 (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 branch 'mark'
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r790ab12 r73ba824  
    336336  OWLCMD_VOID("recv:pageup", owl_function_mainwin_pageup, OWL_CTX_INTERACTIVE,
    337337              "scrolls up by a page", "", ""),
     338
     339  OWLCMD_VOID("recv:mark", owl_function_mark_message,
     340              OWL_CTX_INTERACTIVE,
     341              "mark the current message", "", ""),
     342
     343  OWLCMD_VOID("recv:swapmark", owl_function_swap_cur_marked,
     344              OWL_CTX_INTERACTIVE,
     345              "swap the positions of the pointer and the mark", "", ""),
    338346
    339347  OWLCMD_INT ("recv:scroll", owl_function_page_curmsg, OWL_CTX_INTERACTIVE,
  • functions.c

    r0cb6c26 r3d08168  
    35323532  sigprocmask(SIG_UNBLOCK, &intr, oldmask);
    35333533}
     3534
     3535void _owl_function_mark_message(owl_message *m)
     3536{
     3537  if (m)
     3538    owl_global_set_markedmsgid(&g, owl_message_get_id(m));
     3539}
     3540
     3541void owl_function_mark_message()
     3542{
     3543  owl_message *m;
     3544  owl_view *v;
     3545
     3546  v=owl_global_get_current_view(&g);
     3547
     3548  /* bail if there's no current message */
     3549  if (owl_view_get_size(v) < 1) {
     3550    owl_function_error("No messages to mark");
     3551    return;
     3552  }
     3553
     3554  /* mark the message */
     3555  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
     3556  _owl_function_mark_message(m);
     3557  owl_function_makemsg("Mark set");
     3558}
     3559
     3560void owl_function_swap_cur_marked()
     3561{
     3562  int marked_id;
     3563  owl_message *m;
     3564  owl_view *v;
     3565
     3566  marked_id=owl_global_get_markedmsgid(&g);
     3567  if (marked_id == -1) {
     3568    owl_function_error("Mark not set.");
     3569    return;
     3570  }
     3571
     3572  v=owl_global_get_current_view(&g);
     3573  /* bail if there's no current message */
     3574  if (owl_view_get_size(v) < 1) {
     3575    return;
     3576  }
     3577
     3578  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
     3579  _owl_function_mark_message(m);
     3580  owl_global_set_curmsg(&g, owl_view_get_nearest_to_msgid(v, marked_id));
     3581  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
     3582  owl_global_set_direction_downwards(&g);
     3583}
  • global.c

    r0cb6c26 rbd783db  
    3535  g->curmsg=0;
    3636  g->topmsg=0;
     37  g->markedmsgid=-1;
    3738  g->needrefresh=1;
    3839  g->startupargs=NULL;
     
    199200}
    200201
     202/* markedmsgid */
     203
     204int owl_global_get_markedmsgid(owl_global *g) {
     205  return(g->markedmsgid);
     206}
     207
     208void owl_global_set_markedmsgid(owl_global *g, int i) {
     209  g->markedmsgid=i;
     210  /* i; index of message in the current view.
     211  owl_message *m;
     212  owl_view *v;
     213
     214  v = owl_global_get_current_view(&g);
     215  m = owl_view_get_element(v, i);
     216  g->markedmsgid = m ? owl_message_get_id(m) : 0;
     217  */
     218}
     219
    201220/* windows */
    202221
  • keys.c

    rce56149 r70110286  
    263263  BIND_CMD("M-v",    "recv:pageup",    "");
    264264  BIND_CMD("PPAGE",  "recv:pageup",    "");
     265  BIND_CMD("C-@",    "recv:mark",      "");
     266  BIND_CMD("C-x C-x",    "recv:swapmark",  "");
    265267
    266268  BIND_CMD("SPACE",     "recv:scroll  10", "scroll message down a page");
  • owl.h

    re1b136bf rbd783db  
    536536  int lines, cols;
    537537  int curmsg, topmsg;
     538  int markedmsgid;              /* for finding the marked message when it has moved. */
    538539  int curmsg_vert_offset;
    539540  owl_view current_view;
  • owl.c

    re0473d2 rb8bf727  
    243243  f=owl_malloc(sizeof(owl_filter));
    244244  owl_filter_init_fromstring(f, "personal", "isprivate ^true$ and ( not type ^zephyr$"
    245                              " or ( class ^message and"
    246                              " ( instance ^personal$ or instance ^urgent$ ) ) )");
     245                             " or ( class ^message  ) )");
    247246  owl_list_append_element(owl_global_get_filterlist(&g), f);
    248247
  • perl/modules/IRC/lib/BarnOwl/Message/IRC.pm

    rf79d6a2 rdfaa47d  
    7070sub context {shift->{network};}
    7171sub subcontext {shift->{recipient};}
     72sub personal_context {"on " . shift->{network};}
    7273
    7374sub long_sender {shift->{from} || ""};
  • perl/modules/Jabber/lib/BarnOwl/Message/Jabber.pm

    r9375f8c rcdaf294  
    5050sub subcontext {
    5151    return shift->subject || "";
     52}
     53
     54sub personal_context {
     55    my $self = shift;
     56    if ($self->is_incoming) {
     57        return "to " . $self->to;
     58    } else {
     59        return "from " . $self->from;
     60    }
    5261}
    5362
  • perlwrap.pm

    r2b6de9d rdfaa47d  
    390390sub pretty_sender    { return shift->sender; }
    391391sub pretty_recipient { return shift->recipient; }
     392
     393# Override if you want a context (instance, network, etc.) on personals
     394sub personal_context { return ""; }
    392395
    393396sub delete {
     
    584587    my ($m) = @_;
    585588    return ((lc($m->class) eq "message")
    586             && (lc($m->instance) eq "personal")
    587589            && $m->is_private);
    588590}
     
    601603    my ($m) = @_;
    602604    return strip_realm($m->recipient);
     605}
     606
     607sub personal_context {
     608    my ($m) = @_;
     609    if (lc($m->instance) eq "personal") {
     610        return "";
     611    } else {
     612        return "-i " . $m->instance;
     613    }
    603614}
    604615
     
    10231034    my $header;
    10241035    if ( $m->is_personal ) {
     1036        my $personal_context = $m->personal_context;
     1037        $personal_context = ' [' . $personal_context . ']' if $personal_context;
     1038
    10251039        if ( $m->direction eq "out" ) {
    1026             $header = ucfirst $m->type . " sent to " . $m->pretty_recipient;
     1040            $header = ucfirst $m->type . $personal_context . " sent to " . $m->pretty_recipient;
    10271041        } else {
    1028             $header = ucfirst $m->type . " from " . $m->pretty_sender;
     1042            $header = ucfirst $m->type . $personal_context . " from " . $m->pretty_sender;
    10291043        }
    10301044    } else {
Note: See TracChangeset for help on using the changeset viewer.