Changeset 3768 for trunk/console
- Timestamp:
- 06/14/04 08:20:17 (4 years ago)
- Location:
- trunk/console/src
- Files:
-
- 6 modified
-
console.cpp (modified) (45 diffs)
-
console.h (modified) (5 diffs)
-
console_menu.cpp (modified) (28 diffs)
-
console_print.cpp (modified) (5 diffs)
-
event_data.h (modified) (10 diffs)
-
window.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/console/src/console.cpp
r3752 r3768 242 242 // Register with the daemon, we want to receive all signals 243 243 m_nPipe = _licqDaemon->RegisterPlugin(SIGNAL_ALL); 244 m_bExit = false; 244 m_bExit = false; 245 _licqDaemon->AddProtocolPlugins(); 245 246 licqDaemon = _licqDaemon; 246 247 m_nCurrentGroup = gUserManager.DefaultGroup(); … … 282 283 PrintUsers(); 283 284 284 if (gUserManager. OwnerUin() == 0)285 if (gUserManager.NumOwners() == 0) 285 286 { 286 287 RegistrationWizard(); … … 512 513 case SIGNAL_UPDATExUSER: 513 514 { 514 if ( s->Uin() == gUserManager.OwnerUin()&& s->SubSignal() == USER_STATUS515 if (gUserManager.FindOwner(s->Id(), s->PPID()) != NULL && s->SubSignal() == USER_STATUS 515 516 || s->SubSignal() == USER_EVENTS) 516 517 PrintStatus(); 517 ICQUser *u = gUserManager.FetchUser(s-> Uin(), LOCK_R);518 ICQUser *u = gUserManager.FetchUser(s->Id(), s->PPID(), LOCK_R); 518 519 if (u != NULL) 519 520 { … … 535 536 licqDaemon->icqRenameUser(s->Uin()); 536 537 break; 538 case SIGNAL_NEWxPROTO_PLUGIN: 539 //ignore for now 540 break; 541 case SIGNAL_EVENTxID: 542 AddEventTag(s->Id(), s->PPID(), s->Argument()); 543 break; 537 544 default: 538 545 gLog.Warn("%sInternal error: CLicqConsole::ProcessSignal(): Unknown signal command received from daemon: %ld.\n", … … 543 550 } 544 551 552 /*--------------------------------------------------------------------------- 553 * CLicqConsole::AddEventTag 554 *-------------------------------------------------------------------------*/ 555 void CLicqConsole::AddEventTag(char *_szId, unsigned long _nPPID, unsigned long _nEventTag) 556 { 557 if (!_szId || !_nPPID || !_nEventTag) 558 return; 559 560 CData *data; 561 unsigned short i; 562 for (i = 1; i <= MAX_CON; i++) 563 { 564 data = (CData *)winCon[i]->data; 565 if (strcmp(data->szId, _szId) == 0 && data->nPPID == _nPPID) 566 { 567 winCon[i]->event = _nEventTag; 568 break; 569 } 570 } 571 } 572 545 573 546 574 /*--------------------------------------------------------------------------- … … 556 584 } 557 585 586 if (e->SNAC() == 0) { 587 // Not from ICQ 588 ProcessDoneEvent(e); //FIXME 589 return; 590 } 591 558 592 switch (e->SNAC()) 559 593 { … … 699 733 if (win == NULL) 700 734 { 701 gLog.Warn("%sInternal error: CLicqConsole::Process Event(): Unknown event from daemon: %d.\n",735 gLog.Warn("%sInternal error: CLicqConsole::ProcessDoneEvent(): Unknown event from daemon: %d.\n", 702 736 L_WARNxSTR, e->SubCommand()); 703 737 return; … … 1424 1458 * CLicqConsole::UserCommand_Info 1425 1459 *-------------------------------------------------------------------------*/ 1426 void CLicqConsole::UserCommand_Info( unsigned long nUin, char *)1427 { 1428 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_R);1460 void CLicqConsole::UserCommand_Info(const char *szId, unsigned long nPPID, char *) 1461 { 1462 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 1429 1463 if (u == NULL) 1430 1464 return; … … 1433 1467 winMain->fProcessInput = &CLicqConsole::InputInfo; 1434 1468 winMain->state = STATE_QUERY; 1435 winMain->data = new CData( nUin);1469 winMain->data = new CData(szId, nPPID); 1436 1470 1437 1471 winMain->wprintf("%C%A" … … 1441 1475 "(A)bout Info\n" 1442 1476 "(U)pdate Info\n" 1443 "for %s (% ld)? %C%Z",1477 "for %s (%s)? %C%Z", 1444 1478 m_cColorQuery->nColor, m_cColorQuery->nAttr, 1445 u->GetAlias(), nUin, COLOR_WHITE, A_BOLD);1479 u->GetAlias(), szId, COLOR_WHITE, A_BOLD); 1446 1480 winMain->RefreshWin(); 1447 1481 gUserManager.DropUser(u); … … 1465 1499 { 1466 1500 case 'g': 1467 PrintInfo_General(data-> nUin);1501 PrintInfo_General(data->szId, data->nPPID); 1468 1502 break; 1469 1503 case 'm': 1470 PrintInfo_More(data-> nUin);1504 PrintInfo_More(data->szId, data->nPPID); 1471 1505 break; 1472 1506 case 'w': 1473 PrintInfo_Work(data-> nUin);1507 PrintInfo_Work(data->szId, data->nPPID); 1474 1508 break; 1475 1509 case 'a': 1476 PrintInfo_About(data-> nUin);1510 PrintInfo_About(data->szId, data->nPPID); 1477 1511 break; 1478 1512 case 'u': 1479 1513 winMain->wprintf("%C%AUpdate info...", m_cColorInfo->nColor, 1480 1514 m_cColorInfo->nAttr); 1481 winMain->event = licqDaemon->icqRequestMetaInfo(data-> nUin);1515 winMain->event = licqDaemon->icqRequestMetaInfo(data->szId); 1482 1516 winMain->state = STATE_PENDING; 1483 1517 return; … … 1511 1545 * CLicqConsole::UserCommand_View 1512 1546 *-------------------------------------------------------------------------*/ 1513 void CLicqConsole::UserCommand_View( unsigned long nUin, char *)1514 { 1515 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_W);1547 void CLicqConsole::UserCommand_View(const char *szId, unsigned long nPPID, char *) 1548 { 1549 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_W); 1516 1550 if (u == NULL) 1517 1551 return; … … 1543 1577 // Do we want to accept the file transfer? 1544 1578 if (e->SubCommand() == ICQ_CMDxSUB_FILE) 1545 FileChatOffer(e->Sequence(), u->Uin()); 1579 //FIXME 1580 //FileChatOffer(e->Sequence(), u->Uin()); 1546 1581 1547 1582 delete e; … … 1549 1584 //PrintUsers(); 1550 1585 //PrintStatus(); 1551 ProcessSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_EVENTS, nUin));1586 ProcessSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_EVENTS, szId, nPPID)); 1552 1587 } 1553 1588 else … … 1563 1598 * CLicqConsole::UserCommand_Remove 1564 1599 *-------------------------------------------------------------------------*/ 1565 void CLicqConsole::UserCommand_Remove( unsigned long nUin, char *)1566 { 1567 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_R);1600 void CLicqConsole::UserCommand_Remove(const char *szId, unsigned long nPPID, char *) 1601 { 1602 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 1568 1603 if (u == NULL) 1569 1604 return; … … 1572 1607 winMain->fProcessInput = &CLicqConsole::InputRemove; 1573 1608 winMain->state = STATE_QUERY; 1574 winMain->data = new CData( nUin);1575 1576 winMain->wprintf("%C%ARemove %s (% ld) from contact list (y/N)? %C%Z",1609 winMain->data = new CData(szId, nPPID); 1610 1611 winMain->wprintf("%C%ARemove %s (%s) from contact list (y/N)? %C%Z", 1577 1612 m_cColorQuery->nColor, m_cColorQuery->nAttr, 1578 u->GetAlias(), nUin, COLOR_WHITE, A_BOLD);1613 u->GetAlias(), szId, COLOR_WHITE, A_BOLD); 1579 1614 winMain->RefreshWin(); 1580 1615 gUserManager.DropUser(u); … … 1598 1633 if (strncasecmp(data->szQuery, "yes", strlen(data->szQuery)) == 0) 1599 1634 { 1600 licqDaemon->RemoveUserFromList(data-> nUin);1635 licqDaemon->RemoveUserFromList(data->szId, data->nPPID); 1601 1636 winMain->wprintf("%C%AUser removed.\n", m_cColorInfo->nColor, 1602 1637 m_cColorInfo->nAttr); … … 1627 1662 * CLicqConsole::UserCommand_FetchAutoResponse 1628 1663 *-------------------------------------------------------------------------*/ 1629 void CLicqConsole::UserCommand_FetchAutoResponse( unsigned long nUin, char *)1630 { 1631 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_R);1632 winMain->wprintf("%C%AFetching auto-response for %s (% ld)...",1664 void CLicqConsole::UserCommand_FetchAutoResponse(const char *szId, unsigned long nPPID, char *) 1665 { 1666 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 1667 winMain->wprintf("%C%AFetching auto-response for %s (%s)...", 1633 1668 m_cColorInfo->nColor, m_cColorInfo->nAttr, 1634 u->GetAlias(), nUin);1669 u->GetAlias(), szId); 1635 1670 winMain->RefreshWin(); 1636 1671 gUserManager.DropUser(u); 1637 1672 1638 winMain->event = licqDaemon->icqFetchAutoResponse( nUin);1673 winMain->event = licqDaemon->icqFetchAutoResponse(szId, nPPID); 1639 1674 // InputMessage just to catch the cancel key 1640 1675 winMain->fProcessInput = &CLicqConsole::InputMessage; … … 1695 1730 * CLicqConsole::UserCommand_History 1696 1731 *-------------------------------------------------------------------------*/ 1697 void CLicqConsole::UserCommand_History(unsigned long nUin, char *szArg) 1698 { 1699 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R); 1732 void CLicqConsole::UserCommand_History(const char *szId, unsigned long nPPID, char *szArg) 1733 { 1734 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 1735 if (u == NULL) 1736 return; 1700 1737 HistoryList lHistory; 1701 1738 if (!u->GetHistory(lHistory)) … … 1706 1743 } 1707 1744 char szFrom[32]; 1708 if (gUserManager.OwnerUin() == nUin) 1709 strcpy(szFrom, "Server"); 1710 else 1745 //TODO: FIX THIS: 1746 //if (gUserManager.OwnerUin() == nUin) 1747 // strcpy(szFrom, "Server"); 1748 //else 1711 1749 strcpy(szFrom, u->GetAlias()); 1712 1750 gUserManager.DropUser(u); … … 1781 1819 * CLicqConsole::UserCommand_Msg 1782 1820 *-------------------------------------------------------------------------*/ 1783 void CLicqConsole::UserCommand_Msg( unsigned long nUin, char *)1784 { 1785 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_R);1821 void CLicqConsole::UserCommand_Msg(const char *szId, unsigned long nPPID, char *) 1822 { 1823 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 1786 1824 if (u == NULL) 1787 1825 return; … … 1790 1828 winMain->fProcessInput = &CLicqConsole::InputMessage; 1791 1829 winMain->state = STATE_MLE; 1792 winMain->data = new DataMsg( nUin);1793 1794 winMain->wprintf("%BEnter message to %b%s%B (%b% ld%B):\n", u->GetAlias(),1795 nUin);1830 winMain->data = new DataMsg(szId, nPPID); 1831 1832 winMain->wprintf("%BEnter message to %b%s%B (%b%s%B):\n", u->GetAlias(), 1833 szId); 1796 1834 winMain->RefreshWin(); 1797 1835 gUserManager.DropUser(u); … … 1802 1840 * SendDirect 1803 1841 *-------------------------------------------------------------------------*/ 1804 static bool SendDirect( unsigned long nUin, char c)1842 static bool SendDirect(const char *szId, unsigned long nPPID, char c) 1805 1843 { 1806 1844 bool bDirect = (c != 's'); 1807 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_R);1845 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 1808 1846 if (u != NULL) 1809 1847 { … … 1861 1899 *sz = '\0'; 1862 1900 sz++; 1863 bool bDirect = SendDirect(data-> nUin, *sz);1901 bool bDirect = SendDirect(data->szId, data->nPPID, *sz); 1864 1902 winMain->wprintf("%C%ASending message %s...", m_cColorInfo->nColor, 1865 1903 m_cColorInfo->nAttr, 1866 1904 !bDirect ? "through the server" : "direct"); 1867 winMain->event = licqDaemon-> icqSendMessage(data->nUin, data->szMsg,1905 winMain->event = licqDaemon->ProtoSendMessage(data->szId, data->nPPID, data->szMsg, 1868 1906 bDirect, *sz == 'u'); 1869 1907 winMain->state = STATE_PENDING; … … 1880 1918 winMain->wprintf("%C%ASending message through the server...", 1881 1919 m_cColorInfo->nColor, m_cColorInfo->nAttr); 1882 winMain->event = licqDaemon-> icqSendMessage(data->nUin, data->szMsg,1920 winMain->event = licqDaemon->ProtoSendMessage(data->szId, data->nPPID, data->szMsg, 1883 1921 false, false); 1884 1922 winMain->state = STATE_PENDING; … … 1902 1940 * CLicqConsole::UserCommand_SendFile 1903 1941 *-------------------------------------------------------------------------*/ 1904 void CLicqConsole::UserCommand_SendFile( unsigned long nUin, char *)1942 void CLicqConsole::UserCommand_SendFile(const char *szId, unsigned long nPPID, char *) 1905 1943 { 1906 1944 // Get the file name 1907 1945 winMain->fProcessInput = &CLicqConsole::InputSendFile; 1908 1946 winMain->state = STATE_LE; 1909 winMain->data = new DataSendFile( nUin);1910 1911 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_R);1912 winMain->wprintf("%BEnter file to send to %b%s%B (%b% ld%B):\n",1913 u->GetAlias(), nUin);1947 winMain->data = new DataSendFile(szId, nPPID); 1948 1949 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 1950 winMain->wprintf("%BEnter file to send to %b%s%B (%b%s%B):\n", 1951 u->GetAlias(), szId); 1914 1952 winMain->RefreshWin(); 1915 1953 gUserManager.DropUser(u); … … 1990 2028 *sz = '\0'; 1991 2029 sz++; 1992 bool bDirect = SendDirect(data-> nUin, *sz);2030 bool bDirect = SendDirect(data->szId, data->nPPID, *sz); 1993 2031 bDirect = true; // XXX hack 1994 2032 winMain->wprintf("%C%ASending File %s...", … … 1999 2037 lFileList.push_back(strdup(data->szFileName)); 2000 2038 2001 winMain->event = licqDaemon->icqFileTransfer( data->nUin, data->szFileName,2002 data->szDescription, lFileList, ICQ_TCPxMSG_NORMAL,2039 winMain->event = licqDaemon->icqFileTransfer(strtoul(data->szId, (char **)NULL, 10), 2040 data->szFileName, data->szDescription, lFileList, ICQ_TCPxMSG_NORMAL, 2003 2041 !bDirect); 2004 2042 break; … … 2014 2052 * CLicqConsole::UserCommand_SetAutoResponse 2015 2053 *-------------------------------------------------------------------------*/ 2016 void CLicqConsole::UserCommand_SetAutoResponse( unsigned long nUin, char *)2054 void CLicqConsole::UserCommand_SetAutoResponse(const char *szId, unsigned long nPPID, char *) 2017 2055 { 2018 2056 // First put this console into edit mode … … 2072 2110 * CLicqConsole::UserCommand_Url 2073 2111 *-------------------------------------------------------------------------*/ 2074 void CLicqConsole::UserCommand_Url( unsigned long nUin, char *)2112 void CLicqConsole::UserCommand_Url(const char *szId, unsigned long nPPID, char *) 2075 2113 { 2076 2114 // First put this console into edit mode 2077 2115 winMain->fProcessInput = &CLicqConsole::InputUrl; 2078 2116 winMain->state = STATE_LE; 2079 winMain->data = new DataUrl( nUin);2080 2081 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_R);2117 winMain->data = new DataUrl(szId, nPPID); 2118 2119 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 2082 2120 winMain->wprintf("%BEnter URL to %b%s%B (%b%ld%B): ", 2083 u->GetAlias(), nUin);2121 u->GetAlias(), szId); 2084 2122 winMain->RefreshWin(); 2085 2123 gUserManager.DropUser(u); … … 2136 2174 *sz = '\0'; 2137 2175 sz++; 2138 bool bDirect = SendDirect(data-> nUin, *sz);2176 bool bDirect = SendDirect(data->szId, data->nPPID, *sz); 2139 2177 winMain->wprintf("%C%ASending URL %s...", 2140 2178 m_cColorInfo->nColor, m_cColorInfo->nAttr, 2141 2179 !bDirect ? "through the server" : "direct"); 2142 winMain->event = licqDaemon-> icqSendUrl(data->nUin, data->szUrl,2180 winMain->event = licqDaemon->ProtoSendUrl(data->szId, data->nPPID, data->szUrl, 2143 2181 data->szDesc, 2144 2182 bDirect, *sz == 'u'); … … 2156 2194 winMain->wprintf("%C%ASending URL through the server...", 2157 2195 m_cColorInfo->nColor, m_cColorInfo->nAttr); 2158 winMain->event = licqDaemon-> icqSendUrl(data->nUin, data->szUrl,2196 winMain->event = licqDaemon->ProtoSendUrl(data->szId, data->nPPID, data->szUrl, 2159 2197 data->szDesc, false, false); 2160 2198 winMain->state = STATE_PENDING; … … 2178 2216 * CLicqConsole::UserCommand_Sms 2179 2217 *-------------------------------------------------------------------------*/ 2180 void CLicqConsole::UserCommand_Sms( unsigned long nUin, char *)2181 { 2182 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_R);2218 void CLicqConsole::UserCommand_Sms(const char *szId, unsigned long nPPID, char *) 2219 { 2220 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 2183 2221 if (u == NULL) 2184 2222 return; … … 2187 2225 winMain->fProcessInput = &CLicqConsole::InputSms; 2188 2226 winMain->state = STATE_MLE; 2189 winMain->data = new DataSms( nUin);2227 winMain->data = new DataSms(szId, nPPID); 2190 2228 winMain->wprintf("%BEnter SMS to %b%s%B (%b%s%B):\n", u->GetAlias(), 2191 2229 u->GetCellularNumber()); … … 2232 2270 *sz = '\0'; 2233 2271 sz++; 2234 ICQUser *u = gUserManager.FetchUser(data-> nUin, LOCK_R);2272 ICQUser *u = gUserManager.FetchUser(data->szId, data->nPPID, LOCK_R); 2235 2273 winMain->wprintf("%C%ASending SMS to %s ...", m_cColorInfo->nColor, 2236 2274 m_cColorInfo->nAttr, u->GetCellularNumber()); 2237 2275 winMain->event = licqDaemon->icqSendSms(u->GetCellularNumber(), 2238 data->szMsg, data->nUin);2276 data->szMsg, strtoul(data->szId, (char **)NULL, 0)); 2239 2277 gUserManager.DropUser(u); 2240 2278 winMain->state = STATE_PENDING; … … 2283 2321 if (data->bUrgent) 2284 2322 { 2285 winMain->wprintf("%C%AGranting authorizing to % lu...", m_cColorInfo->nColor,2286 m_cColorInfo->nAttr, data-> nUin);2287 winMain->event = licqDaemon->icqAuthorizeGrant( data->nUin, data->szMsg);2323 winMain->wprintf("%C%AGranting authorizing to %s...", m_cColorInfo->nColor, 2324 m_cColorInfo->nAttr, data->szId); 2325 winMain->event = licqDaemon->icqAuthorizeGrant(strtoul(data->szId, (char **)NULL, 10), data->szMsg); 2288 2326 } 2289 2327 else 2290 2328 { 2291 winMain->wprintf("%C%ARefusing authorizing to % lu...", m_cColorInfo->nColor,2292 m_cColorInfo->nAttr, data-> nUin);2293 winMain->event = licqDaemon->icqAuthorizeRefuse( data->nUin, data->szMsg);2329 winMain->wprintf("%C%ARefusing authorizing to %s...", m_cColorInfo->nColor, 2330 m_cColorInfo->nAttr, data->szId); 2331 winMain->event = licqDaemon->icqAuthorizeRefuse(strtoul(data->szId, (char **)NULL, 10), data->szMsg); 2294 2332 } 2295 2333 … … 2491 2529 data->nPos = 0; 2492 2530 2493 data-> nUin = atol(sz);2494 2495 if (data-> nUin!= 0)2531 data->szId = sz; 2532 2533 if (data->szId != 0) 2496 2534 { 2497 2535 winMain->wprintf("%C%ASearching:\n", 2498 2536 m_cColorInfo->nColor, m_cColorInfo->nAttr); 2499 2537 2500 winMain->event = licqDaemon->icqSearchByUin( data->nUin);2538 winMain->event = licqDaemon->icqSearchByUin(strtoul(data->szId, (char **)NULL, 10)); 2501 2539 winMain->state = STATE_PENDING; 2502 2540 … … 2981 3019 * CLicqConsole::FileChatOffer 2982 3020 *-------------------------------------------------------------------------*/ 2983 void CLicqConsole::FileChatOffer(unsigned long _nSequence, unsigned long _nUin)3021 void CLicqConsole::FileChatOffer(unsigned long _nSequence, const char *_szId, unsigned long _nPPID) 2984 3022 { 2985 3023 // Get y or n 2986 3024 winMain->fProcessInput = &CLicqConsole::InputFileChatOffer; 2987 3025 winMain->state = STATE_QUERY; 2988 winMain->data = new DataFileChatOffer(_nSequence, _ nUin);3026 winMain->data = new DataFileChatOffer(_nSequence, _szId, _nPPID); 2989 3027 winMain->wprintf("%C%ADo you wish to accept this request? (y/N) %C%Z", 2990 3028 m_cColorQuery->nColor, m_cColorQuery->nAttr, COLOR_WHITE, A_BOLD); … … 3014 3052 // Make the ftman 3015 3053 CFileTransferManager *ftman = new CFileTransferManager(licqDaemon, 3016 data->nUin);3054 strtoul(data->szId, (char **)NULL, 10)); 3017 3055 ftman->SetUpdatesEnabled(1); 3018 3056 m_lFileStat.push_back(ftman); … … 3023 3061 // XXX hack 3024 3062 unsigned long dummy[2] = { 0, 0}; 3025 licqDaemon->icqFileTransferAccept( data->nUin, ftman->LocalPort(),3063 licqDaemon->icqFileTransferAccept(strtoul(data->szId, (char **)NULL, 10), ftman->LocalPort(), 3026 3064 data->nSequence, dummy, true); 3027 3065 winMain->fProcessInput = &CLicqConsole::InputCommand; … … 3055 3093 // XXX hack 3056 3094 unsigned long dummy[2] = { 0, 0 }; 3057 licqDaemon->icqFileTransferRefuse( data->nUin, data->szReason,3095 licqDaemon->icqFileTransferRefuse(strtoul(data->szId, (char **)NULL, 10), data->szReason, 3058 3096 data->nSequence, dummy, true); 3059 3097 3060 3098 // We are done now 3061 winMain->wprintf("%ARefusing file from % ldwith reason: %Z%s\n",3062 A_BOLD, data-> nUin, A_BOLD, data->szReason);3099 winMain->wprintf("%ARefusing file from %s with reason: %Z%s\n", 3100 A_BOLD, data->szId, A_BOLD, data->szReason); 3063 3101 winMain->fProcessInput = &CLicqConsole::InputCommand; 3064 3102 … … 3077 3115 * CLicqConsole::UserCommand_Secure 3078 3116 *-----------------------------------------------------------------------*/ 3079 void CLicqConsole::UserCommand_Secure( unsigned long nUin, char *szStatus)3080 { 3081 ICQUser *u = gUserManager.FetchUser( nUin, LOCK_R);3117 void CLicqConsole::UserCommand_Secure(const char *szId, unsigned long nPPID, char *szStatus) 3118 { 3119 ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 3082 3120 3083 3121 if(!licqDaemon->CryptoEnabled()) … … 3116 3154 u->GetAlias()); 3117 3155 gUserManager.DropUser(u); 3118 winMain->event = licqDaemon->icqOpenSecureChannel(nUin); 3156 char *p; 3157 unsigned long uin = strtoul(szId, &p,10); 3158 if( (p == 0 || (p && !*p)) && nPPID == LICQ_PPID ) 3159 winMain->event = licqDaemon->icqOpenSecureChannel(uin); 3119 3160 } 3120 3161 else if(strcasecmp(szStatus, "close") == 0) … … 3123 3164 u->GetAlias()); 3124 3165 gUserManager.DropUser(u); 3125 winMain->event = licqDaemon->icqCloseSecureChannel(nUin); 3166 char *p; 3167 unsigned long uin = strtoul(szId, &p,10); 3168 if( (p == 0 || (p && !*p)) && nPPID == LICQ_PPID ) 3169 winMain->event = licqDaemon->icqCloseSecureChannel(uin); 3126 3170 } 3127 3171 else … … 3142 3186 winMain->fProcessInput = &CLicqConsole::InputUserSelect; 3143 3187 winMain->state = STATE_LE; 3144 winMain->data = new DataUserSelect(gUserManager.OwnerUin()); 3188 3189 char sz[20]; 3190 //TODO which owner 3191 sprintf(sz, "%lu", gUserManager.OwnerUin()); 3192 3193 winMain->data = new DataUserSelect(sz, LICQ_PPID); 3145 3194 3146 3195 ICQOwner *o = gUserManager.FetchOwner(LOCK_R); -
trunk/console/src/console.h
r3556 r3768 30 30 { 31 31 char szKey[32]; 32 unsigned long nUin; 32 char szId[32]; 33 unsigned long nPPID; 33 34 char *szLine; 34 35 bool bOffline; 35 36 const struct SColorMap *color; 37 }; 38 39 struct SContact 40 { 41 char *szId; 42 unsigned long nPPID; 36 43 }; 37 44 … … 96 103 void SwitchToCon(unsigned short nCon); 97 104 void CreateUserList(); 105 void AddEventTag(char *, unsigned long, unsigned long); 98 106 99 107 void InputCommand(int cIn); … … 124 132 void PrintHelp(); 125 133 void PrintHistory(HistoryList &, unsigned short, unsigned short, const char *); 126 void PrintInfo_General( unsigned long);127 void PrintInfo_More( unsigned long);128 void PrintInfo_Work( unsigned long);129 void PrintInfo_About( unsigned long);134 void PrintInfo_General(const char *, unsigned long); 135 void PrintInfo_More(const char *, unsigned long); 136 void PrintInfo_Work(const char *, unsigned long);
