[3134] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[barnowl/barnowl] 3eeb6e: Fixed a bug in the expunge command

daemon@ATHENA.MIT.EDU (noreply@github.com)
Sat Jul 9 16:12:25 2011

Date: Sat, 9 Jul 2011 13:12:23 -0700
To: barnowl-dev@mit.edu
From: noreply@github.com

  Branch: refs/heads/master
  Home:   https://github.com/barnowl/barnowl

  Commit: 3eeb6ed02736fb9bb741381dae049c4692cb4027
      https://github.com/barnowl/barnowl/commit/3eeb6ed02736fb9bb741381dae049c4692cb4027
  Author: Jason Gross <jgross@mit.edu>
  Date:   2011-07-09 (Sat, 09 Jul 2011)

  Changed paths:
    M functions.c

  Log Message:
  -----------
  Fixed a bug in the expunge command

Expunging from past the end of the message list (e.g., the key strokes
d > > x) no longer brings you to the first message.  Additionally, the
code in owl_function_expunge that is relevant to redisplaying after
messages are removed from the message list was placed in helper
functions, in preparation for the next commit.


  Commit: efeec7f945a0024cc21af30c2e6c2110bb5d3c6b
      https://github.com/barnowl/barnowl/commit/efeec7f945a0024cc21af30c2e6c2110bb5d3c6b
  Author: Jason Gross <jgross@mit.edu>
  Date:   2011-07-09 (Sat, 09 Jul 2011)

  Changed paths:
    M commands.c
  M functions.c
  M messagelist.c

  Log Message:
  -----------
  Added a delete-and-expunge command.

This command is analogous to the delete command, except that it also
expunges only the {current,given} message.  It also takes an optional
--quiet parameter, because I plan to use it internally and don't want
spew on success.  Perhaps there's a better way to accomplish this...

I couldn't figure out how the existing delete command is supposed to
work internally.  The logic behind the delete-and-expunge command is as
follows:
We always update both the message list and the display.  So model the
command that will do much of the work,
owl_function_delete_and_expunge_message, off of owl_function_expunge.
owl_function_delete_and_expunge_message takes one argument, which is the
position of the item in the message list.  It deletes it from the
message list with a new function
owl_messagelist_delete_and_expunge_element.  This calls delete on the
underlying owl_list, so the errors (if any) on an index that is too big
might be unhelpful.

owl_function_delete_and_expunge_cur and
owl_function_delete_and_expunge_by_id both get the index of the relevant
message (and a function owl_messagelist_get_index_by_id is added to
messagelist.c to help the latter).  They owl_function_error if no such
message exists, and conditionally owl_function_makemsg on success.


  Commit: a130fc5ed65377322966cc9423b3e4674197922c
      https://github.com/barnowl/barnowl/commit/a130fc5ed65377322966cc9423b3e4674197922c
  Author: Jason Gross <jgross@mit.edu>
  Date:   2011-07-09 (Sat, 09 Jul 2011)

  Changed paths:
    M perl/lib/BarnOwl.pm
  M perl/lib/BarnOwl/Message.pm
  M perlglue.xs

  Log Message:
  -----------
  Improved ability to delete messages from perl

BarnOwl::Message now has a delete_and_expunge command, and
BarnOwl::queue_message returns the queued message, so that deletion
actually works; there used to be no way to get the id of a queued
message, and so ->delete() didn't actually do anything...


Compare: https://github.com/barnowl/barnowl/compare/786a410...a130fc5

home help back first fref pref prev next nref lref last post