Changeset dd16bdd for message.c


Ignore:
Timestamp:
Oct 27, 2006, 1:19:54 AM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
1b6b2f3
Parents:
39c036d
Message:
Initial support for creating and injecting messages into the
display. Note that at the moment, you can easily segfault owl from
perl by injecting messages that don't contain fields owl assumes they
will.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    r8298425 rdd16bdd  
    341341  m->type=OWL_MESSAGE_TYPE_AIM;
    342342}
     343
     344void owl_message_set_type(owl_message *m, int type)
     345{
     346  m->type=type;
     347}
    343348                                               
    344349int owl_message_is_type_admin(owl_message *m)
     
    396401{
    397402  m->direction=OWL_MESSAGE_DIRECTION_NONE;
     403}
     404
     405void owl_message_set_direction(owl_message *m, int direction)
     406{
     407  m->direction=direction;
    398408}
    399409
     
    631641}
    632642
     643int owl_message_parse_type(char *type) {
     644  if(!strcmp(type, "admin")) {
     645    return OWL_MESSAGE_TYPE_ADMIN;
     646  } else if(!strcmp(type, "zephyr")) {
     647    return OWL_MESSAGE_TYPE_ZEPHYR;
     648  } if(!strcmp(type, "aim")) {
     649    return OWL_MESSAGE_TYPE_AIM;
     650  } else if(!strcmp(type, "jabber")) {
     651    return OWL_MESSAGE_TYPE_JABBER;
     652  } else if(!strcmp(type, "icq")) {
     653    return OWL_MESSAGE_TYPE_ICQ;
     654  } else if(!strcmp(type, "yahoo")) {
     655    return OWL_MESSAGE_TYPE_YAHOO;
     656  } else if(!strcmp(type, "msn")) {
     657    return OWL_MESSAGE_TYPE_MSN;
     658  } else if(!strcmp(type, "loopback")) {
     659    return OWL_MESSAGE_TYPE_LOOPBACK;
     660  } else {
     661    return OWL_MESSAGE_TYPE_GENERIC;
     662  }
     663}
     664
    633665char *owl_message_get_direction(owl_message *m) {
    634666  switch (m->direction) {
     
    644676}
    645677
     678int owl_message_parse_direction(char *d) {
     679  if(!strcmp(d, "in")) {
     680    return OWL_MESSAGE_DIRECTION_IN;
     681  } else if(!strcmp(d, "out")) {
     682    return OWL_MESSAGE_DIRECTION_OUT;
     683  } else {
     684    return OWL_MESSAGE_DIRECTION_NONE;
     685  }
     686}
     687
     688
    646689char *owl_message_get_login(owl_message *m) {
    647690  if (owl_message_is_login(m)) {
     
    653696  }
    654697}
     698
    655699
    656700char *owl_message_get_header(owl_message *m) {
Note: See TracChangeset for help on using the changeset viewer.