Changeset 6402
- Timestamp:
- 07/03/2008 05:54:19 AM (12 months ago)
- Location:
- trunk/licq
- Files:
-
- 10 modified
-
include/licq_icqd.h (modified) (7 diffs)
-
include/licq_packets.h (modified) (1 diff)
-
src/icqd-chat.cpp (modified) (4 diffs)
-
src/icqd-filetransfer.cpp (modified) (10 diffs)
-
src/icqd-srv.cpp (modified) (9 diffs)
-
src/icqd-tcp.cpp (modified) (70 diffs)
-
src/icqd-threads.cpp (modified) (5 diffs)
-
src/icqd.cpp (modified) (5 diffs)
-
src/icqpacket.cpp (modified) (6 diffs)
-
src/oscarservice.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/licq/include/licq_icqd.h
r6390 r6402 243 243 unsigned short nLevel, bool bMultipleRecipients = false, 244 244 CICQColor *pColor = NULL); 245 246 unsigned long ProtoSendContactList(const char *szId, unsigned long nPPID,247 UinList &uins, bool bOnline, unsigned short nLevel,248 bool bMultipleRecipients = false, CICQColor *pColor = NULL);249 245 250 246 unsigned long ProtoFetchAutoResponseServer(const char *szId, unsigned long nPPID); … … 551 547 void CancelEvent(unsigned long ); 552 548 void CancelEvent(ICQEvent *); 553 bool OpenConnectionToUser( unsigned long nUin, TCPSocket *sock,549 bool OpenConnectionToUser(const char* id, TCPSocket *sock, 554 550 unsigned short nPort); 555 551 bool OpenConnectionToUser(const char *szAlias, unsigned long nIp, … … 677 673 unsigned long nMsgID2, unsigned short nSequence, 678 674 TCPSocket *pSock); 679 bool WaitForReverseConnection(unsigned short id, unsigned long uin);675 bool WaitForReverseConnection(unsigned short id, const char* userId); 680 676 681 677 protected: … … 841 837 void ProcessFifo(char *); 842 838 843 static bool Handshake_Send(TCPSocket *, unsigned long, unsigned short,839 static bool Handshake_Send(TCPSocket *, const char* id, unsigned short, 844 840 unsigned short, bool = true, unsigned long = 0); 845 841 static bool Handshake_SendConfirm_v7(TCPSocket *); … … 848 844 int ConnectToServer(const char* server, unsigned short port); 849 845 int ConnectToLoginServer(); 850 int ConnectToUser( unsigned long, unsigned char);851 int ReverseConnectToUser( unsigned long nUin, unsigned long nIp,846 int ConnectToUser(const char* id, unsigned char channel); 847 int ReverseConnectToUser(const char* id, unsigned long nIp, 852 848 unsigned short nPort, unsigned short nVersion, unsigned short nFailedPort, 853 849 unsigned long nId, unsigned long nMsgID1, unsigned long nMsgID2); 854 int RequestReverseConnection( unsigned long, unsigned long, unsigned long,850 int RequestReverseConnection(const char* id, unsigned long, unsigned long, 855 851 unsigned short, unsigned short); 856 852 … … 898 894 { 899 895 public: 900 CReverseConnectToUserData( unsigned long uin, unsigned long id,896 CReverseConnectToUserData(const char* idString, unsigned long id, 901 897 unsigned long data, unsigned long ip, unsigned short port, 902 898 unsigned short version, unsigned short failedport, unsigned long msgid1, … … 904 900 ~CReverseConnectToUserData(); 905 901 906 unsigned long nUin;902 std::string myIdString; 907 903 unsigned long nId; 908 904 unsigned long nData; -
trunk/licq/include/licq_packets.h
r6347 r6402 727 727 { 728 728 public: 729 CPU_ReverseConnectFailed( unsigned long nUin, unsigned long nMsgID1,729 CPU_ReverseConnectFailed(const char* id, unsigned long nMsgID1, 730 730 unsigned long nMsgID2, unsigned short nFailedPort, 731 731 unsigned short nOurPort, unsigned long nConnectID); -
trunk/licq/src/icqd-chat.cpp
r6401 r6402 816 816 817 817 // try reverse connect 818 int nId = licqDaemon->RequestReverseConnection(c->m_ nUin, c->m_nSession,818 int nId = licqDaemon->RequestReverseConnection(c->m_szId, c->m_nSession, 819 819 nIp, LocalPort(), c->m_nPort); 820 820 if (nId != -1) … … 854 854 855 855 // Send handshake packet: 856 if (!CICQDaemon::Handshake_Send(&u->sock, c->m_ nUin, LocalPort(),856 if (!CICQDaemon::Handshake_Send(&u->sock, c->m_szId, LocalPort(), 857 857 VersionToUse(c->m_nVersion), false)) 858 858 return false; … … 985 985 iter != licqDaemon->m_lReverseConnect.end(); ++iter) 986 986 { 987 if ((*iter)-> nUin == u->uin)987 if ((*iter)->myIdString == u->Id()) 988 988 { 989 989 bFound = true; … … 2464 2464 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); 2465 2465 gLog.Info("%sChat: Waiting for reverse connection.\n", L_TCPxSTR); 2466 bool bConnected = d->WaitForReverseConnection(rc->nId, rc->u-> Uin());2466 bool bConnected = d->WaitForReverseConnection(rc->nId, rc->u->Id()); 2467 2467 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); 2468 2468 -
trunk/licq/src/icqd-filetransfer.cpp
r6371 r6402 17 17 #include <sys/types.h> 18 18 #include <fcntl.h> 19 #include <string> 19 20 #include <string.h> 20 21 #include <sys/time.h> … … 43 44 const unsigned short FT_STATE_CONFIRMINGxFILE = 8; 44 45 46 using std::string; 45 47 46 48 … … 352 354 { 353 355 gLog.Info("%sFile Transfer: Connecting to server.\n", L_TCPxSTR); 354 bSuccess = licqDaemon->OpenConnectionToUser(m _nUin, &ftSock, nPort);356 bSuccess = licqDaemon->OpenConnectionToUser(myId, &ftSock, nPort); 355 357 } 356 358 … … 363 365 364 366 // try reverse connect 365 int nId = licqDaemon->RequestReverseConnection(m _nUin, 0, nIp, LocalPort(),367 int nId = licqDaemon->RequestReverseConnection(myId, 0, nIp, LocalPort(), 366 368 nPort); 367 369 … … 393 395 unsigned short nVersion = u->ConnectionVersion(); 394 396 gUserManager.DropUser(u); 395 if (!CICQDaemon::Handshake_Send(&ftSock, m _nUin, LocalPort(), nVersion, false))397 if (!CICQDaemon::Handshake_Send(&ftSock, myId, LocalPort(), nVersion, false)) 396 398 return false; 397 399 … … 481 483 iter != licqDaemon->m_lReverseConnect.end(); ++iter) 482 484 { 483 if ((*iter)->nId == nId && (*iter)-> nUin == m_nUin)485 if ((*iter)->nId == nId && (*iter)->myIdString == myId) 484 486 { 485 487 bFound = true; … … 1255 1257 1256 1258 CICQDaemon *d; 1257 unsigned long nUin;1258 1259 unsigned short nPort; 1259 1260 struct SFileReverseConnectInfo *rc = (struct SFileReverseConnectInfo *)arg; … … 1265 1266 pthread_cleanup_pop(0); 1266 1267 d = rc->m->licqDaemon; 1267 nUin = rc->m->Uin();1268 string id = rc->m->Id(); 1268 1269 nPort = rc->m->m_nPort; 1269 1270 pthread_mutex_unlock(cancel_mutex); … … 1271 1272 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); 1272 1273 gLog.Info("%sFile Transfer: Waiting for reverse connection.\n", L_TCPxSTR); 1273 bool bConnected = d->WaitForReverseConnection(rc->nId, nUin);1274 bool bConnected = d->WaitForReverseConnection(rc->nId, id.c_str()); 1274 1275 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); 1275 1276 … … 1297 1298 L_TCPxSTR); 1298 1299 TCPSocket s; 1299 bConnected = d->OpenConnectionToUser( nUin, &s, nPort);1300 bConnected = d->OpenConnectionToUser(id.c_str(), &s, nPort); 1300 1301 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); 1301 1302 -
trunk/licq/src/icqd-srv.cpp
r6394 r6402 2083 2083 int CICQDaemon::ConnectToServer(const char* server, unsigned short port) 2084 2084 { 2085 SrvSocket *s = new SrvSocket(gUserManager.icqOwnerUin());2085 SrvSocket* s = new SrvSocket(gUserManager.OwnerId(LICQ_PPID).c_str(), LICQ_PPID); 2086 2086 2087 2087 if (m_bProxyEnabled) … … 2179 2179 ParseDigits(szParsedNumber2, szCellular, 15); 2180 2180 if (!strcmp(szParsedNumber1, szParsedNumber2)) 2181 nUin = pUser->Uin();2181 nUin = strtoul(pUser->IdString(), NULL, 10); 2182 2182 } 2183 2183 FOR_EACH_USER_END … … 3115 3115 if ((*iter)->nId == nSubSequence) 3116 3116 { 3117 ICQUser *u = gUserManager.FetchUser((*iter)->nUin, LOCK_R);3117 ICQUser* u = gUserManager.FetchUser((*iter)->myIdString.c_str(), LICQ_PPID, LOCK_R); 3118 3118 if (u == NULL) 3119 gLog.Warn("%sReverse connection from % lufailed.\n", L_WARNxSTR,3120 (*iter)->nUin);3119 gLog.Warn("%sReverse connection from %s failed.\n", L_WARNxSTR, 3120 (*iter)->myIdString.c_str()); 3121 3121 else 3122 3122 { … … 3298 3298 nPort = nPort2; 3299 3299 3300 char id[16]; 3301 snprintf(id, 15, "%lu", nUin); 3302 3300 3303 pthread_t t; 3301 3304 CReverseConnectToUserData *data = new CReverseConnectToUserData( 3302 nUin, nId, ICQ_CHNxUNKNOWN, nIp, nPort,3305 id, nId, ICQ_CHNxUNKNOWN, nIp, nPort, 3303 3306 nVersion, nFailedPort, nMsgID[0], nMsgID[1]); 3304 3307 pthread_create(&t, NULL, &ReverseConnectToUser_tep, data); … … 3908 3911 nFormat = packet.UnpackUnsignedShortBE(); 3909 3912 nUin = packet.UnpackUinString(); 3910 3911 u = gUserManager.FetchUser(nUin, LOCK_W); 3913 char id[16]; 3914 snprintf(id, 15, "%lu", nUin); 3915 3916 u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 3912 3917 if (u == NULL) 3913 3918 { … … 3923 3928 ++iter) 3924 3929 { 3925 if ((*iter)->nId == nMsgID && (*iter)->nUin == nUin)3926 {3930 if ((*iter)->nId == nMsgID && (*iter)->myIdString == id) 3931 { 3927 3932 gLog.Warn("%sReverse connection from %s failed.\n", L_WARNxSTR, 3928 3933 u->GetAlias()); … … 6579 6584 } 6580 6585 6581 int CICQDaemon::RequestReverseConnection( unsigned long nUin,6586 int CICQDaemon::RequestReverseConnection(const char* id, 6582 6587 unsigned long nData, 6583 6588 unsigned long nLocalIP, … … 6585 6590 unsigned short nRemotePort) 6586 6591 { 6587 if ( nUin == gUserManager.icqOwnerUin())6592 if (gUserManager.FindOwner(id, LICQ_PPID) != NULL) 6588 6593 return -1; 6589 6594 6590 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_W);6595 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 6591 6596 if (u == NULL) return -1; 6592 6597 … … 6598 6603 pthread_mutex_lock(&mutex_reverseconnect); 6599 6604 6600 m_lReverseConnect.push_back( 6601 new CReverseConnectToUserData(nUin, nId, nData, nLocalIP, 6602 nLocalPort, ICQ_VERSION_TCP, 6603 nRemotePort, 0, nId)); 6605 m_lReverseConnect.push_back(new CReverseConnectToUserData(id, nId, nData, 6606 nLocalIP, nLocalPort, ICQ_VERSION_TCP, nRemotePort, 0, nId)); 6604 6607 pthread_mutex_unlock(&mutex_reverseconnect); 6605 6608 -
trunk/licq/src/icqd-tcp.cpp
r6382 r6402 1213 1213 * Shake hands on the given socket with the given user. 1214 1214 *-------------------------------------------------------------------------*/ 1215 bool CICQDaemon::Handshake_Send(TCPSocket *s, unsigned long nUin,1215 bool CICQDaemon::Handshake_Send(TCPSocket *s, const char* id, 1216 1216 unsigned short nPort, unsigned short nVersion, bool bConfirm, 1217 1217 unsigned long nId) 1218 1218 { 1219 1219 s->SetVersion(nVersion); 1220 s->SetOwner(nUin); 1220 s->SetOwner(id, LICQ_PPID); 1221 1222 unsigned long nUin = strtoul(id, NULL, 10); 1221 1223 1222 1224 switch (nVersion) … … 1359 1361 * to the global socket manager and to the user. 1360 1362 *----------------------------------------------------------------------------*/ 1361 int CICQDaemon::ConnectToUser( unsigned long nUin, unsigned char nChannel)1362 { 1363 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_W);1363 int CICQDaemon::ConnectToUser(const char* id, unsigned char nChannel) 1364 { 1365 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 1364 1366 if (u == NULL) return -1; 1365 1367 … … 1370 1372 { 1371 1373 gUserManager.DropUser(u); 1372 gLog.Warn(tr("%sConnection attempted to already connected user (% ld).\n"),1373 L_WARNxSTR, nUin);1374 gLog.Warn(tr("%sConnection attempted to already connected user (%s).\n"), 1375 L_WARNxSTR, id); 1374 1376 return sd; 1375 1377 } … … 1387 1389 struct timeval tv = { 2, 0 }; 1388 1390 if (select(0, NULL, NULL, NULL, &tv) == -1 && errno == EINTR) return -1; 1389 u = gUserManager.FetchUser( nUin, LOCK_W);1391 u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 1390 1392 if (u == NULL) return -1; 1391 1393 } … … 1395 1397 if (sd != -1) return sd; 1396 1398 1397 TCPSocket *s = new TCPSocket(nUin);1398 if (!OpenConnectionToUser( nUin, s, nPort))1399 { 1400 u = gUserManager.FetchUser( nUin, LOCK_W);1399 TCPSocket* s = new TCPSocket(id, LICQ_PPID); 1400 if (!OpenConnectionToUser(id, s, nPort)) 1401 { 1402 u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 1401 1403 if (u != NULL) u->SetConnectionInProgress(false); 1402 1404 gUserManager.DropUser(u); … … 1405 1407 } 1406 1408 s->SetChannel(nChannel); 1407 1408 gLog.Info(tr("%sShaking hands with %s (% ld) [v%d].\n"), L_TCPxSTR,1409 szAlias, nUin, nVersion);1409 1410 gLog.Info(tr("%sShaking hands with %s (%s) [v%d].\n"), L_TCPxSTR, 1411 szAlias, id, nVersion); 1410 1412 nPort = s->LocalPort(); 1411 1413 1412 if (!Handshake_Send(s, nUin, 0, nVersion))1413 { 1414 u = gUserManager.FetchUser( nUin, LOCK_W);1414 if (!Handshake_Send(s, id, 0, nVersion)) 1415 { 1416 u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 1415 1417 if (u != NULL) u->SetConnectionInProgress(false); 1416 1418 gUserManager.DropUser(u); … … 1422 1424 1423 1425 // Set the socket descriptor in the user 1424 u = gUserManager.FetchUser( nUin, LOCK_W);1426 u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 1425 1427 if (u == NULL) return -1; 1426 1428 u->SetSocketDesc(s); … … 1445 1447 * Connects a socket to a given user on a given port. 1446 1448 *----------------------------------------------------------------------------*/ 1447 bool CICQDaemon::OpenConnectionToUser( unsigned long nUin, TCPSocket *sock,1449 bool CICQDaemon::OpenConnectionToUser(const char* id, TCPSocket *sock, 1448 1450 unsigned short nPort) 1449 1451 { 1450 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);1452 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_R); 1451 1453 if (u == NULL) return false; 1452 1454 … … 1532 1534 * to the global socket manager and to the user. 1533 1535 *----------------------------------------------------------------------------*/ 1534 int CICQDaemon::ReverseConnectToUser( unsigned long nUin, unsigned long nIp,1536 int CICQDaemon::ReverseConnectToUser(const char* id, unsigned long nIp, 1535 1537 unsigned short nPort, unsigned short nVersion, unsigned short nFailedPort, 1536 1538 unsigned long nId, unsigned long nMsgID1, unsigned long nMsgID2) … … 1551 1553 } 1552 1554 1553 TCPSocket *s = new TCPSocket(nUin);1555 TCPSocket* s = new TCPSocket(id, LICQ_PPID); 1554 1556 char buf[32]; 1555 1557 1556 gLog.Info(tr("%sReverse connecting to % lu at %s:%d.\n"), L_TCPxSTR, nUin,1558 gLog.Info(tr("%sReverse connecting to %s at %s:%d.\n"), L_TCPxSTR, id, 1557 1559 ip_ntoa(nIp, buf), nPort); 1558 1560 … … 1563 1565 { 1564 1566 char buf[128]; 1565 gLog.Warn(tr("%sReverse connect to %lu failed:\n%s%s.\n"), L_WARNxSTR, 1566 nUin, L_BLANKxSTR, s->ErrorStr(buf, 128)); 1567 1568 CPU_ReverseConnectFailed *p = new CPU_ReverseConnectFailed(nUin, nMsgID1, 1569 nMsgID2, nPort, 1570 nFailedPort, nId); 1567 gLog.Warn(tr("%sReverse connect to %s failed:\n%s%s.\n"), L_WARNxSTR, 1568 id, L_BLANKxSTR, s->ErrorStr(buf, 128)); 1569 1570 CPU_ReverseConnectFailed* p = new CPU_ReverseConnectFailed(id, nMsgID1, 1571 nMsgID2, nPort, nFailedPort, nId); 1571 1572 SendEvent_Server(p); 1572 1573 return -1; 1573 1574 } 1574 1575 1575 gLog.Info(tr("%sReverse shaking hands with % lu.\n"), L_TCPxSTR, nUin);1576 gLog.Info(tr("%sReverse shaking hands with %s.\n"), L_TCPxSTR, id); 1576 1577 bool bConfirm = ftm == NULL && cm == NULL; 1577 1578 … … 1579 1580 nVersion = VersionToUse(nVersion); 1580 1581 1581 if (!Handshake_Send(s, nUin, 0, nVersion, bConfirm, nId))1582 if (!Handshake_Send(s, id, 0, nVersion, bConfirm, nId)) 1582 1583 { 1583 1584 delete s; … … 1605 1606 { 1606 1607 // Set the socket descriptor in the user if this user is on our list 1607 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_W);1608 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 1608 1609 if (u != NULL) 1609 1610 { … … 1625 1626 bool CICQDaemon::ProcessTcpPacket(TCPSocket *pSock) 1626 1627 { 1627 unsigned long nUin,senderIp, localIp,1628 unsigned long senderIp, localIp, 1628 1629 senderPort, junkLong, nPort, nPortReversed; 1629 1630 unsigned short version, command, junkShort, newCommand, messageLen, … … 1632 1633 bool errorOccured = false; 1633 1634 char *message = 0; 1635 char id[16] = ""; 1634 1636 1635 1637 // only used for v7,v8 … … 1647 1649 case 3: 1648 1650 { 1651 unsigned long nUin; 1649 1652 packet >> nUin 1650 1653 >> version … … 1655 1658 >> messageLen // length of incoming message 1656 1659 ; 1660 snprintf(id, 15, "%lu", nUin); 1657 1661 break; 1658 1662 } … … 1667 1671 return false; 1668 1672 } 1673 unsigned long nUin; 1669 1674 packet >> nUin 1670 1675 >> version … … 1676 1681 >> messageLen // length of incoming message 1677 1682 ; 1683 snprintf(id, 15, "%lu", nUin); 1678 1684 break; 1679 1685 } 1680 1686 case 6: 1681 1687 { 1682 nUin = pSock->Owner();1688 strncpy(id, pSock->OwnerId(), 15); id[15] = '\0'; 1683 1689 if (!Decrypt_Client(&packet, 6)) 1684 1690 { … … 1703 1709 case 8: 1704 1710 { 1705 nUin = pSock->Owner();1711 strncpy(id, pSock->OwnerId(), 15); id[15] = '\0'; 1706 1712 if (!Decrypt_Client(&packet, nInVersion)) 1707 1713 { … … 1725 1731 msgFlags = packet.UnpackUnsignedShort(); 1726 1732 packet >> messageLen; 1727 1733 1728 1734 // Stupid AOL 1729 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);1735 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_R); 1730 1736 if (u && (u->LicqVersion() == 0 || u->LicqVersion() >= 1022)) 1731 1737 { … … 1751 1757 1752 1758 // Some simple validation of the packet 1753 if ( nUin == 0|| command == 0)1759 if (id[0] == '\0' || command == 0) 1754 1760 { 1755 1761 char *buf; 1756 gLog.Unknown("%sInvalid TCP packet (uin: % 08lx, cmd: %04x):\n%s\n",1757 L_UNKNOWNxSTR, nUin, command, packet.print(buf));1762 gLog.Unknown("%sInvalid TCP packet (uin: %s, cmd: %04x):\n%s\n", 1763 L_UNKNOWNxSTR, id, command, packet.print(buf)); 1758 1764 delete [] buf; 1759 1765 return false; 1760 1766 } 1761 1767 1762 if ( nUin == gUserManager.icqOwnerUin() || nUin != pSock->Owner())1768 if (gUserManager.FindOwner(id, LICQ_PPID) != NULL || strcmp(id, pSock->OwnerId()) != 0) 1763 1769 { 1764 1770 char *buf; 1765 if ( nUin == gUserManager.icqOwnerUin())1771 if (gUserManager.FindOwner(id, LICQ_PPID) != NULL) 1766 1772 gLog.Warn(tr("%sTCP message from self (probable spoof):\n%s\n"), L_WARNxSTR, packet.print(buf)); 1767 1773 else 1768 gLog.Warn(tr("%sTCP message from invalid UIN (% ld, expect %ld):\n%s\n"),1769 L_WARNxSTR, nUin, pSock->Owner(), packet.print(buf));1774 gLog.Warn(tr("%sTCP message from invalid UIN (%s, expect %s):\n%s\n"), 1775 L_WARNxSTR, id, pSock->OwnerId(), packet.print(buf)); 1770 1776 delete [] buf; 1771 1777 return false; … … 1779 1785 // find which user was sent 1780 1786 bool bNewUser = false; 1781 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_W);1787 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_W); 1782 1788 if (u == NULL) 1783 1789 { 1784 u = new ICQUser( nUin);1790 u = new ICQUser(id, LICQ_PPID); 1785 1791 u->SetSocketDesc(pSock); 1786 1792 bNewUser = true; … … 1923 1929 nMask |= licqVersion; 1924 1930 if (licqChar == 'L') 1925 gLog.Info(tr("%sMessage from %s (%ld) [Licq %s].\n"), L_TCPxSTR, u->GetAlias(),1926 nUin, CUserEvent::LicqVersionToString(licqVersion));1927 else1928 gLog.Info(tr("%sMessage from %s (%ld).\n"), L_TCPxSTR, u->GetAlias(), nUin);1931 gLog.Info(tr("%sMessage from %s (%s) [Licq %s].\n"), L_TCPxSTR, 1932 u->GetAlias(), id, CUserEvent::LicqVersionToString(licqVersion)); 1933 else 1934 gLog.Info(tr("%sMessage from %s (%s).\n"), L_TCPxSTR, u->GetAlias(), id); 1929 1935 1930 1936 CPT_AckGeneral p(newCommand, theSequence, true, bAccept, u); … … 1951 1957 // FIXME should either refuse the event or have a special auto response 1952 1958 // for rejected events instead of pretending to accept the user 1953 RejectEvent(nUin, e);1959 RejectEvent(id, e); 1954 1960 break; 1955 1961 } … … 1982 1988 packet >> licqChar >> licqVersion; 1983 1989 if (licqChar == 'L') 1984 gLog.Info(tr("%s%s (%ld) requested auto response [Licq %s].\n"), L_TCPxSTR,1985 u->GetAlias(), nUin, CUserEvent::LicqVersionToString(licqVersion));1986 else1987 gLog.Info(tr("%s%s (%ld) requested auto response.\n"), L_TCPxSTR, u->GetAlias(), nUin);1990 gLog.Info(tr("%s%s (%s) requested auto response [Licq %s].\n"), L_TCPxSTR, 1991 u->GetAlias(), id, CUserEvent::LicqVersionToString(licqVersion)); 1992 else 1993 gLog.Info(tr("%s%s (%s) requested auto response.\n"), L_TCPxSTR, u->GetAlias(), id); 1988 1994 1989 1995 CPT_AckGeneral p(newCommand, theSequence, true, false, u); … … 1993 1999 u->SetLastCheckedAutoResponse(); 1994 2000 1995 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_EVENTS, nUin));2001 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_EVENTS, id, LICQ_PPID)); 1996 2002 break; 1997 2003 } … … 2021 2027 nMask |= licqVersion; 2022 2028 if (licqChar == 'L') 2023 gLog.Info(tr("%sURL from %s (%ld) [Licq %s].\n"), L_TCPxSTR, u->GetAlias(),2024 nUin, CUserEvent::LicqVersionToString(licqVersion));2025 else2026 gLog.Info(tr("%sURL from %s (%ld).\n"), L_TCPxSTR, u->GetAlias(), nUin);2029 gLog.Info(tr("%sURL from %s (%s) [Licq %s].\n"), L_TCPxSTR, u->GetAlias(), 2030 id, CUserEvent::LicqVersionToString(licqVersion)); 2031 else 2032 gLog.Info(tr("%sURL from %s (%s).\n"), L_TCPxSTR, u->GetAlias(), id); 2027 2033 2028 2034 CEventUrl *e = CEventUrl::Parse(message, ICQ_CMDxTCP_START, TIME_NOW, nMask); … … 2054 2060 if (Ignore(IGNORE_NEWUSERS)) 2055 2061 { 2056 RejectEvent(nUin, e);2062 RejectEvent(id, e); 2057 2063 break; 2058 2064 } … … 2090 2096 nMask |= licqVersion; 2091 2097 if (licqChar == 'L') 2092 gLog.Info(tr("%sContact list from %s (%ld) [Licq %s].\n"), L_TCPxSTR,2093 u->GetAlias(), nUin, CUserEvent::LicqVersionToString(licqVersion));2094 else2095 gLog.Info(tr("%sContact list from %s (%ld).\n"), L_TCPxSTR, u->GetAlias(),2096 nUin);2098 gLog.Info(tr("%sContact list from %s (%s) [Licq %s].\n"), L_TCPxSTR, 2099 u->GetAlias(), id, CUserEvent::LicqVersionToString(licqVersion)); 2100 else 2101 gLog.Info(tr("%sContact list from %s (%s).\n"), L_TCPxSTR, 2102 u->GetAlias(), id); 2097 2103 2098 2104 CEventContactList *e = CEventContactList::Parse(message, ICQ_CMDxTCP_START, TIME_NOW, nMask); … … 2124 2130 if (Ignore(IGNORE_NEWUSERS)) 2125 2131 { 2126 RejectEvent(nUin, e);2132 RejectEvent(id, e); 2127 2133 break; 2128 2134 } … … 2157 2163 2158 2164 if (licqChar == 'L') 2159 gLog.Info(tr("%sChat request from %s (%ld) [Licq %s].\n"), L_TCPxSTR,2160 u->GetAlias(), nUin, CUserEvent::LicqVersionToString(licqVersion));2161 else2162 gLog.Info(tr("%sChat request from %s (%ld).\n"), L_TCPxSTR, u->GetAlias(),2163 nUin);2165 gLog.Info(tr("%sChat request from %s (%s) [Licq %s].\n"), L_TCPxSTR, 2166 u->GetAlias(), id, CUserEvent::LicqVersionToString(licqVersion)); 2167 else 2168 gLog.Info(tr("%sChat request from %s (%s).\n"), L_TCPxSTR, 2169 u->GetAlias(), id); 2164 2170 2165 2171 // translating string with translation table … … 2173 2179 if (Ignore(IGNORE_NEWUSERS)) 2174 2180 { 2175 RejectEvent(nUin, e);2181 RejectEvent(id, e); 2176 2182 break; 2177 2183 } … … 2211 2217 2212 2218 if (licqChar == 'L') 2213 gLog.Info(tr("%sFile transfer request from %s (%ld) [Licq %s].\n"),2214 L_TCPxSTR, u->GetAlias(), nUin, CUserEvent::LicqVersionToString(licqVersion));2215 else2216 gLog.Info(tr("%sFile transfer request from %s (%ld).\n"), L_TCPxSTR,2217 u->GetAlias(), nUin);2219 gLog.Info(tr("%sFile transfer request from %s (%s) [Licq %s].\n"), 2220 L_TCPxSTR, u->GetAlias(), id, CUserEvent::LicqVersionToString(licqVersion)); 2221 else 2222 gLog.Info(tr("%sFile transfer request from %s (%s).\n"), L_TCPxSTR, 2223 u->GetAlias(), id); 2218 2224 2219 2225 ConstFileList filelist; … … 2230 2236 if (Ignore(IGNORE_NEWUSERS)) 2231 2237 { 2232 RejectEvent(nUin, e);2238 RejectEvent(id, e); 2233 2239 break; 2234 2240 } … … 2297 2303 packet.incDataPosRead(2); // reversed port (BE) 2298 2304 2299 gLog.Info(tr("%sFile transfer request from %s (%ld).\n"), L_TCPxSTR,2300 u->GetAlias(), nUin);2305 gLog.Info(tr("%sFile transfer request from %s (%s).\n"), 2306 L_TCPxSTR, u->GetAlias(), id); 2301 2307 2302 2308 ConstFileList filelist; … … 2311 2317 if (Ignore(IGNORE_NEWUSERS)) 2312 2318 { 2313 RejectEvent(nUin, e);2319 RejectEvent(id, e); 2314 2320 break; 2315 2321 } … … 2332 2338 nPort = nPortReversed; 2333 2339 2334 gLog.Info(tr("%sChat request from %s (%ld).\n"), L_TCPxSTR,2335 u->GetAlias(), nUin);2336 2340 gLog.Info(tr("%sChat request from %s (%s).\n"), L_TCPxSTR, 2341 u->GetAlias(), id); 2342 2337 2343 // translating string with translation table 2338 2344 gTranslator.ServerToClient(szMessage); … … 2343 2349 if (Ignore(IGNORE_NEWUSERS)) 2344 2350 { 2345 RejectEvent(nUin, e);2351 RejectEvent(id, e); 2346 2352 break; 2347 2353 } … … 2356 2362 case ICQ_CMDxSUB_URL: 2357 2363 { 2358 gLog.Info(tr("%sURL from %s (%ld).\n"), L_TCPxSTR, u->GetAlias(), nUin);2364 gLog.Info(tr("%sURL from %s (%s).\n"), L_TCPxSTR, u->GetAlias(), id); 2359 2365 CEventUrl *e = CEventUrl::Parse(szMessage, ICQ_CMDxTCP_START, 2360 2366 TIME_NOW, nMask); … … 2373 2379 if (Ignore(IGNORE_NEWUSERS)) 2374 2380 { 2375 RejectEvent(nUin, e);2381 RejectEvent(id, e); 2376 2382 break; 2377 2383 } … … 2386 2392 case ICQ_CMDxSUB_CONTACTxLIST: 2387 2393 { 2388 gLog.Info(tr("%sContact list from %s (%ld).\n"), L_TCPxSTR,2389 u->GetAlias(), nUin);2394 gLog.Info(tr("%sContact list from %s (%s).\n"), L_TCPxSTR, 2395 u->GetAlias(), id); 2390 2396 CEventContactList *e = CEventContactList::Parse(szMessage, 2391 2397 ICQ_CMDxTCP_START, … … 2405 2411 if (Ignore(IGNORE_NEWUSERS)) 2406 2412 { 2407 RejectEvent(nUin, e);2413 RejectEvent(id, e); 2408 2414 break; 2409 2415 } … … 2424 2430 case ICQ_CMDxSUB_SECURExOLD: 2425 2431 { 2426 gLog.Info(tr("%sReceived old-style key request from %s (%ld) but we do not support it.\n"),2427 L_TCPxSTR, u->GetAlias(), nUin);2432 gLog.Info(tr("%sReceived old-style key request from %s (%s) but we do not support it.\n"), 2433 L_TCPxSTR, u->GetAlias(), id); 2428 2434 // Send the nack back 2429 2435 CPT_AckOldSecureChannel p(theSequence, u); … … 2449 2455 2450 2456 if (licqChar == 'L') 2451 gLog.Info(tr("%sSecure channel request from %s (%ld) [Licq %s].\n"),2452 L_TCPxSTR, u->GetAlias(), nUin, CUserEvent::LicqVersionToString(licqVersion));2453 else2454 gLog.Info(tr("%sSecure channel request from %s (%ld).\n"), L_TCPxSTR,2455 u->GetAlias(), nUin);2457 gLog.Info(tr("%sSecure channel request from %s (%s) [Licq %s].\n"), 2458 L_TCPxSTR, u->GetAlias(), id, CUserEvent::LicqVersionToString(licqVersion)); 2459 else 2460 gLog.Info(tr("%sSecure channel request from %s (%s).\n"), L_TCPxSTR, 2461 u->GetAlias(), id); 2456 2462 2457 2463 CPT_AckOpenSecureChannel p(theSequence, true, u); … … 2475 2481 2476 2482 u->SetSendServer(false); 2477 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, nUin, 1));2478 2479 gLog.Info(tr("%sSecure channel established with %s (%ld).\n"),2480 L_SSLxSTR, u->GetAlias(), nUin);2483 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, id, LICQ_PPID, 1)); 2484 2485 gLog.Info(tr("%sSecure channel established with %s (%s).\n"), 2486 L_SSLxSTR, u->GetAlias(), id); 2481 2487 2482 2488 break; 2483 2489 2484 2490 #else // We do not support OpenSSL 2485 gLog.Info(tr("%sReceived secure channel request from %s (%ld) but we do not support OpenSSL.\n"),2486 L_TCPxSTR, u->GetAlias(), nUin);2491 gLog.Info(tr("%sReceived secure channel request from %s (%s) but we do not support OpenSSL.\n"), 2492 L_TCPxSTR, u->GetAlias(), id); 2487 2493 // Send the nack back 2488 2494 CPT_AckOpenSecureChannel p(theSequence, false, u); … … 2510 2516 2511 2517 if (licqChar == 'L') 2512 gLog.Info(tr("%sSecure channel closed by %s (%ld) [Licq %s].\n"),2513 L_TCPxSTR, u->GetAlias(), nUin, CUserEvent::LicqVersionToString(licqVersion));2514 else2515 gLog.Info(tr("%sSecure channel closed by %s (%ld).\n"), L_TCPxSTR,2516 u->GetAlias(), nUin);2518 gLog.Info(tr("%sSecure channel closed by %s (%s) [Licq %s].\n"), 2519 L_TCPxSTR, u->GetAlias(), id, CUserEvent::LicqVersionToString(licqVersion)); 2520 else 2521 gLog.Info(tr("%sSecure channel closed by %s (%s).\n"), L_TCPxSTR, 2522 u->GetAlias(), id); 2517 2523 2518 2524 // send ack … … 2522 2528 pSock->SecureStop(); 2523 2529 u->SetSecure(false); 2524 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, nUin, 0));2530 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, id, LICQ_PPID, 0)); 2525 2531 break; 2526 2532 2527 2533 #else // We do not support OpenSSL 2528 gLog.Info(tr("%sReceived secure channel close from %s (%ld) but we do not support OpenSSL.\n"),2529 L_TCPxSTR, u->GetAlias(), nUin);2534 gLog.Info(tr("%sReceived secure channel close from %s (%s) but we do not support OpenSSL.\n"), 2535 L_TCPxSTR, u->GetAlias(), id); 2530 2536 // Send the nack back 2531 2537 CPT_AckCloseSecureChannel p(theSequence, u); … … 2736 2742 if (licqChar == 'L') sprintf(l, " [Licq %s]", 2737 2743 CUserEvent::LicqVersionToString(licqVersion)); 2738 gLog.Info(tr("%sSecure channel response from %s (%ld)%s.\n"), L_TCPxSTR,2739 u->GetAlias(), nUin, l);2744 gLog.Info(tr("%sSecure channel response from %s (%s)%s.\n"), L_TCPxSTR, 2745 u->GetAlias(), id, l); 2740 2746 2741 2747 ICQEvent *e = NULL; … … 2744 2750 if (message[0] == '\0') 2745 2751 { 2746 gLog.Info(tr("%s%s (%ld) does not support OpenSSL.\n"), L_TCPxSTR,2747 u->GetAlias(), nUin);2752 gLog.Info(tr("%s%s (%s) does not support OpenSSL.\n"), L_TCPxSTR, 2753 u->GetAlias(), id); 2748 2754 u->SetSecure(false); 2749 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, nUin, 0));2755 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, id, LICQ_PPID, 0)); 2750 2756 // find the event, fail it 2751 2757 e = DoneEvent(sockfd, theSequence, EVENT_FAILED); … … 2759 2765 if (e == NULL) 2760 2766 { 2761 gLog.Warn(tr("%sSecure channel response from %s (%ld) when no request in progress.\n"),2762 L_WARNxSTR, u->GetAlias(), nUin);2767 gLog.Warn(tr("%sSecure channel response from %s (%s) when no request in progress.\n"), 2768 L_WARNxSTR, u->GetAlias(), id); 2763 2769 // Close the connection as we are in trouble 2764 2770 u->SetSecure(false); 2765 2771 gUserManager.DropUser(u); 2766 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, nUin, 0));2772 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, id, LICQ_PPID, 0)); 2767 2773 return false; 2768 2774 } … … 2775 2781 else 2776 2782 { 2777 gLog.Info(tr("%sSecure channel established with %s (%ld).\n"), L_SSLxSTR,2778 u->GetAlias(), nUin);2783 gLog.Info(tr("%sSecure channel established with %s (%s).\n"), 2784 L_SSLxSTR, u->GetAlias(), id); 2779 2785 u->SetSecure(true); 2780 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, nUin, 1));2786 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, id, LICQ_PPID, 1)); 2781 2787 } 2782 2788 } … … 2808 2814 char l[32] = ""; 2809 2815 if (licqChar == 'L') sprintf(l, " [Licq %s]", CUserEvent::LicqVersionToString(licqVersion)); 2810 gLog.Info(tr("%sSecure channel with %s (%ld) closed %s.\n"), L_TCPxSTR,2811 u->GetAlias(), nUin, l);2816 gLog.Info(tr("%sSecure channel with %s (%s) closed %s.\n"), L_TCPxSTR, 2817 u->GetAlias(), id, l); 2812 2818 2813 2819 // Find the event, succeed it … … 2826 2832 u->SetSecure(false); 2827 2833 gUserManager.DropUser(u); 2828 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, nUin, 0));2834 PushPluginSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_SECURITY, id, LICQ_PPID, 0)); 2829 2835 2830 2836 // finish up … … 2932 2938 case ICQ_CMDxSUB_CHAT: 2933 2939 { 2934 gLog.Info(tr("%sChat request from %s (%ld) cancelled.\n"), L_TCPxSTR,2935 u->GetAlias(), nUin);2940 gLog.Info(tr("%sChat request from %s (%s) cancelled.\n"), L_TCPxSTR, 2941 u->GetAlias(), id); 2936 2942 if (nInVersion <= 4) 2937 2943 { … … 2958 2964 case ICQ_CMDxSUB_FILE: 2959 2965 { 2960 gLog.Info(tr("%sFile transfer request from %s (%ld) cancelled.\n"),2961 L_TCPxSTR, u->GetAlias(), nUin);2966 gLog.Info(tr("%sFile transfer request from %s (%s) cancelled.\n"), 2967 L_TCPxSTR, u->GetAlias(), id); 2962 2968 if (nInVersion <= 4) 2963 2969 { … … 3727 3733 unsigned long nUin = 0; 3728 3734 unsigned short nVersion = 0; 3735 char id[16]; 3729 3736 3730 3737 switch (VersionToUse(nVersionMajor)) … … 3736 3743 CPacketTcp_Handshake_v7 p_in(&b); 3737 3744 nUin = p_in.SourceUin(); 3738 3739 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R); 3745 snprintf(id, 16, "%lu", nUin); 3746 3747 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_R); 3740 3748 if (u == NULL && !bChat) 3741 3749 { … … 3749 3757 { 3750 3758 char ipbuf[32]; 3751 gLog.Warn("%sSpoofed connection from %s as uin % lu.\n", L_WARNxSTR,3752 s->RemoteIpStr(ipbuf), nUin);3759 gLog.Warn("%sSpoofed connection from %s as uin %s.\n", L_WARNxSTR, 3760 s->RemoteIpStr(ipbuf), id); 3753 3761 return false; 3754 3762 } … … 3802 3810 return false; 3803 3811 } 3804 if ((*iter)->nId == p_in.Id() && (*iter)-> nUin == nUin)3812 if ((*iter)->nId == p_in.Id() && (*iter)->myIdString == id) 3805 3813 { 3806 3814 s->SetChannel((*iter)->nData); … … 3829 3837 CPacketTcp_Handshake_v6 p_in(&b); 3830 3838 nUin = p_in.SourceUin(); 3831 3832 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R); 3839 snprintf(id, 16, "%lu", nUin); 3840 3841 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_R); 3833 3842 if (u == NULL) 3834 3843 { … … 3842 3851 { 3843 3852 char ipbuf[32]; 3844 gLog.Warn("%sSpoofed connection from %s as uin % lu.\n", L_WARNxSTR,3845 s->RemoteIpStr(ipbuf), nUin);3853 gLog.Warn("%sSpoofed connection from %s as uin %s.\n", L_WARNxSTR, 3854 s->RemoteIpStr(ipbuf), id); 3846 3855 return false; 3847 3856 } … … 3876 3885 { 3877 3886 // For v6 there is no connection id, so just use uin 3878 if ((*iter)-> nUin == nUin)3887 if ((*iter)->myIdString == id) 3879 3888 { 3880 3889 (*iter)->bSuccess = true; … … 3893 3902 b.UnpackUnsignedLong(); // port number 3894 3903 nUin = b.UnpackUnsignedLong(); 3904 snprintf(id, 16, "%lu", nUin); 3895 3905 nVersion = VersionToUse(nVersionMajor); 3896 3906 3897 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);3907 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_R); 3898 3908 if (u == NULL) 3899 3909 { … … 3911 3921 char ipbuf[32]; 3912 3922 return false; 3913 gLog.Warn("%sConnection from %s as % lupossible spoof.\n", L_WARNxSTR,3914 s->RemoteIpStr(ipbuf), nUin);3923 gLog.Warn("%sConnection from %s as %s possible spoof.\n", L_WARNxSTR, 3924 s->RemoteIpStr(ipbuf), id); 3915 3925 return false; 3916 3926 } 3917 3927 3918 3928 pthread_mutex_lock(&mutex_reverseconnect); 3919 3929 std::list<CReverseConnectToUserData *>::iterator iter; … … 3922 3932 { 3923 3933 // For v4 there is no connection id, so just use uin 3924 if ((*iter)-> nUin == nUin)3934 if ((*iter)->myIdString == id) 3925 3935 { 3926 3936 (*iter)->bSuccess = true; … … 3940 3950 b.UnpackUnsignedLong(); // port number 3941 3951 nUin = b.UnpackUnsignedLong(); 3952 snprintf(id, 16, "%lu", nUin); 3942 3953 nVersion = 2; 3943 3944 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);3954 3955 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_R); 3945 3956 if (u == NULL) 3946 3957 { … … 3958 3969 char ipbuf[32]; 3959 3970 return false; 3960 gLog.Warn("%sConnection from %s as % lupossible spoof.\n", L_WARNxSTR,3961 s->RemoteIpStr(ipbuf), nUin);3971 gLog.Warn("%sConnection from %s as %s possible spoof.\n", L_WARNxSTR, 3972 s->RemoteIpStr(ipbuf), id); 3962 3973 return false; 3963 3974 } … … 3969 3980 { 3970 3981 // For v2 there is no connection id, so just use uin 3971 if ((*iter)-> nUin == nUin)3982 if ((*iter)->myIdString == id) 3972 3983 { 3973 3984 (*iter)->bSuccess = true; … … 3991 4002 } 3992 4003 3993 char szUin[13]; 3994 snprintf(szUin, 12, "%lu", nUin); 3995 s->SetOwner(szUin, LICQ_PPID); 4004 s->SetOwner(id, LICQ_PPID); 3996 4005 s->SetVersion(nVersion); 3997 4006 -
trunk/licq/src/icqd-threads.cpp
r6401 r6402 384 384 if (e->m_nSocketDesc == -1) 385 385 { 386 unsigned long nDestinationUin = e->m_nDestinationUin; 386 string id = e->Id(); 387 unsigned long ppid = e->PPID(); 387 388 unsigned char nChannel = e->Channel(); 388 389 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); 389 390 ICQUser *u = gUserManager.FetchUser(nDestinationUin, LOCK_R);390 391 ICQUser* u = gUserManager.FetchUser(id.c_str(), ppid, LOCK_R); 391 392 if (u == NULL) 392 393 { … … 416 417 if (!bSendIntIp && nVersion > 6 && nMode != MODE_DIRECT) 417 418 { 418 int nId = d->RequestReverseConnection(nDestinationUin, nChannel, nIP, 419 nLocalPort, nRemotePort); 419 int nId = d->RequestReverseConnection(id.c_str(), nChannel, nIP, nLocalPort, nRemotePort); 420 420 if (nId != -1) 421 421 { 422 d->WaitForReverseConnection(nId, nDestinationUin);423 u = gUserManager.FetchUser( nDestinationUin, LOCK_R);422 d->WaitForReverseConnection(nId, id.c_str()); 423 u = gUserManager.FetchUser(id.c_str(), LICQ_PPID, LOCK_R); 424 424 if (u == NULL) 425 425 { … … 445 445 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); 446 446 447 socket = d->ConnectToUser( nDestinationUin, nChannel);447 socket = d->ConnectToUser(id.c_str(), nChannel); 448 448 } 449 449 } 450 450 else 451 451 { 452 socket = d->ConnectToUser( nDestinationUin, nChannel);452 socket = d->ConnectToUser(id.c_str(), nChannel); 453 453 454 454 // if we failed, try through server … … 459 459 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); 460 460 461 int nId = d->RequestReverseConnection( nDestinationUin, nChannel, nIP,461 int nId = d->RequestReverseConnection(id.c_str(), nChannel, nIP, 462 462 nLocalPort, nRemotePort); 463 463 if (nId != -1) 464 464 { 465 d->WaitForReverseConnection(nId, nDestinationUin);466 u = gUserManager.FetchUser( nDestinationUin, LOCK_R);465 d->WaitForReverseConnection(nId, id.c_str()); 466 u = gUserManager.FetchUser(id.c_str(), LICQ_PPID, LOCK_R); 467 467 if (u == NULL) 468 468 { … … 604 604 CReverseConnectToUserData *p = (CReverseConnectToUserData *)v; 605 605 606 gLicqDaemon->ReverseConnectToUser(p-> nUin, p->nIp, p->nPort, p->nVersion,607 p->nFailedPort, p->nId, p->nMsgID1, p->nMsgID2);606 gLicqDaemon->ReverseConnectToUser(p->myIdString.c_str(), p->nIp, p->nPort, 607 p->nVersion, p->nFailedPort, p->nId, p->nMsgID1, p->nMsgID2); 608 608 609 609 delete p; -
trunk/licq/src/icqd.cpp
r6390 r6402 2722 2722 } 2723 2723 2724 bool CICQDaemon::WaitForReverseConnection(unsigned short id, unsigned long uin)2724 bool CICQDaemon::WaitForReverseConnection(unsigned short id, const char* userId) 2725 2725 { 2726 2726 bool bSuccess = false; … … 2731 2731 ++iter) 2732 2732 { 2733 if ((*iter)->nId == id && (*iter)-> nUin == uin)2733 if ((*iter)->nId == id && (*iter)->myIdString == userId) 2734 2734 break; 2735 2735 } … … 2757 2757 goto done; 2758 2758 } 2759 if ((*iter)->nId == id && (*iter)-> nUin == uin)2759 if ((*iter)->nId == id && (*iter)->myIdString == userId) 2760 2760 { 2761 2761 if ((*iter)->bFinished) … … 2775 2775 ++iter) 2776 2776 { 2777 if ((*iter)->nId == id && (*iter)-> nUin == uin)2777 if ((*iter)->nId == id && (*iter)->myIdString == userId) 2778 2778 { 2779 2779 delete *iter; … … 2788 2788 } 2789 2789 2790 CReverseConnectToUserData::CReverseConnectToUserData( unsigned long uin, unsigned long id,2790 CReverseConnectToUserData::CReverseConnectToUserData(const char* idString, unsigned long id, 2791 2791 unsigned long data, unsigned long ip, unsigned short port, 2792 2792 unsigned short version, unsigned short failedport, unsigned long msgid1, 2793 2793 unsigned long msgid2) : 2794 nUin(uin), nId(id), nData(data), nIp(ip), nPort(port),2794 myIdString(idString), nId(id), nData(data), nIp(ip), nPort(port), 2795 2795 nFailedPort(failedport), nVersion(version), nMsgID1(msgid1), 2796 2796 nMsgID2(msgid2), bSuccess(false), bFinished(false) -
trunk/licq/src/icqpacket.cpp
r6387 r6402 1761 1761 CPU_Type2Message::InitBuffer(); 1762 1762 1763 ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 1764 1765 buffer->PackUnsignedLong(o->Uin()); 1763 buffer->PackUnsignedLong(gUserManager.icqOwnerUin()); 1766 1764 buffer->PackUnsignedLong(nLocalIP); 1767 1765 buffer->PackUnsignedLong(nLocalPort); … … 1774 1772 buffer->PackUnsignedLong(m_nSubSequence); 1775 1773 // buffer->PackUnsignedLongBE(0x00030000); 1776 gUserManager.DropOwner(o); 1777 } 1778 1779 CPU_ReverseConnectFailed::CPU_ReverseConnectFailed(unsigned long nUin, 1774 } 1775 1776 CPU_ReverseConnectFailed::CPU_ReverseConnectFailed(const char* szUin, 1780 1777 unsigned long nMsgID1, 1781 1778 unsigned long nMsgID2, … … 1785 1782 : CPU_CommonFamily(ICQ_SNACxFAM_MESSAGE, ICQ_SNACxMSG_SERVERxREPLYxMSG) 1786 1783 { 1787 char szUin[13]; 1788 int nUinLen = snprintf(szUin, 12, "%lu", nUin); 1784 int nUinLen = strlen(szUin); 1789 1785 1790 1786 m_nSize += 8 + 2 + 1 + nUinLen + 2 + 4 + 4 + 4 + 2 + 4; 1791 1787 1792 1788 InitBuffer(); 1793 1794 ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R);1795 1789 1796 1790 buffer->PackUnsignedLongBE(nMsgID1); … … 1800 1794 buffer->Pack(szUin, nUinLen); 1801 1795 buffer->PackUnsignedShortBE(0x0003); 1802 buffer->PackUnsignedLong( o->Uin());1796 buffer->PackUnsignedLong(gUserManager.icqOwnerUin()); 1803 1797 buffer->PackUnsignedLong(nFailedPort); 1804 1798 buffer->PackUnsignedLong(nOurPort); 1805 1799 buffer->PackUnsignedShort(ICQ_VERSION_TCP); 1806 1800 buffer->PackUnsignedLong(nConnectID); 1807 1808 gUserManager.DropOwner(o);1809 1801 } 1810 1802 … … 4432 4424 buffer->PackUnsignedLong(nLocalPort == 0 ? s_nLocalPort : nLocalPort); 4433 4425 4434 ICQUser *u = gUserManager.FetchUser(nDestinationUin, LOCK_R); 4426 char id[16]; 4427 snprintf(id, 16, "%lu", nDestinationUin); 4428 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_R); 4435 4429 if (u) 4436 4430 { … … 4489 4483 buffer->PackUnsignedLong(nLocalPort == 0 ? s_nLocalPort : nLocalPort); 4490 4484 4491 ICQUser *u = gUserManager.FetchUser(nDestinationUin, LOCK_R); 4485 char id[16]; 4486 snprintf(id, 16, "%lu", nDestinationUin); 4487 ICQUser* u = gUserManager.FetchUser(id, LICQ_PPID, LOCK_R); 4492 4488 if (u) 4493 4489 { -
trunk/licq/src/oscarservice.cpp
r6401 r6402 447 447 448 448 ChangeStatus(STATUS_CONNECTED); 449 SrvSocket *s = new SrvSocket(gUserManager.icqOwnerUin());449 SrvSocket* s = new SrvSocket(gUserManager.OwnerId(LICQ_PPID).c_str(), LICQ_PPID); 450 450 gLog.Info(tr("%sConnecting to separate server for service 0x%02X.\n"), 451 451 L_SRVxSTR, myFam);
