Changeset 3757 for trunk/auto-reply

Show
Ignore:
Timestamp:
06/06/04 21:32:13 (4 years ago)
Author:
emostar
Message:

Patch by Philip Nelson <phatfil AT optusnet.com.au> to make this plugin work with multiple protocols.

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

Legend:

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

    r3649 r3757  
    190190  { 
    191191    case SIGNAL_UPDATExUSER: 
    192       if (s->SubSignal() == USER_EVENTS && s->Uin() != gUserManager.OwnerUin() && s->Argument() > 0) 
    193         ProcessUserEvent(s->Uin(), s->Argument()); 
     192      if (s->SubSignal() == USER_EVENTS && gUserManager.FindOwner(s->Id(), s->PPID()) == NULL && s->Argument() > 0) 
     193        ProcessUserEvent(s->Id(), s->PPID(), s->Argument()); 
    194194      break; 
    195195    // We should never get any other signal 
     
    224224 
    225225 
    226 void CLicqAutoReply::ProcessUserEvent(unsigned long nUin, unsigned long nId) 
    227 { 
    228   ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R); 
     226void CLicqAutoReply::ProcessUserEvent(const char *szId, unsigned long nPPID, unsigned long nId) 
     227{ 
     228  ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 
    229229  if (u == NULL) 
    230230  { 
    231     gLog.Warn("%sInvalid uin received from daemon (%ld).\n", L_AUTOREPxSTR, nUin); 
     231    gLog.Warn("%sInvalid user id received from daemon (%s).\n", L_AUTOREPxSTR, szId); 
    232232    return; 
    233233  } 
     
    242242  else 
    243243  { 
    244     bool r = AutoReplyEvent(nUin, e); 
     244    bool r = AutoReplyEvent(szId, nPPID, e); 
    245245    if (m_bDelete && r) 
    246246    { 
    247       u = gUserManager.FetchUser(nUin, LOCK_W); 
     247      u = gUserManager.FetchUser(szId, nPPID, LOCK_W); 
    248248      u->EventClearId(nId); 
    249249      gUserManager.DropUser(u); 
     
    253253 
    254254 
    255 bool CLicqAutoReply::AutoReplyEvent(unsigned long nUin, CUserEvent *event) 
     255bool CLicqAutoReply::AutoReplyEvent(const char *szId, unsigned long nPPID, CUserEvent *event) 
    256256{ 
    257257  char *szCommand; 
     
    259259  char *tmp; 
    260260  sprintf(buf, "%s ", m_szProgram); 
    261   ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R); 
     261  ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 
    262262  tmp = u->usprintf(m_szArguments); 
    263263  gUserManager.DropUser(u); 
     
    299299  char *szText = new char[4096 + 256]; 
    300300  sprintf(szText, "%s", m_szMessage); 
    301   unsigned long tag = licqDaemon->icqSendMessage(nUin, szText, !m_bSendThroughServer, 
     301  unsigned long tag = licqDaemon->ProtoSendMessage(szId, nPPID, szText, !m_bSendThroughServer, 
    302302     ICQ_TCPxMSG_URGENT); 
    303303  delete []szText; 
    304304  delete [] szCommand; 
    305305 
    306   u = gUserManager.FetchUser(nUin, LOCK_R); 
     306  u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 
    307307  if (u == NULL) return false; 
    308308 
    309309  if (tag == 0) 
    310310  { 
    311     gLog.Warn("%sSending message to %s (%ld) failed.\n", L_AUTOREPxSTR, 
    312      u->GetAlias(), nUin); 
     311    gLog.Warn("%sSending message to %s (%s) failed.\n", L_AUTOREPxSTR, 
     312     u->GetAlias(), szId); 
    313313  } 
    314314  else 
    315315  { 
    316     gLog.Info("%sSent autoreply to %s (%ld).\n", L_AUTOREPxSTR, u->GetAlias(), 
    317      nUin); 
     316    gLog.Info("%sSent autoreply to %s (%s).\n", L_AUTOREPxSTR, u->GetAlias(), 
     317     szId); 
    318318  } 
    319319 
  • trunk/auto-reply/src/autoreply.h

    r3649 r3757  
    3838  void ProcessEvent(ICQEvent *); 
    3939 
    40   void ProcessUserEvent(unsigned long, unsigned long); 
    41   bool AutoReplyEvent(unsigned long, CUserEvent *); 
     40  void ProcessUserEvent(const char *, unsigned long, unsigned long); 
     41  bool AutoReplyEvent(const char *, unsigned long, CUserEvent *); 
    4242 
    4343  bool POpen(const char *cmd);