Changeset 0ff8fb57


Ignore:
Timestamp:
Jun 1, 2003, 1:46:49 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:
31e48a3
Parents:
440ce01
Message:
More AIM work.
The auto-prototype building has been re-enabled as well.
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    rd09e5a1 r0ff8fb57  
    3434OBJS = $(BASE_OBJS) $(GEN_O)
    3535
    36 #AUTOGEN=$(GEN_C) $(GEN_H)
    37 AUTOGEN=$(GEN_C)
     36AUTOGEN=$(GEN_C) $(GEN_H)
     37#AUTOGEN=$(GEN_C)
    3838
    3939
     
    5353        $(RM) config.cache config.log config.status Makefile config.h TAGS *~ core
    5454
    55 #proto: owl_prototypes.h
     55proto: owl_prototypes.h
    5656
    5757perlglue.c: perlglue.xs
     
    6262
    6363# Only move owl_prototypes.h into place if the new one is different
    64 #owl_prototypes.h: codelist.pl varstubs.c $(BASE_SRCS)
    65 #       perl codelist.pl | grep -v ZWRITEOPTIONS > owl_prototypes.h.new
    66 #       @cmp -s owl_prototypes.h.new $@ || { \
    67 #        echo 'Interfaces changed!'; \
    68 #        echo mv -f owl_prototypes.h.new $@; \
    69 #             mv -f owl_prototypes.h.new $@; }
    70 owl_prototypes.h:
     64owl_prototypes.h: codelist.pl varstubs.c $(BASE_SRCS)
     65        perl codelist.pl > owl_prototypes.h.new
     66        @cmp -s owl_prototypes.h.new $@ || { \
     67         echo 'Interfaces changed!'; \
     68         echo mv -f owl_prototypes.h.new $@; \
     69              mv -f owl_prototypes.h.new $@; }
     70#owl_prototypes.h:
    7171
    7272.PHONY: tags clean distclean proto test
     
    7777        etags $(BASE_SRCS) $(OWL_SRC) $(TESTER_SRC) $(GEN_C) owl.h $(GEN_H)
    7878
    79 #$(BASE_OBJS) varstubs.h:: owl.h config.h owl_prototypes.h
    80 $(BASE_OBJS) varstubs.h:: owl.h config.h
     79$(BASE_OBJS) varstubs.h:: owl.h config.h owl_prototypes.h
     80#$(BASE_OBJS) varstubs.h:: owl.h config.h
    8181
    8282libfaim: libfaim/libfaim.a
  • aim.c

    r440ce01 r0ff8fb57  
    2626};
    2727
     28/*
    2829static char *msgerrreasons[] = {
    2930        "Invalid error",
     
    5455};
    5556static int msgerrreasonslen = 25;
     57*/
    5658
    5759static void faimtest_debugcb(aim_session_t *sess, int level, const char *format, va_list va);
     
    168170{
    169171  aim_send_im(owl_global_get_aimsess(&g), to, AIM_IMFLAGS_ACK, msg);
     172
     173  /* I don't know how to check for an error yet */
     174  return(0);
    170175}
    171176
     
    180185int owl_aim_chat_sendmsg(char *chatroom, char *msg)
    181186{
     187  return(0);
    182188}
    183189
    184190int owl_aim_process_events() {
    185   int ret;
    186191  aim_session_t *aimsess;
    187192  aim_conn_t *waitingconn = NULL;
     
    241246  /* free(priv->buddyicon); */
    242247  /* exit(0); */
     248  return(0);
    243249}
    244250
     
    386392static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...)
    387393{
    388   struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
    389394  char buddies[128]; /* this is the new buddy list */
    390395  char profile[256]; /* this is the new profile */
     
    406411
    407412  /*aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_BUDDYICON | AIM_CAPS_CHAT | AIM_CAPS_GETFILE | AIM_CAPS_SENDFILE | AIM_CAPS_IMIMAGE | AIM_CAPS_GAMES | AIM_CAPS_SAVESTOCKS | AIM_CAPS_SENDBUDDYLIST | AIM_CAPS_ICQ | AIM_CAPS_ICQUNKNOWN | AIM_CAPS_ICQRTF | AIM_CAPS_ICQSERVERRELAY | AIM_CAPS_TRILLIANCRYPT); */
    408   aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_SENDBUDDYLIST | AIM_CAPS_CHAT | AIM_CAPS_ICQ | AIM_CAPS_ICQUNKNOWN | AIM_CAPS_ICQRTF | AIM_CAPS_ICQSERVERRELAY | AIM_CAPS_TRILLIANCRYPT);
     413  aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_SENDBUDDYLIST | AIM_CAPS_CHAT );
    409414  aim_bos_reqbuddyrights(sess, fr->conn);
    410415
     
    473478int logout(aim_session_t *sess)
    474479{
    475   struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
    476 
    477480  aim_session_kill(sess);
    478481
     
    674677static int faimtest_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...)
    675678{
     679  char *msg;
     680  fu16_t id;
     681  va_list ap;
     682  /* static int codeslen = 5;
    676683  static char *codes[] = {
    677684    "Unknown",
     
    681688    "Top o' the world!"
    682689  };
    683   static int codeslen = 5;
    684   char *msg;
    685   fu16_t id;
    686   va_list ap;
    687  
     690  */
     691
    688692  return 1;
    689693 
     
    14621466static int faimtest_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...)
    14631467{
     1468  /*
    14641469  static char *missedreasons[] = {
    14651470    "Invalid (0)",
     
    14691474    "Evil Receiver"
    14701475  };
    1471   static int missedreasonslen = 5;
     1476  static int missedreasonslen = 5; */
    14721477 
    14731478  va_list ap;
     
    15081513static int faimtest_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...)
    15091514{
     1515  /*
    15101516  static char *codes[5] = {
    15111517    "invalid",
     
    15151521    "limit cleared"
    15161522  };
     1523  */
    15171524  va_list ap;
    15181525  fu16_t code, rateclass;
     
    15871594  va_list ap;
    15881595  char *address, *SNs;
    1589   int i, num;
     1596  int num;
     1597  /* int i; */
    15901598 
    15911599  va_start(ap, fr);
     
    17481756  va_list ap;
    17491757  aim_userinfo_t *userinfo;
    1750   int count, i;
     1758  int count;
     1759  /* int i; */
    17511760 
    17521761  va_start(ap, fr);
     
    17651774static int faimtest_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...)
    17661775{
    1767   va_list ap;
    17681776  aim_userinfo_t *userinfo;
    1769   int count , i;
     1777  va_list ap;
     1778  int count;
     1779  /* int i; */
     1780
    17701781 
    17711782  va_start(ap, fr);
     
    17891800  struct aim_chat_roominfo *roominfo;
    17901801  char *roomname;
    1791   int usercount, i;
     1802  int usercount;
    17921803  char *roomdesc;
    17931804  fu16_t flags, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
    17941805  fu32_t creationtime;
    17951806  const char *croomname;
     1807  /* int i; */
    17961808 
    17971809  croomname = aim_chat_getname(fr->conn);
     
    18751887    int maxrooms;
    18761888    struct aim_chat_exchangeinfo *exchanges;
    1877     int exchangecount, i;
     1889    int exchangecount;
     1890    /* int i; */
    18781891   
    18791892    maxrooms = va_arg(ap, int);
  • codelist.pl

    r4594d83 r0ff8fb57  
    2020            && !/^system/
    2121            && !/^XS/
    22             && !/\/\*/) {
     22            && !/\/\*/
     23            && !/ZWRITEOPTIONS/
     24            && !/owlfaim_priv/)
     25        {
    2326            s/\s+\{/\;/;
    2427            s/\)[ \t]*$/\)\;/;
  • commands.c

    rd09e5a1 r0ff8fb57  
    13761376
    13771377char *owl_command_aimwrite(int argc, char **argv, char *buff) {
    1378   char *tmpbuff, *pos, *cmd, *msg;
     1378  char *tmpbuff;
    13791379
    13801380  if (argc < 2) {
  • functions.c

    r440ce01 r0ff8fb57  
    12971297  owl_fmtext_append_normal(&fm, "\n");
    12981298
     1299  owl_fmtext_append_normal(&fm, "Sender    : ");
     1300  owl_fmtext_append_normal(&fm, owl_message_get_sender(m));
     1301  owl_fmtext_append_normal(&fm, "\n");
     1302
     1303  owl_fmtext_append_normal(&fm, "Recipient : ");
     1304  owl_fmtext_append_normal(&fm, owl_message_get_recipient(m));
     1305  owl_fmtext_append_normal(&fm, "\n");
     1306
     1307
    12991308  if (owl_message_is_type_zephyr(m)) {
    1300 
     1309    owl_fmtext_append_bold(&fm, "  Zephyr Specific Info\n");
     1310   
    13011311    if (owl_message_is_direction_in(m)) {
    13021312      n=owl_message_get_notice(m);
     
    13061316      owl_fmtext_append_normal(&fm, "Instance  : ");
    13071317      owl_fmtext_append_normal(&fm, owl_message_get_instance(m));
    1308       owl_fmtext_append_normal(&fm, "\n");
    1309       owl_fmtext_append_normal(&fm, "Sender    : ");
    1310       owl_fmtext_append_normal(&fm, owl_message_get_sender(m));
    1311       owl_fmtext_append_normal(&fm, "\n");
    1312       owl_fmtext_append_normal(&fm, "Recipient : ");
    1313       owl_fmtext_append_normal(&fm, owl_message_get_recipient(m));
    13141318      owl_fmtext_append_normal(&fm, "\n");
    13151319      owl_fmtext_append_normal(&fm, "Opcode    : ");
     
    13841388        }
    13851389       
    1386         /* just for testing for now */
    13871390        for (j=0; j<strlen(tmpbuff); j++) {
    13881391          if (tmpbuff[j]=='\n') tmpbuff[j]='~';
     
    13971400      owl_fmtext_append_normal(&fm, n->z_default_format);
    13981401    }
     1402  }
     1403
     1404  if (owl_message_is_type_aim(m)) {
     1405
    13991406  }
    14001407 
  • message.c

    r440ce01 r0ff8fb57  
    1414static const char fileIdent[] = "$Id$";
    1515
    16 void owl_message_init(owl_message *m) {
     16void owl_message_init(owl_message *m)
     17{
    1718  time_t t;
    1819
     
    3233}
    3334
    34 void owl_message_set_attribute(owl_message *m, char *attrname, char *attrvalue) {
     35void owl_message_set_attribute(owl_message *m, char *attrname, char *attrvalue)
     36{
    3537  /* add the named attribute to the message.  If an attribute with the
    3638     name already exists, replace the old value with the new value */
     
    5860}
    5961
    60 char *owl_message_get_attribute_value(owl_message *m, char *attrname) {
     62char *owl_message_get_attribute_value(owl_message *m, char *attrname)
     63{
    6164  /* return the value associated with the named attribute, or NULL if
    6265     the attribute does not exist */
     
    7679
    7780
    78 owl_fmtext *owl_message_get_fmtext(owl_message *m) {
     81owl_fmtext *owl_message_get_fmtext(owl_message *m)
     82{
    7983  return(&(m->fmtext));
    8084}
    8185
    82 void owl_message_set_class(owl_message *m, char *class) {
     86void owl_message_set_class(owl_message *m, char *class)
     87{
    8388  owl_message_set_attribute(m, "class", class);
    8489}
    8590
    86 char *owl_message_get_class(owl_message *m) {
     91char *owl_message_get_class(owl_message *m)
     92{
    8793  char *class;
    8894
     
    9298}
    9399
    94 void owl_message_set_instance(owl_message *m, char *inst) {
     100void owl_message_set_instance(owl_message *m, char *inst)
     101{
    95102  owl_message_set_attribute(m, "instance", inst);
    96103}
    97104
    98 char *owl_message_get_instance(owl_message *m) {
     105char *owl_message_get_instance(owl_message *m)
     106{
    99107  char *instance;
    100108
     
    104112}
    105113
    106 void owl_message_set_sender(owl_message *m, char *sender) {
     114void owl_message_set_sender(owl_message *m, char *sender)
     115{
    107116  owl_message_set_attribute(m, "sender", sender);
    108117}
    109118
    110 char *owl_message_get_sender(owl_message *m) {
     119char *owl_message_get_sender(owl_message *m)
     120{
    111121  char *sender;
    112122
     
    116126}
    117127
    118 void owl_message_set_zsig(owl_message *m, char *zsig) {
     128void owl_message_set_zsig(owl_message *m, char *zsig)
     129{
    119130  owl_message_set_attribute(m, "zsig", zsig);
    120131}
    121132
    122 char *owl_message_get_zsig(owl_message *m) {
     133char *owl_message_get_zsig(owl_message *m)
     134{
    123135  char *zsig;
    124136
     
    128140}
    129141
    130 void owl_message_set_recipient(owl_message *m, char *recip) {
     142void owl_message_set_recipient(owl_message *m, char *recip)
     143{
    131144  owl_message_set_attribute(m, "recipient", recip);
    132145}
    133146
    134 char *owl_message_get_recipient(owl_message *m) {
     147char *owl_message_get_recipient(owl_message *m)
     148{
    135149  /* this is stupid for outgoing messages, we need to fix it. */
    136150
    137151  char *recip;
    138      
    139   if (m->type==OWL_MESSAGE_TYPE_ZEPHYR) {
    140     recip=owl_message_get_attribute_value(m, "recipient");
    141   } else if (owl_message_is_direction_out(m)) {
    142     recip=m->zwriteline;
    143   } else {
    144     recip=owl_message_get_attribute_value(m, "recipient");
    145   }
     152
     153  recip=owl_message_get_attribute_value(m, "recipient");
    146154  if (!recip) return("");
    147155  return(recip);
    148156}
    149157
    150 void owl_message_set_realm(owl_message *m, char *realm) {
     158void owl_message_set_realm(owl_message *m, char *realm)
     159{
    151160  owl_message_set_attribute(m, "realm", realm);
    152161}
    153162
    154 char *owl_message_get_realm(owl_message *m) {
     163char *owl_message_get_realm(owl_message *m)
     164{
    155165  char *realm;
    156166 
     
    160170}
    161171
    162 void owl_message_set_body(owl_message *m, char *body) {
     172void owl_message_set_body(owl_message *m, char *body)
     173{
    163174  owl_message_set_attribute(m, "body", body);
    164175}
    165176
    166 char *owl_message_get_body(owl_message *m) {
     177char *owl_message_get_body(owl_message *m)
     178{
    167179  char *body;
    168180
     
    173185
    174186
    175 void owl_message_set_opcode(owl_message *m, char *opcode) {
     187void owl_message_set_opcode(owl_message *m, char *opcode)
     188{
    176189  owl_message_set_attribute(m, "opcode", opcode);
    177190}
    178191
    179 char *owl_message_get_opcode(owl_message *m) {
     192char *owl_message_get_opcode(owl_message *m)
     193{
    180194  char *opcode;
    181195
     
    185199}
    186200
    187 char *owl_message_get_timestr(owl_message *m) {
     201char *owl_message_get_timestr(owl_message *m)
     202{
    188203  return(m->time);
    189204}
    190205
    191 void owl_message_set_type_admin(owl_message *m) {
     206void owl_message_set_type_admin(owl_message *m)
     207{
    192208  m->type=OWL_MESSAGE_TYPE_ADMIN;
    193209}
    194210
    195 void owl_message_set_type_zephyr(owl_message *m) {
     211void owl_message_set_type_zephyr(owl_message *m)
     212{
    196213  m->type=OWL_MESSAGE_TYPE_ZEPHYR;
    197214}
    198215
    199 void owl_message_set_type_aim(owl_message *m) {
     216void owl_message_set_type_aim(owl_message *m)
     217{
    200218  m->type=OWL_MESSAGE_TYPE_AIM;
    201219}
    202220                                               
    203 int owl_message_is_type_admin(owl_message *m) {
     221int owl_message_is_type_admin(owl_message *m)
     222{
    204223  if (m->type==OWL_MESSAGE_TYPE_ADMIN) return(1);
    205224  return(0);
    206225}
    207226
    208 int owl_message_is_type_zephyr(owl_message *m) {
     227int owl_message_is_type_zephyr(owl_message *m)
     228{
    209229  if (m->type==OWL_MESSAGE_TYPE_ZEPHYR) return(1);
    210230  return(0);
    211231}
    212232
    213 int owl_message_is_type_aim(owl_message *m) {
     233int owl_message_is_type_aim(owl_message *m)
     234{
    214235  if (m->type==OWL_MESSAGE_TYPE_AIM) return(1);
    215236  return(0);
    216237}
    217238
    218 int owl_message_is_type_generic(owl_message *m) {
     239int owl_message_is_type_generic(owl_message *m)
     240{
    219241  if (m->type==OWL_MESSAGE_TYPE_GENERIC) return(1);
    220242  return(0);
    221243}
    222244
    223 char *owl_message_get_text(owl_message *m) {
     245char *owl_message_get_text(owl_message *m)
     246{
    224247  return(owl_fmtext_get_text(&(m->fmtext)));
    225248}
    226249
    227 void owl_message_set_direction_in(owl_message *m) {
     250void owl_message_set_direction_in(owl_message *m)
     251{
    228252  m->direction=OWL_MESSAGE_DIRECTION_IN;
    229253}
    230254
    231 void owl_message_set_direction_out(owl_message *m) {
     255void owl_message_set_direction_out(owl_message *m)
     256{
    232257  m->direction=OWL_MESSAGE_DIRECTION_OUT;
    233258}
    234259
    235 void owl_message_set_direction_none(owl_message *m) {
     260void owl_message_set_direction_none(owl_message *m)
     261{
    236262  m->direction=OWL_MESSAGE_DIRECTION_NONE;
    237263}
    238264
    239 int owl_message_is_direction_in(owl_message *m) {
     265int owl_message_is_direction_in(owl_message *m)
     266{
    240267  if (m->direction==OWL_MESSAGE_DIRECTION_IN) return(1);
    241268  return(0);
    242269}
    243270
    244 int owl_message_is_direction_out(owl_message *m) {
     271int owl_message_is_direction_out(owl_message *m)
     272{
    245273  if (m->direction==OWL_MESSAGE_DIRECTION_OUT) return(1);
    246274  return(0);
    247275}
    248276
    249 int owl_message_is_direction_none(owl_message *m) {
     277int owl_message_is_direction_none(owl_message *m)
     278{
    250279  if (m->direction==OWL_MESSAGE_DIRECTION_NONE) return(1);
    251280  return(0);
    252281}
    253282
    254 int owl_message_get_numlines(owl_message *m) {
     283int owl_message_get_numlines(owl_message *m)
     284{
    255285  if (m == NULL) return(0);
    256286  return(owl_fmtext_num_lines(&(m->fmtext)));
    257287}
    258288
    259 void owl_message_mark_delete(owl_message *m) {
     289void owl_message_mark_delete(owl_message *m)
     290{
    260291  if (m == NULL) return;
    261292  m->delete=1;
    262293}
    263294
    264 void owl_message_unmark_delete(owl_message *m) {
     295void owl_message_unmark_delete(owl_message *m)
     296{
    265297  if (m == NULL) return;
    266298  m->delete=0;
    267299}
    268300
    269 char *owl_message_get_zwriteline(owl_message *m) {
     301char *owl_message_get_zwriteline(owl_message *m)
     302{
    270303  return(m->zwriteline);
    271304}
    272305
    273 void owl_message_set_zwriteline(owl_message *m, char *line) {
     306void owl_message_set_zwriteline(owl_message *m, char *line)
     307{
    274308  m->zwriteline=strdup(line);
    275309}
    276310
    277 int owl_message_is_delete(owl_message *m) {
     311int owl_message_is_delete(owl_message *m)
     312{
    278313  if (m == NULL) return(0);
    279314  if (m->delete==1) return(1);
     
    281316}
    282317
    283 ZNotice_t *owl_message_get_notice(owl_message *m) {
     318ZNotice_t *owl_message_get_notice(owl_message *m)
     319{
    284320  return(&(m->notice));
    285321}
    286322
    287 char *owl_message_get_hostname(owl_message *m) {
     323char *owl_message_get_hostname(owl_message *m)
     324{
    288325  return(m->hostname);
    289326}
    290327
    291328
    292 void owl_message_curs_waddstr(owl_message *m, WINDOW *win, int aline, int bline, int acol, int bcol, int color) {
     329void owl_message_curs_waddstr(owl_message *m, WINDOW *win, int aline, int bline, int acol, int bcol, int color)
     330{
    293331  owl_fmtext a, b;
    294332
     
    312350}
    313351
    314 int owl_message_is_personal(owl_message *m) {
    315   if (strcasecmp(owl_message_get_class(m), "message")) return(0);
    316   if (strcasecmp(owl_message_get_instance(m), "personal")) return(0);
    317   if (!strcasecmp(owl_message_get_recipient(m), ZGetSender()) ||
    318       !strcasecmp(owl_message_get_sender(m), ZGetSender())) {
     352int owl_message_is_personal(owl_message *m)
     353{
     354  if (owl_message_is_type_zephyr(m)) {
     355    if (strcasecmp(owl_message_get_class(m), "message")) return(0);
     356    if (strcasecmp(owl_message_get_instance(m), "personal")) return(0);
     357    if (!strcasecmp(owl_message_get_recipient(m), ZGetSender()) ||
     358        !strcasecmp(owl_message_get_sender(m), ZGetSender())) {
     359      return(1);
     360    }
     361  }
     362  return(0);
     363}
     364
     365/* true if the message is only intended for one recipient (me) */
     366int owl_message_is_to_me(owl_message *m)
     367{
     368  if (owl_message_is_type_zephyr(m)) {
     369    if (!strcasecmp(owl_message_get_recipient(m), ZGetSender())) {
     370      return(1);
     371    } else {
     372      return(0);
     373    }
     374  } else if (owl_message_is_type_aim(m)) {
     375    /* right now we don't support chat rooms */
    319376    return(1);
    320   }
    321   return(0);
    322 }
    323 
    324 int owl_message_is_private(owl_message *m) {
    325   if (!strcasecmp(owl_message_get_recipient(m), ZGetSender())) return(1);
    326   return(0);
    327 }
    328 
    329 int owl_message_is_mail(owl_message *m) {
    330   if (!strcasecmp(owl_message_get_class(m), "mail") && owl_message_is_private(m)) {
     377  } else if (owl_message_is_type_admin(m)) {
    331378    return(1);
    332379  }
     
    334381}
    335382
    336 int owl_message_is_ping(owl_message *m) {
    337   if (!strcasecmp(owl_message_get_opcode(m), "ping")) return(1);
    338   return(0);
    339 }
    340 
    341 int owl_message_is_login(owl_message *m) {
    342   if (!strcasecmp(owl_message_get_class(m), "login")) return(1);
    343   return(0);
    344   /* is this good enough? */
    345 }
    346 
    347 int owl_message_is_burningears(owl_message *m) {
     383
     384int owl_message_is_from_me(owl_message *m)
     385{
     386  if (owl_message_is_type_zephyr(m)) {
     387    if (!strcasecmp(owl_message_get_sender(m), ZGetSender())) {
     388      return(1);
     389    } else {
     390      return(0);
     391    }
     392  } else if (owl_message_is_type_aim(m)) {
     393    if (!strcasecmp(owl_message_get_sender(m), owl_global_get_aim_screenname(&g))) {
     394      return(1);
     395    } else {
     396      return(0);
     397    }
     398  } else if (owl_message_is_type_admin(m)) {
     399    return(0);
     400  }
     401  return(0);
     402}
     403
     404int owl_message_is_mail(owl_message *m)
     405{
     406  if (owl_message_is_type_zephyr(m)) {
     407    if (!strcasecmp(owl_message_get_class(m), "mail") && owl_message_is_to_me(m)) {
     408      return(1);
     409    } else {
     410      return(0);
     411    }
     412  }
     413  return(0);
     414}
     415
     416int owl_message_is_ping(owl_message *m)
     417{
     418  if (owl_message_is_type_zephyr(m)) {
     419    if (!strcasecmp(owl_message_get_opcode(m), "ping")) {
     420      return(1);
     421    } else {
     422      return(0);
     423    }
     424  }
     425  return(0);
     426}
     427
     428int owl_message_is_login(owl_message *m)
     429{
     430  if (owl_message_is_type_zephyr(m)) {
     431    if (!strcasecmp(owl_message_get_class(m), "login")) {
     432      return(1);
     433    } else {
     434      return(0);
     435    }
     436  } else if (owl_message_is_type_aim(m)) {
     437    /* deal with this once we can use buddy lists */
     438    return(0);
     439  }
     440       
     441  return(0);
     442}
     443
     444int owl_message_is_burningears(owl_message *m)
     445{
    348446  /* we should add a global to cache the short zsender */
    349447  char sender[LINE], *ptr;
    350448
    351449  /* if the message is from us or to us, it doesn't count */
    352   if (!strcasecmp(ZGetSender(), owl_message_get_sender(m))) return(0);
    353   if (!strcasecmp(ZGetSender(), owl_message_get_recipient(m))) return(0);
    354 
    355   strcpy(sender, ZGetSender());
    356   ptr=strchr(sender, '@');
    357   if (ptr) *ptr='\0';
     450  if (owl_message_is_from_me(m) || owl_message_is_to_me(m)) return(0);
     451
     452  if (owl_message_is_type_zephyr(m)) {
     453    strcpy(sender, ZGetSender());
     454    ptr=strchr(sender, '@');
     455    if (ptr) *ptr='\0';
     456  } else if (owl_message_is_type_aim(m)) {
     457    strcpy(sender, owl_global_get_aim_screenname(&g));
     458  } else {
     459    return(0);
     460  }
    358461
    359462  if (stristr(owl_message_get_body(m), sender)) {
     
    364467
    365468/* caller must free return value. */
    366 char *owl_message_get_cc(owl_message *m) {
     469char *owl_message_get_cc(owl_message *m)
     470{
    367471  char *cur, *out, *end;
    368472
     
    378482}
    379483
    380 int owl_message_get_id(owl_message *m) {
     484int owl_message_get_id(owl_message *m)
     485{
    381486  return(m->id);
    382487}
    383488                                       
    384 int owl_message_search(owl_message *m, char *string) {
     489int owl_message_search(owl_message *m, char *string)
     490{
    385491  /* return 1 if the message contains "string", 0 otherwise.  This is
    386492   * case insensitive because the functions it uses are */
     
    389495}
    390496
    391 void owl_message_create(owl_message *m, char *header, char *text) {
     497void owl_message_create(owl_message *m, char *header, char *text)
     498{
    392499  char *indent;
    393500
     
    409516}
    410517
    411 void owl_message_create_aim(owl_message *m, char *sender, char *recipient, char *text) {
     518void owl_message_create_aim(owl_message *m, char *sender, char *recipient, char *text)
     519{
    412520  char *indent;
    413521
     
    435543}
    436544
    437 void owl_message_create_admin(owl_message *m, char *header, char *text) {
     545void owl_message_create_admin(owl_message *m, char *header, char *text)
     546{
    438547  char *indent;
    439548
     
    460569}
    461570
    462 void owl_message_create_from_znotice(owl_message *m, ZNotice_t *n) {
     571void owl_message_create_from_znotice(owl_message *m, ZNotice_t *n)
     572{
    463573  struct hostent *hent;
    464574  int k;
     
    552662}
    553663
    554 void owl_message_create_from_zwriteline(owl_message *m, char *line, char *body, char *zsig) {
     664void owl_message_create_from_zwriteline(owl_message *m, char *line, char *body, char *zsig)
     665{
    555666  owl_zwrite z;
    556667  int ret;
     
    593704}
    594705
    595 void _owl_message_make_text_from_config(owl_message *m) {
     706void _owl_message_make_text_from_config(owl_message *m)
     707{
    596708  char *body, *indent;
    597709
     
    612724}
    613725
    614 void _owl_message_make_text_from_zwriteline_standard(owl_message *m) {
     726void _owl_message_make_text_from_zwriteline_standard(owl_message *m)
     727{
    615728  char *indent, *text, *zsigbuff, *foo;
    616729
     
    642755}
    643756
    644 void _owl_message_make_text_from_zwriteline_simple(owl_message *m) {
     757void _owl_message_make_text_from_zwriteline_simple(owl_message *m)
     758{
    645759  char *indent, *text, *zsigbuff, *foo;
    646760
     
    672786}
    673787
    674 void _owl_message_make_text_from_notice_standard(owl_message *m) {
     788void _owl_message_make_text_from_notice_standard(owl_message *m)
     789{
    675790  char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
    676791  ZNotice_t *n;
     
    702817  owl_fmtext_append_normal(&(m->fmtext), OWL_TABSTR);
    703818
    704   if (!strcasecmp(owl_message_get_opcode(m), "ping") && owl_message_is_private(m)) {
     819  if (!strcasecmp(owl_message_get_opcode(m), "ping") && owl_message_is_to_me(m)) {
    705820    owl_fmtext_append_bold(&(m->fmtext), "PING");
    706821    owl_fmtext_append_normal(&(m->fmtext), " from ");
     
    773888}
    774889
    775 void _owl_message_make_text_from_notice_simple(owl_message *m) {
     890void _owl_message_make_text_from_notice_simple(owl_message *m)
     891{
    776892  char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
    777893  ZNotice_t *n;
     
    873989}
    874990
    875 void owl_message_pretty_zsig(owl_message *m, char *buff) {
     991void owl_message_pretty_zsig(owl_message *m, char *buff)
     992{
    876993  /* stick a one line version of the zsig in buff */
    877994  char *ptr;
     
    882999}
    8831000
    884 void owl_message_free(owl_message *m) {
     1001void owl_message_free(owl_message *m)
     1002{
    8851003  int i, j;
    8861004  owl_pair *p;
  • owl_prototypes.h

    r440ce01 r0ff8fb57  
    88extern int owl_aim_chat_sendmsg(char *chatroom, char *msg);
    99extern int owl_aim_process_events();
     10extern int faimtest_flapversion(aim_session_t *sess, aim_frame_t *fr, ...);
     11extern int faimtest_conncomplete(aim_session_t *sess, aim_frame_t *fr, ...);
     12extern void addcb_bos(aim_session_t *sess, aim_conn_t *bosconn);
     13extern int login(aim_session_t *sess, const char *sn, const char *passwd);
     14extern int logout(aim_session_t *sess);
     15extern int faimtest_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...);
     16extern void chatnav_redirect(aim_session_t *sess, struct aim_redirect_data *redir);
     17extern void chat_redirect(aim_session_t *sess, struct aim_redirect_data *redir);
     18extern void getfile_start(aim_session_t *sess, aim_conn_t *conn, const char *sn);
     19extern void getfile_requested(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args);
     20extern void directim_start(aim_session_t *sess, const char *sn);
     21extern void directim_requested(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args);
    1022
    1123/* -------------------------------- cmd.c -------------------------------- */
     
    267279extern void owl_function_adminmsg(char *header, char *body);
    268280extern void owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig);
     281extern void owl_function_make_outgoing_aim(char *body, char *to);
    269282extern void owl_function_zwrite_setup(char *line);
     283extern void owl_function_aimwrite_setup(char *line);
    270284extern void owl_function_zcrypt_setup(char *line);
    271285extern void owl_function_zwrite(char *line);
     286extern void owl_function_aimwrite(char *to);
    272287extern void owl_function_nextmsg_full(char *filter, int skip_deleted, int last_if_none);
    273288extern void owl_function_prevmsg_full(char *filter, int skip_deleted, int first_if_none);
     
    586601extern void owl_message_curs_waddstr(owl_message *m, WINDOW *win, int aline, int bline, int acol, int bcol, int color);
    587602extern int owl_message_is_personal(owl_message *m);
    588 extern int owl_message_is_private(owl_message *m);
     603extern int owl_message_is_to_me(owl_message *m);
     604extern int owl_message_is_from_me(owl_message *m);
    589605extern int owl_message_is_mail(owl_message *m);
    590606extern int owl_message_is_ping(owl_message *m);
     
    931947extern int owl_zwrite_is_personal(owl_zwrite *z);
    932948extern void owl_zwrite_free(owl_zwrite *z);
     949
Note: See TracChangeset for help on using the changeset viewer.