Changeset 13a3c1db for functions.c


Ignore:
Timestamp:
May 30, 2007, 12:05:27 AM (17 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
4508e21
Parents:
1fd5e4c1
git-author:
Nelson Elhage <nelhage@mit.edu> (05/30/07 00:05:16)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/30/07 00:05:27)
Message:
Refactoring message processing: All new messages, incoming or
outgoing, get added to the owl_global_messagequeue by protocol code,
and then passed to owl_proces_message, which serves as a single
central code path for adding messages to the message list.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    rce74deb r13a3c1db  
    164164}
    165165
    166 
    167 /* Add the given message to Owl's internal queue.  If displayoutgoing
    168  * is disabled, the message is NOT added to any internal queue, -1 is
    169  * returned and THE CALLER IS EXPECTED TO FREE THE GIVEN MESSAGE.
    170  * Otherwise 0 is returned and the caller need do nothing more
    171  */
    172 int owl_function_add_message(owl_message *m)
    173 {
    174   /* if displayoutgoing is disabled, nuke the message and move on */
    175   if (! owl_global_is_displayoutgoing(&g)) {
    176     return(-1);
    177   }
    178 
    179   /* add it to the global list and current view */
    180   owl_messagelist_append_element(owl_global_get_msglist(&g), m);
    181   owl_view_consider_message(owl_global_get_current_view(&g), m);
    182 
    183   /* do followlast if necessary */
    184   if (owl_global_should_followlast(&g)) owl_function_lastmsg_noredisplay();
    185 
    186   /* redisplay etc. */
    187   owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    188   if (owl_popwin_is_active(owl_global_get_popwin(&g))) {
    189     owl_popwin_refresh(owl_global_get_popwin(&g));
    190   }
    191   wnoutrefresh(owl_global_get_curs_recwin(&g));
    192   owl_global_set_needrefresh(&g);
    193   return(0);
    194 }
    195 
    196166/* Create an admin message, append it to the global list of messages
    197167 * and redisplay if necessary.
     
    413383
    414384    if (m) {
    415       /* log it */
    416       owl_log_message(m);
    417      
    418       /* add it or nuke it */
    419       if (owl_global_is_displayoutgoing(&g)) {
    420         owl_function_add_message(m);
    421       } else {
    422         owl_message_free(m);
    423       }
     385      owl_global_messagequeue_addmsg(&g, m);
    424386    } else {
    425387      owl_function_error("Could not create outgoing zephyr message");
     
    477439    m=owl_function_make_outgoing_zephyr(mymsg, line, owl_zwrite_get_zsig(&z));
    478440    if (m) {
    479       /* log it */
    480       owl_log_message(m);
    481      
    482       /* add it or nuke it */
    483       if (owl_global_is_displayoutgoing(&g)) {
    484         owl_function_add_message(m);
    485       } else {
    486         owl_message_free(m);
    487       }
     441      owl_global_messagequeue_addmsg(&g, m);
    488442    } else {
    489443      owl_function_error("Could not create outgoing zephyr message");
     
    525479
    526480  if (m) {
    527     /* log it */
    528     owl_log_message(m);
    529    
    530     /* display it or nuke it */
    531     if (owl_global_is_displayoutgoing(&g)) {
    532       owl_function_add_message(m);
    533     } else {
    534       owl_message_free(m);
    535     }
     481    owl_global_messagequeue_addmsg(&g, m);
    536482  } else {
    537483    owl_function_error("Could not create outgoing AIM message");
     
    562508  m=owl_function_make_outgoing_aim(msg, to);
    563509  if (m) {
    564     /* log it */
    565     owl_log_message(m);
    566 
    567     /* display it or nuke it */
    568     if (owl_global_is_displayoutgoing(&g)) {
    569       owl_function_add_message(m);
    570     } else {
    571       owl_message_free(m);
    572     }
     510    owl_global_messagequeue_addmsg(&g, m);
    573511  } else {
    574512    owl_function_error("Could not create AIM message");
     
    588526   * an incoming message */
    589527  min=owl_malloc(sizeof(owl_message));
     528  mout=owl_function_make_outgoing_loopback(msg);
     529
     530  if (owl_global_is_displayoutgoing(&g)) {
     531    owl_global_messagequeue_addmsg(&g, mout);
     532  } else {
     533    owl_message_free(mout);
     534  }
     535
    590536  owl_message_create_loopback(min, msg);
    591537  owl_message_set_direction_in(min);
    592538  owl_global_messagequeue_addmsg(&g, min);
    593 
    594   mout=owl_function_make_outgoing_loopback(msg);
    595   owl_log_message(mout);
    596   if (owl_global_is_displayoutgoing(&g)) {
    597     owl_function_add_message(mout);
    598   } else {
    599     owl_message_free(mout);
    600   }
    601539
    602540  /* fake a makemsg */
Note: See TracChangeset for help on using the changeset viewer.