Changeset 6307

Show
Ignore:
Timestamp:
06/14/08 18:34:29 (7 months ago)
Author:
flynd
Message:

A few more uin calls that were easy to change.

Location:
trunk/licq/src
Files:
2 modified

Legend:

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

    r6306 r6307  
    194194   CICQColor *pColor) 
    195195{ 
    196   if (_nUin == gUserManager.OwnerUin() || m == NULL) return 0; 
    197  
    198   ICQEvent *result = NULL; 
    199   char *mDos = NULL; 
    200   if (m != NULL) 
    201   { 
    202     mDos = gTranslator.NToRN(m); 
    203     gTranslator.ClientToServer(mDos); 
    204   } 
    205   CEventMsg *e = NULL; 
    206  
    207   unsigned long f = INT_VERSION; 
    208   if (online) f |= E_DIRECT; 
    209   if (nLevel == ICQ_TCPxMSG_URGENT) f |= E_URGENT; 
    210   if (bMultipleRecipients) f |= E_MULTIxREC; 
    211  
    212   ICQUser *u; 
    213   if (!online) // send offline 
    214   { 
    215      e = new CEventMsg(m, ICQ_CMDxSND_THRUxSERVER, TIME_NOW, f); 
    216      if (strlen(mDos) > MAX_MESSAGE_SIZE) 
    217      { 
    218        gLog.Warn(tr("%sTruncating message to %d characters to send through server.\n"), 
    219                  L_WARNxSTR, MAX_MESSAGE_SIZE); 
    220        mDos[MAX_MESSAGE_SIZE] = '\0'; 
    221      } 
    222      result = icqSendThroughServer(_nUin, ICQ_CMDxSUB_MSG | (bMultipleRecipients ? ICQ_CMDxSUB_FxMULTIREC : 0), 
    223                                    mDos, e); 
    224      u = gUserManager.FetchUser(_nUin, LOCK_W); 
    225   } 
    226   else        // send direct 
    227   { 
    228     u = gUserManager.FetchUser(_nUin, LOCK_W); 
    229     if (u == NULL) return 0; 
    230     if (u->Secure()) f |= E_ENCRYPTED; 
    231     e = new CEventMsg(m, ICQ_CMDxTCP_START, TIME_NOW, f); 
    232     if (pColor != NULL) e->SetColor(pColor); 
    233     CPT_Message *p = new CPT_Message(mDos, nLevel, bMultipleRecipients, pColor, u); 
    234     gLog.Info(tr("%sSending %smessage to %s (#%hu).\n"), L_TCPxSTR, 
    235        nLevel == ICQ_TCPxMSG_URGENT ? tr("urgent ") : "", 
    236        u->GetAlias(), -p->Sequence()); 
    237     result = SendExpectEvent_Client(u, p, e); 
    238   } 
    239  
    240   if (u != NULL) 
    241   { 
    242     u->SetSendServer(!online); 
    243     u->SetSendLevel(nLevel); 
    244     gUserManager.DropUser(u); 
    245   } 
    246  
    247   if (pColor != NULL) CICQColor::SetDefaultColors(pColor); 
    248  
    249   if (mDos) 
    250     delete [] mDos; 
    251  
    252   if (result != NULL) 
    253     return result->EventId(); 
    254   return 0; 
     196  char szId[13]; 
     197  snprintf(szId, 12, "%lu", _nUin); 
     198  szId[12] = 0; 
     199  return icqSendMessage(szId, m, online, nLevel, bMultipleRecipients, pColor); 
    255200} 
    256201 
     
    42124157{ 
    42134158  if (!Handshake_Recv(s, 0)) return false; 
    4214   unsigned long nUin = s->Owner(); 
    4215   if (nUin == 0) return false; 
    4216  
    4217   ICQUser *u = gUserManager.FetchUser(nUin, LOCK_W); 
     4159  const char* id = s->OwnerId(); 
     4160  unsigned long ppid = s->OwnerPPID(); 
     4161  if (id == NULL) 
     4162    return false; 
     4163 
     4164  ICQUser *u = gUserManager.FetchUser(id, ppid, LOCK_W); 
    42184165  if (u != NULL) 
    42194166  { 
    4220     gLog.Info(tr("%sConnection from %s (%ld) [v%ld].\n"), L_TCPxSTR, 
    4221        u->GetAlias(), nUin, s->Version()); 
     4167    gLog.Info(tr("%sConnection from %s (%s) [v%ld].\n"), L_TCPxSTR, 
     4168       u->GetAlias(), id, s->Version()); 
    42224169    if (u->SocketDesc(s->Channel()) != s->Descriptor()) 
    42234170    { 
    42244171      if (u->SocketDesc(s->Channel()) != -1) 
    42254172      { 
    4226         gLog.Warn(tr("%sUser %s (%ld) already has an associated socket.\n"), 
    4227                   L_WARNxSTR, u->GetAlias(), nUin); 
     4173        gLog.Warn(tr("%sUser %s (%s) already has an associated socket.\n"), 
     4174                  L_WARNxSTR, u->GetAlias(), id); 
    42284175        gUserManager.DropUser(u); 
    42294176        return true; 
     
    42374184  else 
    42384185  { 
    4239     gLog.Info(tr("%sConnection from new user (%ld) [v%ld].\n"), L_TCPxSTR, 
    4240        nUin, s->Version()); 
     4186    gLog.Info(tr("%sConnection from new user (%s) [v%ld].\n"), L_TCPxSTR, 
     4187       id, s->Version()); 
    42414188  } 
    42424189 
  • trunk/licq/src/icqd-threads.cpp

    r6306 r6307  
    858858              int err = tcp->Error(); 
    859859              if (err == 0) 
    860                 gLog.Info(tr("%sConnection to %lu was closed.\n"), L_TCPxSTR 
    861                                                              , tcp->Owner()); 
     860                gLog.Info(tr("%sConnection to %s was closed.\n"), L_TCPxSTR, 
     861                    tcp->OwnerId()); 
    862862              else 
    863863              { 
    864864                char buf[128]; 
    865                 gLog.Info(tr("%sConnection to %lu lost:\n%s%s.\n"), L_TCPxSTR, 
    866                           tcp->Owner(), L_BLANKxSTR, tcp->ErrorStr(buf, 128)); 
     865                gLog.Info(tr("%sConnection to %s lost:\n%s%s.\n"), L_TCPxSTR, 
     866                    tcp->OwnerId(), L_BLANKxSTR, tcp->ErrorStr(buf, 128)); 
    867867              } 
    868868              ICQUser *u = gUserManager.FetchUser(tcp->OwnerId(), 
     
    900900            if (!r) 
    901901            { 
    902               gLog.Info(tr("%sClosing connection to %lu.\n"), L_TCPxSTR, 
    903                                                           tcp->Owner()); 
     902              gLog.Info(tr("%sClosing connection to %s.\n"), L_TCPxSTR, 
     903                  tcp->OwnerId()); 
    904904              gSocketManager.DropSocket(tcp); 
    905905              gSocketManager.CloseSocket(nCurrentSocket);