Changeset f1e629d for commands.c


Ignore:
Timestamp:
Jul 6, 2003, 6:42:06 PM (21 years ago)
Author:
Erik Nygren <nygren@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
5d9c664
Parents:
675ce49
Message:
	New API for perl message formatting functions.
	        Legacy variables are still supported for owl::format_msg
		and owl::receive_msg, but these functions are now also
		passed an owl::Message object which contains methods
		for accessing the contents of the message.  See perlwrap.pm
		(and docs TBD) for the available methods.
		*** WARNING:  The exact API for owl::Message has
		*** not yet stabilized.
	Added "style" command for creating new styles.
	        Usage:  style <name> perl <function_name>
	Added support for "show styles".  Changed global style table
	        from list to dictionary.
	Changed AIM password prompt from "Password:" to "AIM Password:".
	Messages are reformatted after a window resize to allow styles
	        to take into account the width of the window.
	When perl throws an error, the message is put in the msgwin
	        if possible.
	Added perl functions for:
	        owl::getcurmsg() -- returns an owl::Message object for
		                    the active message
		                    in the current view.
	        owl::getnumcols() -- returns the column width of the window
		owl::zephyr_getrealm() -- returns the zephyr realm
	        owl::zephyr_getsender() -- returns the zephyr sender
	Made owl::COMMAND("foo"); be syntactic sugar for
	        owl::command("COMMAND foo");
		*** Is this a good or bad idea?
		*** This feature may be taken out before release.
	Added perlwrap.pm to contain perl code to be compiled into
	        the binary.  This is transformed into perlwrap.c by
		encapsulate.pl.
	Renamed readconfig.c to perlconfig.c and changed variables accordingly.
	Minor bugfixes in cmd.c and commands.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r6873455 rf1e629d  
    101101              "Use 'show keymaps' to see the existing keymaps.\n"
    102102              "Key sequences may be things like M-C-t or NPAGE.\n"),
     103
     104  OWLCMD_ARGS("style", owl_command_style, OWL_CTX_ANY,
     105              "creates a new style",
     106              "style <name> perl <function_name>",
     107              "Creates a new style for formatting messages.\n"
     108              "A style named <name> will be created that will\n"
     109              "format messages using the perl function <function_name>.\n\n"
     110              "SEE ALSO: show styles, view -s, filter -s\n"),
    103111
    104112  OWLCMD_ARGS("zwrite", owl_command_zwrite, OWL_CTX_INTERACTIVE,
     
    567575              "show subscriptions\n"
    568576              "show zpunts\n"
     577              "show styles\n"
    569578              "show colors\n"
    570579              "show terminal\n"
     
    583592              "Show commands will list the names of all keymaps.\n"
    584593              "Show command <command> will provide information about a command.\n\n"
     594              "Show styles will list the names of all styles available\n"
     595              "for formatting messages.\n\n"
    585596              "Show variables will list the names of all variables.\n\n"
    586597              "SEE ALSO: filter, view, alias, bindkey, help\n"),
     
    14131424
    14141425  if (argc < 5 || strcmp(argv[3], "command")) {
    1415     owl_function_makemsg("Usage: bindkey <keymap> <binding> command <cmd>", argv[3], argc);
     1426    owl_function_makemsg("Usage: bindkey <keymap> <binding> command <cmd>");
    14161427    return NULL;
    14171428  }
     
    14301441  return NULL;
    14311442}
     1443
     1444char *owl_command_style(int argc, char **argv, char *buff) {
     1445  owl_style *s;
     1446
     1447  /* Usage: style <name> perl <function> */
     1448  if (argc != 4 || strcmp(argv[2], "perl")) {
     1449    owl_function_makemsg("Usage: style <name> perl <function>");
     1450    return NULL;
     1451  }
     1452  if (!owl_perlconfig_is_function(argv[3])) {
     1453    owl_function_makemsg("Unable to create style '%s': no perl function '%s'",
     1454                         argv[1], argv[3]);
     1455    return NULL;
     1456  }
     1457  s=owl_malloc(sizeof(owl_style));
     1458  owl_style_create_perl(s, argv[1], argv[3], NULL);
     1459  owl_global_add_style(&g, s);
     1460
     1461  return NULL;
     1462}
     1463
    14321464
    14331465void owl_command_quit()
     
    18641896  } else if (!strcmp(argv[1], "colors")) {
    18651897    owl_function_show_colors();
     1898  } else if (!strcmp(argv[1], "styles")) {
     1899    owl_function_show_styles();
    18661900  } else if (!strcmp(argv[1], "subs") || !strcmp(argv[1], "subscriptions")) {
    18671901    owl_function_getsubs();
     
    21152149  if (argc==2) {
    21162150    owl_global_set_buffercommand(&g, buff);
    2117     owl_function_start_password("Password: ");
     2151    owl_function_start_password("AIM Password: ");
    21182152    return(NULL);
    21192153  }
Note: See TracChangeset for help on using the changeset viewer.