Changeset f1e629d for message.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
  • message.c

    r9ceee9d rf1e629d  
    574574}
    575575
     576char *owl_message_get_type(owl_message *m) {
     577  switch (m->type) {
     578  case OWL_MESSAGE_TYPE_ADMIN:
     579    return("admin");
     580  case OWL_MESSAGE_TYPE_ZEPHYR:
     581    return("zephyr");
     582  case OWL_MESSAGE_TYPE_GENERIC:
     583    return("generic");
     584  case OWL_MESSAGE_TYPE_AIM:
     585    return("aim");
     586  case OWL_MESSAGE_TYPE_JABBER:
     587    return("jabber");
     588  case OWL_MESSAGE_TYPE_ICQ:
     589    return("icq");
     590  case OWL_MESSAGE_TYPE_YAHOO:
     591    return("yahoo");
     592  case OWL_MESSAGE_TYPE_MSN:
     593    return("msn");
     594  default:
     595    return("unknown");
     596  }
     597}
     598
     599char *owl_message_get_direction(owl_message *m) {
     600  switch (m->direction) {
     601  case OWL_MESSAGE_DIRECTION_IN:
     602    return("in");
     603  case OWL_MESSAGE_DIRECTION_OUT:
     604    return("out");
     605  case OWL_MESSAGE_DIRECTION_NONE:
     606    return("none");
     607  default:
     608    return("unknown");
     609  }
     610}
     611
     612char *owl_message_get_login(owl_message *m) {
     613  if (owl_message_is_login(m)) {
     614    return "login";
     615  } else if (owl_message_is_logout(m)) {
     616    return "logout";
     617  } else {
     618    return "none";
     619  }
     620}
     621
     622char *owl_message_get_header(owl_message *m) {
     623  return owl_message_get_attribute_value(m, "adminheader");
     624}
     625
    576626/* return 1 if the message contains "string", 0 otherwise.  This is
    577627 * case insensitive because the functions it uses are
     
    798848  owl_fmtext_free(&(m->fmtext));
    799849}
     850
     851
Note: See TracChangeset for help on using the changeset viewer.