Changeset 1193 for trunk/auto-reply

Show
Ignore:
Timestamp:
03/01/00 05:05:44 (9 years ago)
Author:
graham
Message:

Use new message id to ensure processing each individual message

Location:
trunk/auto-reply/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/auto-reply/src/autoreply.cpp

    r1124 r1193  
    178178  case SIGNAL_UPDATExUSER: 
    179179    if (s->SubSignal() == USER_EVENTS && s->Uin() != gUserManager.OwnerUin()) 
    180       ProcessUserEvent(s->Uin()); 
     180      ProcessUserEvent(s->Uin(), s->Argument()); 
    181181    break; 
    182182  // We should never get any other signal 
     
    231231 
    232232 
    233 void CLicqAutoReply::ProcessUserEvent(unsigned long nUin) 
     233void CLicqAutoReply::ProcessUserEvent(unsigned long nUin, unsigned long nId) 
    234234{ 
    235235  ICQUser *u = gUserManager.FetchUser(nUin, LOCK_W); 
    236236  if (u == NULL) 
    237237  { 
    238     gLog.Warn("Invalid uin received from daemon (%ld).\n", nUin); 
     238    gLog.Warn("%sInvalid uin received from daemon (%ld).\n", L_AUTOREPxSTR, nUin); 
    239239    return; 
    240240  } 
    241241 
    242   CUserEvent *e = NULL; 
    243  
    244   if (m_bDelete) 
    245   { 
    246     while (u->NewMessages() > 0) 
    247     { 
    248       // Fetch the event 
    249       e = u->EventPop(); 
    250       // Forward it 
    251       if (!ForwardEvent(u, e)) break; 
    252       // Erase the event 
    253       delete e; 
    254     } 
     242  CUserEvent *e = u->EventPeekId(nId); 
     243 
     244  if (e == NULL) 
     245  { 
     246    gLog.Warn("%sInvalid message id (%d).\n", L_AUTOREPxSTR, nId); 
    255247  } 
    256248  else 
    257249  { 
    258     e = u->EventPeekLast(); 
    259     // Forward it 
    260     ForwardEvent(u, e); 
     250    bool r = AutoReplyEvent(u, e); 
     251    if (m_bDelete && r) 
     252      u->EventClearId(nId); 
    261253  } 
    262254 
     
    265257 
    266258 
    267 bool CLicqAutoReply::ForwardEvent(ICQUser *u, CUserEvent *e) 
     259bool CLicqAutoReply::AutoReplyEvent(ICQUser *u, CUserEvent *e) 
    268260{ 
    269261  FILE *output; 
  • trunk/auto-reply/src/autoreply.h

    r1120 r1193  
    3636  void ProcessEvent(ICQEvent *); 
    3737 
    38   void ProcessUserEvent(unsigned long); 
    39   bool ForwardEvent(ICQUser *, CUserEvent *); 
     38  void ProcessUserEvent(unsigned long, unsigned long); 
     39  bool AutoReplyEvent(ICQUser *, CUserEvent *); 
    4040 
    4141};