Changeset 4b660cc


Ignore:
Timestamp:
Dec 23, 2003, 4:13:43 PM (17 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
8b16467
Parents:
c65d81e
Message:
Now have a set of 'aaway' commands and variables just like the
  'zaway' ones (except that changing the 'aaway' variable talks to
  the server)
The new 'away' command does everything for both AIM *and* zephyr.
  There is a known funkiness here, where if you turn one away on,
  and then use 'away' (or 'A') to toggle, you will turn on off and
  the other on.  Just leaving it for now.  Should do better in the
  next patch.
The 'A' key is bound to 'away'
Status bar can now read AWAY, Z-AWAY or A-AWAY.
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rc65d81e r4b660cc  
    88          what most clients seem to do, in that an away reply is sent for
    99          each message received.  Most clients only reply to the first one
    10           per away-session.  Also, it's completely tied to the zaway
    11           functions, it should probably be separated out into aaway
    12           functions with a new "away" function that will get everything.
    13           Loop detection stuff should work and has been tested, but I'm
    14           not completely sure I did this right ... so odd behavior should
    15           be reported.
    16         New 'away' command, just an alias to zaway for now.
    17         'A' key now bound to 'away' command.
    18         In status bar "ZAWAY" is now "AWAY"
     10          per away-session.
     11        Now have a set of 'aaway' commands and variables just like the
     12          'zaway' ones (except that changing the 'aaway' variable talks to
     13          the server)
     14        The new 'away' command does everything for both AIM *and* zephyr.
     15          There is a known funkiness here, where if you turn one away on,
     16          and then use 'away' (or 'A') to toggle, you will turn on off and
     17          the other on.  Just leaving it for now.  Should do better in the
     18          next patch.
     19        The 'A' key is bound to 'away'
     20        Status bar can now read AWAY, Z-AWAY or A-AWAY.
    1921       
    20222.1.1-pre-1
  • commands.c

    rc65d81e r4b660cc  
    451451
    452452  OWLCMD_ARGS("zaway", owl_command_zaway, OWL_CTX_INTERACTIVE,
    453               "running a command from the shell",
     453              "Set, enable or disable zephyr away message",
    454454              "zaway [ on | off | toggle ]\n"
    455455              "zaway <message>",
    456               "Turn on or off the default zaway message.  If a message is\n"
    457               "specified turn on zaway with that message\n"),
    458   OWLCMD_ALIAS("away", "zaway"),
     456              "Turn on or off a zaway message.  If 'message' is\n"
     457              "specified turn on zaway with that message, otherwise\n"
     458              "use the default.\n"),
     459
     460  OWLCMD_ARGS("aaway", owl_command_aaway, OWL_CTX_INTERACTIVE,
     461              "Set, enable or disable AIM away message",
     462              "aaway [ on | off | toggle ]\n"
     463              "aaway <message>",
     464              "Turn on or off the AIM away message.  If 'message' is\n"
     465              "specified turn on aaway with that message, otherwise\n"
     466              "use the default.\n"),
     467
     468  OWLCMD_ARGS("away", owl_command_away, OWL_CTX_INTERACTIVE,
     469              "Set, enable or disable both AIM and zephyr away messages",
     470              "away [ on | off | toggle ]\n"
     471              "away <message>",
     472              "Turn on or off the AIM and zephyr away message.  If\n"
     473              "'message' is specified turn them on with that message,\n"
     474              "otherwise use the default.\n"
     475              "\n"
     476              "This command really just runs the 'aaway' and 'zaway'\n"
     477              "commands together\n"
     478              "\n"
     479              "SEE ALSO: aaway, zaway"),
    459480
    460481  OWLCMD_ARGS("load-subs", owl_command_loadsubs, OWL_CTX_ANY,
     
    13431364}
    13441365
     1366
     1367char *owl_command_aaway(int argc, char **argv, char *buff)
     1368{
     1369  if ((argc==1) ||
     1370      ((argc==2) && !strcmp(argv[1], "on"))) {
     1371    owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g));
     1372    owl_function_aaway_on();
     1373    return NULL;
     1374  }
     1375
     1376  if (argc==2 && !strcmp(argv[1], "off")) {
     1377    owl_function_aaway_off();
     1378    return NULL;
     1379  }
     1380
     1381  if (argc==2 && !strcmp(argv[1], "toggle")) {
     1382    owl_function_aaway_toggle();
     1383    return NULL;
     1384  }
     1385
     1386  buff = skiptokens(buff, 1);
     1387  owl_global_set_aaway_msg(&g, buff);
     1388  owl_function_aaway_on();
     1389  return NULL;
     1390}
     1391
     1392
     1393char *owl_command_away(int argc, char **argv, char *buff)
     1394{
     1395  owl_command_zaway(argc, argv, buff);
     1396  owl_command_aaway(argc, argv, buff);
     1397  return NULL;
     1398}
    13451399
    13461400char *owl_command_set(int argc, char **argv, char *buff)
  • functions.c

    r9854278 r4b660cc  
    863863{
    864864  owl_global_set_zaway_on(&g);
    865   owl_aim_set_awaymsg(owl_global_get_zaway_msg(&g));
    866   owl_function_makemsg("aim and zaway set (%s)", owl_global_get_zaway_msg(&g));
     865  owl_function_makemsg("zaway set (%s)", owl_global_get_zaway_msg(&g));
    867866}
    868867
     
    870869{
    871870  owl_global_set_zaway_off(&g);
    872   owl_aim_set_awaymsg("");
    873   owl_function_makemsg("aim and zaway off");
     871  owl_function_makemsg("zaway off");
     872}
     873
     874void owl_function_aaway_toggle()
     875{
     876  if (!owl_global_is_aaway(&g)) {
     877    owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g));
     878    owl_function_aaway_on();
     879  } else {
     880    owl_function_aaway_off();
     881  }
     882}
     883
     884void owl_function_aaway_on()
     885{
     886  owl_global_set_aaway_on(&g);
     887  /* owl_aim_set_awaymsg(owl_global_get_zaway_msg(&g)); */
     888  owl_function_makemsg("AIM away set (%s)", owl_global_get_aaway_msg(&g));
     889}
     890
     891void owl_function_aaway_off()
     892{
     893  owl_global_set_aaway_off(&g);
     894  /* owl_aim_set_awaymsg(""); */
     895  owl_function_makemsg("AIM away off");
    874896}
    875897
  • owl.h

    r952bb256 r4b660cc  
    138138
    139139#define OWL_DEFAULT_ZAWAYMSG    "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n"
     140#define OWL_DEFAULT_AAWAYMSG    "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n"
    140141
    141142#define OWL_INCLUDE_REG_TESTS   1  /* whether to build in regression tests */
  • util.c

    rc65d81e r4b660cc  
    7878  }
    7979
    80   if (owl_global_is_zaway(&g)) {
     80  if (owl_global_is_zaway(&g) || owl_global_is_aaway(&g)) {
    8181    getyx(sepwin, y, x);
    8282    wmove(sepwin, y, x+2);
    8383    wattron(sepwin, A_BOLD);
    8484    wattroff(sepwin, A_REVERSE);
    85     waddstr(sepwin, " AWAY ");
     85    if (owl_global_is_zaway(&g) && owl_global_is_aaway(&g)) {
     86      waddstr(sepwin, " AWAY ");
     87    } else if (owl_global_is_zaway(&g)) {
     88      waddstr(sepwin, " Z-AWAY ");
     89    } else if (owl_global_is_aaway(&g)) {
     90      waddstr(sepwin, " A-AWAY ");
     91    }
    8692    wattron(sepwin, A_REVERSE);
    8793    wattroff(sepwin, A_BOLD);
  • variable.c

    r5a95b69 r4b660cc  
    208208                 OWL_DEFAULT_ZAWAYMSG,
    209209                 "default zaway message", "" ),
     210
     211  OWLVAR_BOOL_FULL( "aaway" /* %OwlVarStub */, 0,
     212                    "Set AIM away status",
     213                    "",
     214                    NULL, owl_variable_aaway_set, NULL),
     215
     216  OWLVAR_STRING( "aaway_msg" /* %OwlVarStub */,
     217                 OWL_DEFAULT_AAWAYMSG,
     218                 "AIM away msg for responding when away", "" ),
     219
     220  OWLVAR_STRING( "aaway_msg_default" /* %OwlVarStub */,
     221                 OWL_DEFAULT_AAWAYMSG,
     222                 "default AIM away message", "" ),
    210223
    211224  OWLVAR_STRING( "view_home" /* %OwlVarStub */, "all",
     
    355368
    356369/* debug (cache value in g->debug) */
    357 
    358370int owl_variable_debug_set(owl_variable *v, void *newval) {
    359371  if (newval && (*(int*)newval == 1 || *(int*)newval == 0)) {
    360372    g.debug = *(int*)newval;
     373  }
     374  return owl_variable_bool_set_default(v, newval);
     375}
     376
     377/* When 'aaway' is changed, need to notify the AIM server */
     378int owl_variable_aaway_set(owl_variable *v, void *newval) {
     379  if (newval) {
     380    if (*(int*)newval == 1) {
     381      owl_aim_set_awaymsg(owl_global_get_aaway_msg(&g));
     382    } else if (*(int*)newval == 0) {
     383      owl_aim_set_awaymsg("");
     384    }
    361385  }
    362386  return owl_variable_bool_set_default(v, newval);
Note: See TracChangeset for help on using the changeset viewer.