Show
Ignore:
Timestamp:
07/03/08 22:13:49 (5 months ago)
Author:
flynd
Message:

More UIN removed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/licq/src/icqd-srv.cpp

    r6404 r6405  
    10681068void CICQDaemon::icqRequestAuth(unsigned long _nUin, const char *_szMessage) 
    10691069{ 
    1070   CSrvPacketTcp *p = new CPU_RequestAuth(_nUin, _szMessage); 
     1070  char id[16]; 
     1071  snprintf(id, 16, "%lu", _nUin); 
     1072  icqRequestAuth(id, _szMessage); 
     1073} 
     1074 
     1075void CICQDaemon::icqRequestAuth(const char* id, const char *_szMessage) 
     1076{ 
     1077  CSrvPacketTcp* p = new CPU_RequestAuth(id, _szMessage); 
    10711078  SendEvent_Server(p); 
    10721079} 
     
    17261733                     unsigned long nUin) 
    17271734{ 
    1728   CEventSms *ue = new CEventSms(szNumber, szMessage, ICQ_CMDxSND_THRUxSERVER, TIME_NOW, INT_VERSION); 
    1729   CPU_SendSms *p = new CPU_SendSms(szNumber, szMessage); 
     1735  char id[16]; 
     1736  snprintf(id, 16, "%lu", nUin); 
     1737  return icqSendSms(id, LICQ_PPID, szNumber, szMessage); 
     1738} 
     1739 
     1740unsigned long CICQDaemon::icqSendSms(const char* id, unsigned long ppid, 
     1741    const char* number, const char* message) 
     1742{ 
     1743  CEventSms* ue = new CEventSms(number, message, ICQ_CMDxSND_THRUxSERVER, TIME_NOW, INT_VERSION); 
     1744  CPU_SendSms* p = new CPU_SendSms(number, message); 
    17301745  gLog.Info(tr("%sSending SMS through server (#%hu/#%d)...\n"), L_SRVxSTR, 
    1731             p->Sequence(), p->SubSequence()); 
    1732   ICQEvent *e = SendExpectEvent_Server(nUin, p, ue); 
     1746      p->Sequence(), p->SubSequence()); 
     1747  ICQEvent* e = SendExpectEvent_Server(id, ppid, p, ue); 
    17331748  if (e != NULL) 
    17341749    return e->EventId(); 
     
    21712186unsigned long CICQDaemon::FindUinByCellular(const char *szCellular) 
    21722187{ 
     2188  return strtoul(FindUserByCellular(szCellular).c_str(), NULL, 10); 
     2189} 
     2190 
     2191string CICQDaemon::FindUserByCellular(const char *szCellular) 
     2192{ 
    21732193  char szParsedNumber1[16], szParsedNumber2[16]; 
    2174   unsigned long nUin = 0; 
    2175    
     2194  string id; 
     2195 
    21762196  FOR_EACH_USER_START(LOCK_R) 
    21772197  { 
     
    21792199    ParseDigits(szParsedNumber2, szCellular, 15); 
    21802200    if (!strcmp(szParsedNumber1, szParsedNumber2)) 
    2181       nUin = strtoul(pUser->IdString(), NULL, 10); 
     2201      id = pUser->IdString(); 
    21822202  } 
    21832203  FOR_EACH_USER_END 
    21842204 
    2185   return nUin; 
     2205  return id; 
    21862206} 
    21872207 
     
    37733793          delete [] buf; 
    37743794          //TODO 
    3775           CEventUnknownSysMsg *e = new CEventUnknownSysMsg(nTypeMsg, ICQ_CMDxRCV_SYSxMSGxONLINE, 
    3776                                                            strtoul(szId, (char **)NULL, 10),  
    3777                                                            szMessage, nTimeSent, 0); 
     3795              CEventUnknownSysMsg* e = new CEventUnknownSysMsg(nTypeMsg, ICQ_CMDxRCV_SYSxMSGxONLINE, 
     3796                  szId, LICQ_PPID, szMessage, nTimeSent, 0); 
    37783797 
    37793798          ICQOwner *o = gUserManager.FetchOwner(LICQ_PPID, LOCK_W); 
     
    38563875        CEventSms *eSms = (CEventSms *)eEvent; 
    38573876      //TODO 
    3858         unsigned long nUinSms = FindUinByCellular(eSms->Number()); 
    3859  
    3860         if (nUinSms != 0) 
    3861         { 
     3877      string idSms = FindUserByCellular(eSms->Number()); 
     3878 
     3879      if (!idSms.empty()) 
     3880      { 
    38623881        //TODO 
    3863           ICQUser* u = gUserManager.FetchUser(nUinSms, LOCK_W); 
    3864           gLog.Info(tr("%sSMS from %s - %s (%lu).\n"), L_SBLANKxSTR, eSms->Number(),  
    3865                   u->GetAlias(), nUinSms); 
     3882        ICQUser* u = gUserManager.FetchUser(idSms.c_str(), LICQ_PPID, LOCK_W); 
     3883        gLog.Info(tr("%sSMS from %s - %s (%s).\n"), L_SBLANKxSTR, eSms->Number(), 
     3884            u->GetAlias(), idSms.c_str()); 
    38663885          if (AddUserEvent(u, eEvent)) 
    38673886            m_xOnEventManager.Do(ON_EVENT_SMS, u); 
     
    47534772      unsigned long nUin; 
    47544773      unsigned long nTimeSent; 
    4755        
     4774 
    47564775      nUin = msg.UnpackUnsignedLong(); 
     4776          char id[16]; 
     4777          snprintf(id, 16, "%lu", nUin); 
    47574778 
    47584779      sendTM.tm_year = msg.UnpackUnsignedShort() - 1900; 
     
    48084829    case ICQ_CMDxSUB_AUTHxREQUEST: 
    48094830    { 
    4810       gLog.Info(tr("%sOffline authorization request from %lu.\n"), L_SBLANKxSTR, nUin); 
    4811        
     4831              gLog.Info(tr("%sOffline authorization request from %s.\n"), L_SBLANKxSTR, id); 
     4832 
    48124833      char **szFields = new char *[6];  // alias, first name, last name, email, auth, comment 
    48134834           
     
    48294850          gTranslator.ServerToClient (szFields[5]);  // comment 
    48304851 
    4831           CEventAuthRequest *e = new CEventAuthRequest(nUin, szFields[0], szFields[1], 
    4832                                                        szFields[2], szFields[3], szFields[5], 
    4833                                                       ICQ_CMDxRCV_SYSxMSGxOFFLINE, nTimeSent, 0); 
    4834       delete [] szFields;    
     4852              CEventAuthRequest *e = new CEventAuthRequest(id, LICQ_PPID, 
     4853                  szFields[0], szFields[1], szFields[2], szFields[3], 
     4854                  szFields[5], ICQ_CMDxRCV_SYSxMSGxOFFLINE, nTimeSent, 0); 
     4855              delete [] szFields; 
    48354856      eEvent = e; 
    48364857      break; 
     
    48384859    case ICQ_CMDxSUB_AUTHxREFUSED:  // system message: authorization refused 
    48394860        { 
    4840           gLog.Info(tr("%sOffline authorization refused by %lu.\n"), L_SBLANKxSTR, nUin); 
     4861              gLog.Info(tr("%sOffline authorization refused by %s.\n"), L_SBLANKxSTR, id); 
    48414862 
    48424863          // Translating string with Translation Table 
    48434864          gTranslator.ServerToClient(szMessage); 
    48444865 
    4845           CEventAuthRefused *e = new CEventAuthRefused(nUin, szMessage, ICQ_CMDxRCV_SYSxMSGxOFFLINE, 
    4846                               nTimeSent, 0); 
     4866              CEventAuthRefused* e = new CEventAuthRefused(id, LICQ_PPID, 
     4867                  szMessage, ICQ_CMDxRCV_SYSxMSGxOFFLINE, nTimeSent, 0); 
    48474868      eEvent = e; 
    48484869      break; 
     
    48504871    case ICQ_CMDxSUB_AUTHxGRANTED:  // system message: authorized 
    48514872        { 
    4852           gLog.Info(tr("%sOffline authorization granted by %lu.\n"), L_SBLANKxSTR, nUin); 
     4873              gLog.Info(tr("%sOffline authorization granted by %s.\n"), L_SBLANKxSTR, id); 
    48534874 
    48544875          // translating string with Translation Table 
    48554876          gTranslator.ServerToClient (szMessage); 
    48564877 
    4857           ICQUser *u = gUserManager.FetchUser(nUin, LOCK_W); 
     4878              ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 
    48584879          if (u) 
    48594880          { 
     
    48624883          } 
    48634884 
    4864           CEventAuthGranted *e = new CEventAuthGranted(nUin, szMessage, ICQ_CMDxRCV_SYSxMSGxOFFLINE, 
    4865                                                       nTimeSent, 0); 
     4885              CEventAuthGranted* e = new CEventAuthGranted(id, LICQ_PPID, 
     4886                  szMessage, ICQ_CMDxRCV_SYSxMSGxOFFLINE, nTimeSent, 0); 
    48664887      eEvent = e; 
    48674888      break; 
     
    48854906    case ICQ_CMDxSUB_ADDEDxTOxLIST:  // system message: added to a contact list 
    48864907        { 
    4887           gLog.Info(tr("%sUser %lu added you to their contact list (offline).\n"), L_SBLANKxSTR, nUin); 
     4908              gLog.Info(tr("%sUser %s added you to their contact list (offline).\n"), L_SBLANKxSTR, id); 
    48884909 
    48894910          char **szFields = new char *[6]; // alias, first name, last name, email, auth, comment 
     
    49054926          gTranslator.ServerToClient (szFields[2]);  // last name 
    49064927 
    4907           CEventAdded *e = new CEventAdded(nUin, szFields[0], szFields[1], 
    4908                                           szFields[2], szFields[3], 
    4909                                            ICQ_CMDxRCV_SYSxMSGxOFFLINE, nTimeSent, 0); 
    4910       delete [] szFields;    
     4928              CEventAdded* e = new CEventAdded(id, LICQ_PPID, szFields[0], 
     4929                  szFields[1], szFields[2], szFields[3], 
     4930                  ICQ_CMDxRCV_SYSxMSGxOFFLINE, nTimeSent, 0); 
     4931              delete [] szFields; 
    49114932      eEvent = e; 
    49124933      break; 
     
    50105031                       nTypeMsg, packet.print(buf)); 
    50115032          delete [] buf; 
    5012           CEventUnknownSysMsg *e = new CEventUnknownSysMsg(nTypeMsg, ICQ_CMDxRCV_SYSxMSGxOFFLINE, 
    5013                                                            nUin, szMessage, nTimeSent, 0); 
     5033              CEventUnknownSysMsg* e = new CEventUnknownSysMsg(nTypeMsg, 
     5034                  ICQ_CMDxRCV_SYSxMSGxOFFLINE, id, LICQ_PPID, szMessage, nTimeSent, 0); 
    50145035 
    50155036              ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_W); 
     
    50265047      case ICQ_CMDxSUB_CONTACTxLIST: 
    50275048      { 
    5028             // Lock the user to add the message to their queue 
    5029             ICQUser* u = gUserManager.FetchUser(nUin, LOCK_W); 
    5030             if (u == NULL) 
    5031             { 
    5032               if (Ignore(IGNORE_NEWUSERS)) 
    5033               { 
    5034             gLog.Info(tr("%sOffline %s from new user (%lu), ignoring.\n"), L_SBLANKxSTR, szType, nUin); 
    5035         if (szType) free(szType); 
    5036             RejectEvent(nUin, eEvent); 
    5037             break; 
    5038               } 
    5039               gLog.Info(tr("%sOffline %s from new user (%lu).\n"), L_SBLANKxSTR, szType, nUin); 
    5040               AddUserToList(nUin); 
    5041               u = gUserManager.FetchUser(nUin, LOCK_W); 
    5042             } 
    5043             else 
    5044               gLog.Info(tr("%sOffline %s through server from %s (%lu).\n"), L_SBLANKxSTR, 
    5045                         szType, u->GetAlias(), nUin); 
     5049                // Lock the user to add the message to their queue 
     5050                ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 
     5051                if (u == NULL) 
     5052                { 
     5053                  if (Ignore(IGNORE_NEWUSERS)) 
     5054                  { 
     5055                    gLog.Info(tr("%sOffline %s from new user (%s), ignoring.\n"), 
     5056                        L_SBLANKxSTR, szType, id); 
     5057                    if (szType) free(szType); 
     5058                      RejectEvent(id, eEvent); 
     5059                    break; 
     5060                  } 
     5061                  gLog.Info(tr("%sOffline %s from new user (%s).\n"), L_SBLANKxSTR, szType, id); 
     5062                  AddUserToList(id, LICQ_PPID); 
     5063                  u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 
     5064                } 
     5065                else 
     5066                  gLog.Info(tr("%sOffline %s through server from %s (%s).\n"), 
     5067                      L_SBLANKxSTR, szType, u->GetAlias(), id); 
    50465068 
    50475069            if (szType) free(szType); 
     
    50595081      case ICQ_CMDxSUB_EMAILxPAGER: 
    50605082      { 
    5061             ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R); 
     5083                ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_R); 
    50625084            bool bIgnore = false; 
    50635085            if (u) 
     
    50875109      case ICQ_CMDxSUB_SMS: 
    50885110      { 
    5089         CEventSms *eSms = (CEventSms *)eEvent;  
    5090         unsigned long nUinSms = FindUinByCellular(eSms->Number()); 
    5091          
    5092         if (nUinSms != 0) 
    5093         { 
    5094           ICQUser* u = gUserManager.FetchUser(nUinSms, LOCK_W); 
    5095           gLog.Info(tr("%sOffline SMS from %s - %s (%lu).\n"), L_SBLANKxSTR, eSms->Number(), u->GetAlias(), nUin); 
     5111                CEventSms* eSms = (CEventSms *)eEvent; 
     5112                string idSms = FindUserByCellular(eSms->Number()); 
     5113 
     5114                if (!idSms.empty()) 
     5115                { 
     5116                  ICQUser* u = gUserManager.FetchUser(idSms.c_str(), LICQ_PPID, LOCK_W); 
     5117                  gLog.Info(tr("%sOffline SMS from %s - %s (%s).\n"), L_SBLANKxSTR, 
     5118                      eSms->Number(), u->GetAlias(), id); 
    50965119          if (AddUserEvent(u, eEvent)) 
    50975120            m_xOnEventManager.Do(ON_EVENT_SMS, u); 
     
    55635586            icqRequestMetaInfo(szUin); 
    55645587 
    5565           e->m_pSearchAck = new CSearchAck(nUin); 
     5588          e->m_pSearchAck = new CSearchAck(szUin, LICQ_PPID); 
    55665589        } 
    55675590        else