Updated
Philip Nelson wrote:
This patch gets the console plugin working with multiple protocols.
At the moment only sending/receiving messages is supported with msn
(can't add users yet), and changing status changes to the same status
for all protocols (can anyone think of a nice way of changing status
for different protocols? I don't really see the point, because if
you're away, you're away, but I think some people like to have
different status's?).
Another (similar) problem is messaging users with the same alias, I
haven't figured out how that's best dealt with - perhaps give a list
of users to select from. Ideas?
Needs testing!
? console.diff
Index: console.cpp
===================================================================
RCS file: /cvsroot/licq/console/src/console.cpp,v
retrieving revision 1.85
diff -u -r1.85 console.cpp
--- console.cpp 3 Jun 2004 05:35:16 -0000 1.85
+++ console.cpp 10 Jun 2004 13:13:13 -0000
@@ -241,7 +241,8 @@
{
// Register with the daemon, we want to receive all signals
m_nPipe = _licqDaemon->RegisterPlugin(SIGNAL_ALL);
- m_bExit = false;
+ m_bExit = false;
+ _licqDaemon->AddProtocolPlugins();
licqDaemon = _licqDaemon;
m_nCurrentGroup = gUserManager.DefaultGroup();
@@ -511,10 +512,10 @@
break;
case SIGNAL_UPDATExUSER:
{
- if (s->Uin() == gUserManager.OwnerUin() && s->SubSignal() == USER_STATUS
+ if (gUserManager.FindOwner(s->Id(), s->PPID()) != NULL && s->SubSignal() ==
USER_STATUS
|| s->SubSignal() == USER_EVENTS)
PrintStatus();
- ICQUser *u = gUserManager.FetchUser(s->Uin(), LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(s->Id(), s->PPID(), LOCK_R);
if (u != NULL)
{
if (u->GetInGroup(m_nGroupType, m_nCurrentGroup))
@@ -534,6 +535,12 @@
case SIGNAL_ADDxSERVERxLIST:
licqDaemon->icqRenameUser(s->Uin());
break;
+ case SIGNAL_NEWxPROTO_PLUGIN:
+ //ignore for now
+ break;
+ case SIGNAL_EVENTxID:
+ AddEventTag(s->Id(), s->PPID(), s->Argument());
+ break;
default:
gLog.Warn("%sInternal error: CLicqConsole::ProcessSignal(): Unknown signal
command received from daemon: %ld.\n",
L_WARNxSTR, s->Signal());
@@ -542,6 +549,27 @@
delete s;
}
+/*---------------------------------------------------------------------------
+ * CLicqConsole::AddEventTag
+ *-------------------------------------------------------------------------*/
+void CLicqConsole::AddEventTag(char *_szId, unsigned long _nPPID, unsigned long
_nEventTag)
+{
+ if (!_szId || !_nPPID || !_nEventTag)
+ return;
+
+ CData *data;
+ unsigned short i;
+ for (i = 1; i <= MAX_CON; i++)
+ {
+ data = (CData *)winCon[i]->data;
+ if (strcmp(data->szId, _szId) == 0 && data->nPPID == _nPPID)
+ {
+ winCon[i]->event = _nEventTag;
+ break;
+ }
+ }
+}
+
/*---------------------------------------------------------------------------
* CLicqConsole::ProcessEvent
@@ -555,6 +583,12 @@
return;
}
+ if (e->SNAC() == 0) {
+ // Not from ICQ
+ ProcessDoneEvent(e); //FIXME
+ return;
+ }
+
switch (e->SNAC())
{
// Event commands for a user
@@ -698,7 +732,7 @@
}
if (win == NULL)
{
- gLog.Warn("%sInternal error: CLicqConsole::ProcessEvent(): Unknown event from
daemon: %d.\n",
+ gLog.Warn("%sInternal error: CLicqConsole::ProcessDoneEvent(): Unknown event from
daemon: %d.\n",
L_WARNxSTR, e->SubCommand());
return;
}
@@ -1423,16 +1457,16 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_Info
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_Info(unsigned long nUin, char *)
+void CLicqConsole::UserCommand_Info(const char *szId, unsigned long nPPID, char *)
{
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if (u == NULL)
return;
// First put this console into edit mode
winMain->fProcessInput = &CLicqConsole::InputInfo;
winMain->state = STATE_QUERY;
- winMain->data = new CData(nUin);
+ winMain->data = new CData(szId, nPPID);
winMain->wprintf("%C%A"
"(G)eneral Info\n"
@@ -1440,9 +1474,9 @@
"(W)ork Info\n"
"(A)bout Info\n"
"(U)pdate Info\n"
- "for %s (%ld)? %C%Z",
+ "for %s (%s)? %C%Z",
m_cColorQuery->nColor, m_cColorQuery->nAttr,
- u->GetAlias(), nUin, COLOR_WHITE, A_BOLD);
+ u->GetAlias(), szId, COLOR_WHITE, A_BOLD);
winMain->RefreshWin();
gUserManager.DropUser(u);
}
@@ -1464,21 +1498,21 @@
switch(tolower(cIn))
{
case 'g':
- PrintInfo_General(data->nUin);
+ PrintInfo_General(data->szId, data->nPPID);
break;
case 'm':
- PrintInfo_More(data->nUin);
+ PrintInfo_More(data->szId, data->nPPID);
break;
case 'w':
- PrintInfo_Work(data->nUin);
+ PrintInfo_Work(data->szId, data->nPPID);
break;
case 'a':
- PrintInfo_About(data->nUin);
+ PrintInfo_About(data->szId, data->nPPID);
break;
case 'u':
winMain->wprintf("%C%AUpdate info...", m_cColorInfo->nColor,
m_cColorInfo->nAttr);
- winMain->event = licqDaemon->icqRequestMetaInfo(data->nUin);
+ winMain->event = licqDaemon->icqRequestMetaInfo(data->szId);
winMain->state = STATE_PENDING;
return;
case '\r':
@@ -1510,9 +1544,9 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_View
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_View(unsigned long nUin, char *)
+void CLicqConsole::UserCommand_View(const char *szId, unsigned long nPPID, char *)
{
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_W);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_W);
if (u == NULL)
return;
@@ -1542,13 +1576,14 @@
// Do we want to accept the file transfer?
if (e->SubCommand() == ICQ_CMDxSUB_FILE)
- FileChatOffer(e->Sequence(), u->Uin());
+ //FIXME
+ //FileChatOffer(e->Sequence(), u->Uin());
delete e;
gUserManager.DropUser(u);
//PrintUsers();
//PrintStatus();
- ProcessSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_EVENTS, nUin));
+ ProcessSignal(new CICQSignal(SIGNAL_UPDATExUSER, USER_EVENTS, szId, nPPID));
}
else
{
@@ -1562,20 +1597,20 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_Remove
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_Remove(unsigned long nUin, char *)
+void CLicqConsole::UserCommand_Remove(const char *szId, unsigned long nPPID, char *)
{
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if (u == NULL)
return;
// First put this console into edit mode
winMain->fProcessInput = &CLicqConsole::InputRemove;
winMain->state = STATE_QUERY;
- winMain->data = new CData(nUin);
+ winMain->data = new CData(szId, nPPID);
- winMain->wprintf("%C%ARemove %s (%ld) from contact list (y/N)? %C%Z",
+ winMain->wprintf("%C%ARemove %s (%s) from contact list (y/N)? %C%Z",
m_cColorQuery->nColor, m_cColorQuery->nAttr,
- u->GetAlias(), nUin, COLOR_WHITE, A_BOLD);
+ u->GetAlias(), szId, COLOR_WHITE, A_BOLD);
winMain->RefreshWin();
gUserManager.DropUser(u);
}
@@ -1597,7 +1632,7 @@
// The input is done
if (strncasecmp(data->szQuery, "yes", strlen(data->szQuery)) == 0)
{
- licqDaemon->RemoveUserFromList(data->nUin);
+ licqDaemon->RemoveUserFromList(data->szId, data->nPPID);
winMain->wprintf("%C%AUser removed.\n", m_cColorInfo->nColor,
m_cColorInfo->nAttr);
}
@@ -1626,16 +1661,16 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_FetchAutoResponse
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_FetchAutoResponse(unsigned long nUin, char *)
+void CLicqConsole::UserCommand_FetchAutoResponse(const char *szId, unsigned long
nPPID, char *)
{
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
- winMain->wprintf("%C%AFetching auto-response for %s (%ld)...",
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
+ winMain->wprintf("%C%AFetching auto-response for %s (%s)...",
m_cColorInfo->nColor, m_cColorInfo->nAttr,
- u->GetAlias(), nUin);
+ u->GetAlias(), szId);
winMain->RefreshWin();
gUserManager.DropUser(u);
- winMain->event = licqDaemon->icqFetchAutoResponse(nUin);
+ winMain->event = licqDaemon->icqFetchAutoResponse(szId, nPPID);
// InputMessage just to catch the cancel key
winMain->fProcessInput = &CLicqConsole::InputMessage;
winMain->data = NULL;
@@ -1694,9 +1729,11 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_History
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_History(unsigned long nUin, char *szArg)
+void CLicqConsole::UserCommand_History(const char *szId, unsigned long nPPID, char
*szArg)
{
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
+ if (u == NULL)
+ return;
HistoryList lHistory;
if (!u->GetHistory(lHistory))
{
@@ -1705,9 +1742,10 @@
return;
}
char szFrom[32];
- if (gUserManager.OwnerUin() == nUin)
- strcpy(szFrom, "Server");
- else
+ //TODO: FIX THIS:
+ //if (gUserManager.OwnerUin() == nUin)
+ // strcpy(szFrom, "Server");
+ //else
strcpy(szFrom, u->GetAlias());
gUserManager.DropUser(u);
@@ -1780,19 +1818,19 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_Msg
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_Msg(unsigned long nUin, char *)
+void CLicqConsole::UserCommand_Msg(const char *szId, unsigned long nPPID, char *)
{
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if (u == NULL)
return;
// First put this console into edit mode
winMain->fProcessInput = &CLicqConsole::InputMessage;
winMain->state = STATE_MLE;
- winMain->data = new DataMsg(nUin);
+ winMain->data = new DataMsg(szId, nPPID);
- winMain->wprintf("%BEnter message to %b%s%B (%b%ld%B):\n", u->GetAlias(),
- nUin);
+ winMain->wprintf("%BEnter message to %b%s%B (%b%s%B):\n", u->GetAlias(),
+ szId);
winMain->RefreshWin();
gUserManager.DropUser(u);
}
@@ -1801,10 +1839,10 @@
/*---------------------------------------------------------------------------
* SendDirect
*-------------------------------------------------------------------------*/
-static bool SendDirect(unsigned long nUin, char c)
+static bool SendDirect(const char *szId, unsigned long nPPID, char c)
{
bool bDirect = (c != 's');
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if (u != NULL)
{
if (u->SocketDesc(ICQ_CHNxNONE) == -1 &&
@@ -1860,11 +1898,11 @@
}
*sz = '\0';
sz++;
- bool bDirect = SendDirect(data->nUin, *sz);
+ bool bDirect = SendDirect(data->szId, data->nPPID, *sz);
winMain->wprintf("%C%ASending message %s...", m_cColorInfo->nColor,
m_cColorInfo->nAttr,
!bDirect ? "through the server" : "direct");
- winMain->event = licqDaemon->icqSendMessage(data->nUin, data->szMsg,
+ winMain->event = licqDaemon->ProtoSendMessage(data->szId, data->nPPID,
data->szMsg,
bDirect, *sz == 'u');
winMain->state = STATE_PENDING;
break;
@@ -1879,7 +1917,7 @@
{
winMain->wprintf("%C%ASending message through the server...",
m_cColorInfo->nColor, m_cColorInfo->nAttr);
- winMain->event = licqDaemon->icqSendMessage(data->nUin, data->szMsg,
+ winMain->event = licqDaemon->ProtoSendMessage(data->szId, data->nPPID,
data->szMsg,
false, false);
winMain->state = STATE_PENDING;
}
@@ -1901,16 +1939,16 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_SendFile
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_SendFile(unsigned long nUin, char *)
+void CLicqConsole::UserCommand_SendFile(const char *szId, unsigned long nPPID, char *)
{
// Get the file name
winMain->fProcessInput = &CLicqConsole::InputSendFile;
winMain->state = STATE_LE;
- winMain->data = new DataSendFile(nUin);
+ winMain->data = new DataSendFile(szId, nPPID);
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
- winMain->wprintf("%BEnter file to send to %b%s%B (%b%ld%B):\n",
- u->GetAlias(), nUin);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
+ winMain->wprintf("%BEnter file to send to %b%s%B (%b%s%B):\n",
+ u->GetAlias(), szId);
winMain->RefreshWin();
gUserManager.DropUser(u);
}
@@ -1989,7 +2027,7 @@
*sz = '\0';
sz++;
- bool bDirect = SendDirect(data->nUin, *sz);
+ bool bDirect = SendDirect(data->szId, data->nPPID, *sz);
bDirect = true; // XXX hack
winMain->wprintf("%C%ASending File %s...",
m_cColorInfo->nColor, m_cColorInfo->nAttr,
@@ -1998,8 +2036,8 @@
ConstFileList lFileList;
lFileList.push_back(strdup(data->szFileName));
- winMain->event = licqDaemon->icqFileTransfer(data->nUin, data->szFileName,
- data->szDescription, lFileList, ICQ_TCPxMSG_NORMAL,
+ winMain->event = licqDaemon->icqFileTransfer(strtoul(data->szId, (char **)NULL,
10),
+ data->szFileName, data->szDescription, lFileList,
ICQ_TCPxMSG_NORMAL,
!bDirect);
break;
}
@@ -2013,7 +2051,7 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_SetAutoResponse
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_SetAutoResponse(unsigned long nUin, char *)
+void CLicqConsole::UserCommand_SetAutoResponse(const char *szId, unsigned long nPPID,
char *)
{
// First put this console into edit mode
winMain->fProcessInput = &CLicqConsole::InputAutoResponse;
@@ -2071,16 +2109,16 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_Url
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_Url(unsigned long nUin, char *)
+void CLicqConsole::UserCommand_Url(const char *szId, unsigned long nPPID, char *)
{
// First put this console into edit mode
winMain->fProcessInput = &CLicqConsole::InputUrl;
winMain->state = STATE_LE;
- winMain->data = new DataUrl(nUin);
+ winMain->data = new DataUrl(szId, nPPID);
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
winMain->wprintf("%BEnter URL to %b%s%B (%b%ld%B): ",
- u->GetAlias(), nUin);
+ u->GetAlias(), szId);
winMain->RefreshWin();
gUserManager.DropUser(u);
}
@@ -2135,11 +2173,11 @@
}
*sz = '\0';
sz++;
- bool bDirect = SendDirect(data->nUin, *sz);
+ bool bDirect = SendDirect(data->szId, data->nPPID, *sz);
winMain->wprintf("%C%ASending URL %s...",
m_cColorInfo->nColor, m_cColorInfo->nAttr,
!bDirect ? "through the server" : "direct");
- winMain->event = licqDaemon->icqSendUrl(data->nUin, data->szUrl,
+ winMain->event = licqDaemon->ProtoSendUrl(data->szId, data->nPPID, data->szUrl,
data->szDesc,
bDirect, *sz == 'u');
winMain->state = STATE_PENDING;
@@ -2155,7 +2193,7 @@
{
winMain->wprintf("%C%ASending URL through the server...",
m_cColorInfo->nColor, m_cColorInfo->nAttr);
- winMain->event = licqDaemon->icqSendUrl(data->nUin, data->szUrl,
+ winMain->event = licqDaemon->ProtoSendUrl(data->szId, data->nPPID, data->szUrl,
data->szDesc, false, false);
winMain->state = STATE_PENDING;
}
@@ -2177,16 +2215,16 @@
/*---------------------------------------------------------------------------
* CLicqConsole::UserCommand_Sms
*-------------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_Sms(unsigned long nUin, char *)
+void CLicqConsole::UserCommand_Sms(const char *szId, unsigned long nPPID, char *)
{
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if (u == NULL)
return;
// First put this console into edit mode
winMain->fProcessInput = &CLicqConsole::InputSms;
winMain->state = STATE_MLE;
- winMain->data = new DataSms(nUin);
+ winMain->data = new DataSms(szId, nPPID);
winMain->wprintf("%BEnter SMS to %b%s%B (%b%s%B):\n", u->GetAlias(),
u->GetCellularNumber());
winMain->RefreshWin();
@@ -2231,11 +2269,11 @@
}
*sz = '\0';
sz++;
- ICQUser *u = gUserManager.FetchUser(data->nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(data->szId, data->nPPID, LOCK_R);
winMain->wprintf("%C%ASending SMS to %s ...", m_cColorInfo->nColor,
m_cColorInfo->nAttr, u->GetCellularNumber());
winMain->event = licqDaemon->icqSendSms(u->GetCellularNumber(),
- data->szMsg, data->nUin);
+ data->szMsg, strtoul(data->szId, (char **)NULL, 0));
gUserManager.DropUser(u);
winMain->state = STATE_PENDING;
break;
@@ -2282,15 +2320,15 @@
*sz = '\0';
if (data->bUrgent)
{
- winMain->wprintf("%C%AGranting authorizing to %lu...", m_cColorInfo->nColor,
- m_cColorInfo->nAttr, data->nUin);
- winMain->event = licqDaemon->icqAuthorizeGrant(data->nUin, data->szMsg);
+ winMain->wprintf("%C%AGranting authorizing to %s...", m_cColorInfo->nColor,
+ m_cColorInfo->nAttr, data->szId);
+ winMain->event = licqDaemon->icqAuthorizeGrant(strtoul(data->szId, (char
**)NULL, 10), data->szMsg);
}
else
{
- winMain->wprintf("%C%ARefusing authorizing to %lu...", m_cColorInfo->nColor,
- m_cColorInfo->nAttr, data->nUin);
- winMain->event = licqDaemon->icqAuthorizeRefuse(data->nUin, data->szMsg);
+ winMain->wprintf("%C%ARefusing authorizing to %s...", m_cColorInfo->nColor,
+ m_cColorInfo->nAttr, data->szId);
+ winMain->event = licqDaemon->icqAuthorizeRefuse(strtoul(data->szId, (char
**)NULL, 10), data->szMsg);
}
winMain->fProcessInput = &CLicqConsole::InputCommand;
@@ -2490,14 +2528,14 @@
// Back to 0 for you!
data->nPos = 0;
- data->nUin = atol(sz);
+ data->szId = sz;
- if (data->nUin != 0)
+ if (data->szId != 0)
{
winMain->wprintf("%C%ASearching:\n",
m_cColorInfo->nColor, m_cColorInfo->nAttr);
- winMain->event = licqDaemon->icqSearchByUin(data->nUin);
+ winMain->event = licqDaemon->icqSearchByUin(strtoul(data->szId, (char
**)NULL, 10));
winMain->state = STATE_PENDING;
return;
@@ -2980,12 +3018,12 @@
/*---------------------------------------------------------------------------
* CLicqConsole::FileChatOffer
*-------------------------------------------------------------------------*/
-void CLicqConsole::FileChatOffer(unsigned long _nSequence, unsigned long _nUin)
+void CLicqConsole::FileChatOffer(unsigned long _nSequence, const char *_szId,
unsigned long _nPPID)
{
// Get y or n
winMain->fProcessInput = &CLicqConsole::InputFileChatOffer;
winMain->state = STATE_QUERY;
- winMain->data = new DataFileChatOffer(_nSequence, _nUin);
+ winMain->data = new DataFileChatOffer(_nSequence, _szId, _nPPID);
winMain->wprintf("%C%ADo you wish to accept this request? (y/N) %C%Z",
m_cColorQuery->nColor, m_cColorQuery->nAttr, COLOR_WHITE, A_BOLD);
winMain->RefreshWin();
@@ -3013,7 +3051,7 @@
// Make the ftman
CFileTransferManager *ftman = new CFileTransferManager(licqDaemon,
- data->nUin);
+ strtoul(data->szId, (char **)NULL, 10));
ftman->SetUpdatesEnabled(1);
m_lFileStat.push_back(ftman);
@@ -3022,7 +3060,7 @@
ftman->ReceiveFiles(home);
// XXX hack
unsigned long dummy[2] = { 0, 0};
- licqDaemon->icqFileTransferAccept(data->nUin, ftman->LocalPort(),
+ licqDaemon->icqFileTransferAccept(strtoul(data->szId, (char **)NULL, 10),
ftman->LocalPort(),
data->nSequence, dummy, true);
winMain->fProcessInput = &CLicqConsole::InputCommand;
@@ -3054,12 +3092,12 @@
// XXX hack
unsigned long dummy[2] = { 0, 0 };
- licqDaemon->icqFileTransferRefuse(data->nUin, data->szReason,
+ licqDaemon->icqFileTransferRefuse(strtoul(data->szId, (char **)NULL, 10),
data->szReason,
data->nSequence, dummy, true);
// We are done now
- winMain->wprintf("%ARefusing file from %ld with reason: %Z%s\n",
- A_BOLD, data->nUin, A_BOLD, data->szReason);
+ winMain->wprintf("%ARefusing file from %s with reason: %Z%s\n",
+ A_BOLD, data->szId, A_BOLD, data->szReason);
winMain->fProcessInput = &CLicqConsole::InputCommand;
if(winMain->data)
@@ -3076,9 +3114,9 @@
/*-------------------------------------------------------------------------
* CLicqConsole::UserCommand_Secure
*-----------------------------------------------------------------------*/
-void CLicqConsole::UserCommand_Secure(unsigned long nUin, char *szStatus)
+void CLicqConsole::UserCommand_Secure(const char *szId, unsigned long nPPID, char
*szStatus)
{
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if(!licqDaemon->CryptoEnabled())
{
@@ -3115,14 +3153,20 @@
winMain->wprintf("%ARequest secure channel with %s ... ", A_BOLD,
u->GetAlias());
gUserManager.DropUser(u);
- winMain->event = licqDaemon->icqOpenSecureChannel(nUin);
+ char *p;
+ unsigned long uin = strtoul(szId, &p,10);
+ if( (p == 0 || (p && !*p)) && nPPID == LICQ_PPID )
+ winMain->event = licqDaemon->icqOpenSecureChannel(uin);
}
else if(strcasecmp(szStatus, "close") == 0)
{
winMain->wprintf("%AClose secure channel with %s ... ", A_BOLD,
u->GetAlias());
gUserManager.DropUser(u);
- winMain->event = licqDaemon->icqCloseSecureChannel(nUin);
+ char *p;
+ unsigned long uin = strtoul(szId, &p,10);
+ if( (p == 0 || (p && !*p)) && nPPID == LICQ_PPID )
+ winMain->event = licqDaemon->icqCloseSecureChannel(uin);
}
else
{
@@ -3141,7 +3185,12 @@
// Get the input now
winMain->fProcessInput = &CLicqConsole::InputUserSelect;
winMain->state = STATE_LE;
- winMain->data = new DataUserSelect(gUserManager.OwnerUin());
+
+ char sz[20];
+ //TODO which owner
+ sprintf(sz, "%lu", gUserManager.OwnerUin());
+
+ winMain->data = new DataUserSelect(sz, LICQ_PPID);
ICQOwner *o = gUserManager.FetchOwner(LOCK_R);
winMain->wprintf("%A%CEnter your password for %s (%lu):%C%Z\n", A_BOLD,
Index: console.h
===================================================================
RCS file: /cvsroot/licq/console/src/console.h,v
retrieving revision 1.36
diff -u -r1.36 console.h
--- console.h 23 Jun 2003 16:13:46 -0000 1.36
+++ console.h 10 Jun 2004 13:13:13 -0000
@@ -29,12 +29,19 @@
struct SUser
{
char szKey[32];
- unsigned long nUin;
+ char szId[32];
+ unsigned long nPPID;
char *szLine;
bool bOffline;
const struct SColorMap *color;
};
+struct SContact
+{
+ char *szId;
+ unsigned long nPPID;
+};
+
struct SMacro
{
char szMacro[32];
@@ -95,6 +102,7 @@
char *CurrentGroupName();
void SwitchToCon(unsigned short nCon);
void CreateUserList();
+ void AddEventTag(char *, unsigned long, unsigned long);
void InputCommand(int cIn);
void InputLogWindow(int cIn);
@@ -123,10 +131,10 @@
void PrintUsers();
void PrintHelp();
void PrintHistory(HistoryList &, unsigned short, unsigned short, const char *);
- void PrintInfo_General(unsigned long);
- void PrintInfo_More(unsigned long);
- void PrintInfo_Work(unsigned long);
- void PrintInfo_About(unsigned long);
+ void PrintInfo_General(const char *, unsigned long);
+ void PrintInfo_More(const char *, unsigned long);
+ void PrintInfo_Work(const char *, unsigned long);
+ void PrintInfo_About(const char *, unsigned long);
void PrintFileStat(CFileTransferManager *);
void PrintMacros();
@@ -162,27 +170,28 @@
void TabStatus(char *, struct STabCompletion &);
void TabSet(char *, struct STabCompletion &);
- void UserCommand_Info(unsigned long nUin, char *);
- void UserCommand_Msg(unsigned long nUin, char *);
- void UserCommand_View(unsigned long nUin, char *);
- void UserCommand_SendFile(unsigned long nUin, char *);
- void UserCommand_Url(unsigned long nUin, char *);
- void UserCommand_Sms(unsigned long nUin, char *);
- void UserCommand_History(unsigned long nUin, char *);
- void UserCommand_Remove(unsigned long nUin, char *);
- void UserCommand_FetchAutoResponse(unsigned long nUin, char *);
- void UserCommand_SetAutoResponse(unsigned long nUin, char *);
- void UserCommand_Secure(unsigned long nUin, char *);
+ void UserCommand_Info(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_Msg(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_View(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_SendFile(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_Url(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_Sms(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_History(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_Remove(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_FetchAutoResponse(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_SetAutoResponse(const char *szId, unsigned long nPPID, char *);
+ void UserCommand_Secure(const char *szId, unsigned long nPPID, char *);
void Command_Search();
void Beep() { printf("\a"); fflush(stdout); }
- void FileChatOffer(unsigned long, unsigned long);
+ void FileChatOffer(unsigned long, const char *, unsigned long);
void RegistrationWizard();
void InputRegistrationWizard(int cIn);
void UserSelect();
void InputUserSelect(int cIn);
bool ParseMacro(char *);
unsigned long GetUinFromArg(char **);
+ struct SContact GetContactFromArg(char **);
};
Index: console_menu.cpp
===================================================================
RCS file: /cvsroot/licq/console/src/console_menu.cpp,v
retrieving revision 1.35
diff -u -r1.35 console_menu.cpp
--- console_menu.cpp 23 Jun 2003 16:13:46 -0000 1.35
+++ console_menu.cpp 10 Jun 2004 13:13:15 -0000
@@ -150,6 +150,9 @@
PluginsList l;
PluginsListIter it;
licqDaemon->PluginList(l);
+ ProtoPluginsList p1;
+ ProtoPluginsListIter pit;
+ licqDaemon->ProtoPluginList(p1);
PrintBoxTop("Plugins", COLOR_BLUE, 70);
for (it = l.begin(); it != l.end(); it++)
{
@@ -159,6 +162,13 @@
(*it)->BuildTime(), (*it)->Status());
PrintBoxRight(70);
}
+ for (pit = p1.begin(); pit != p1.end(); pit++)
+ {
+ PrintBoxLeft();
+ winMain->wprintf("[%3d] %s v%s", (*pit)->Id(), (*pit)->Name(),
+ (*pit)->Version());
+ PrintBoxRight(70);
+ }
PrintBoxBottom(70);
}
@@ -295,6 +305,7 @@
/*---------------------------------------------------------------------------
* CLicqConsole::MenuAdd
*-------------------------------------------------------------------------*/
+//TODO: fix this for other protocols
void CLicqConsole::MenuAdd(char *szArg)
{
if (szArg == NULL)
@@ -304,7 +315,6 @@
}
// Try to change groups
- int nUin = atol(szArg);
bool bAlert = false;
while (*szArg != '\0' && *szArg != ' ') szArg++;
@@ -315,19 +325,20 @@
bAlert = true;
}
- if (!licqDaemon->AddUserToList(nUin))
+ if (!licqDaemon->AddUserToList(szArg, LICQ_PPID))
{
- winMain->wprintf("%CAdding user %lu failed (duplicate user or invalid uin).\n",
- COLOR_RED, nUin);
+ winMain->wprintf("%CAdding user %s failed (duplicate user or invalid uin).\n",
+ COLOR_RED, szArg);
return;
}
- winMain->wprintf("%C%AAdded user %ld.\n",
+ winMain->wprintf("%C%AAdded user %s.\n",
m_cColorInfo->nColor, m_cColorInfo->nAttr,
- nUin);
+ szArg);
if (bAlert)
{
+ int nUin = atol(szArg);
licqDaemon->icqAlertUser(nUin);
winMain->wprintf("%C%AAlerted user %ld they were added.\n",
m_cColorInfo->nColor, m_cColorInfo->nAttr,
@@ -340,6 +351,7 @@
/*---------------------------------------------------------------------------
* CLicqConsole::MenuAuthorize
*-------------------------------------------------------------------------*/
+//TODO: update for other protocols
void CLicqConsole::MenuAuthorize(char *szArg)
{
if (szArg == NULL)
@@ -363,7 +375,7 @@
// Try to change groups
int nUin = atol(szArg);
-
+
if (nUin == 0)
{
winMain->wprintf("%CUIN must be non-zero.\n", COLOR_RED);
@@ -373,7 +385,7 @@
// Get the input now
winMain->fProcessInput = &CLicqConsole::InputAuthorize;
winMain->state = STATE_MLE;
- DataMsg *data = new DataMsg(nUin);
+ DataMsg *data = new DataMsg(szArg, LICQ_PPID);
data->bUrgent = bGrant;
winMain->data = data;
@@ -422,23 +434,35 @@
return;
}
- ICQOwner *o = gUserManager.FetchOwner(LOCK_R);
- if (nStatus == ICQ_STATUS_OFFLINE)
+ //set same status for all protocols for now
+ ProtoPluginsList p1;
+ ProtoPluginsListIter it;
+ licqDaemon->ProtoPluginList(p1);
+ for (it = p1.begin(); it != p1.end(); it++)
{
- gUserManager.DropOwner();
- licqDaemon->icqLogoff();
- return;
- }
- if (bInvisible)
- nStatus |= ICQ_STATUS_FxPRIVATE;
+ unsigned long nPPID = (*it)->PPID();
+ ICQOwner *o = gUserManager.FetchOwner(nPPID, LOCK_R);
+ if (nStatus == ICQ_STATUS_OFFLINE)
+ {
+ gUserManager.DropOwner(nPPID);
+ licqDaemon->ProtoLogoff(nPPID);
+ continue;
+ }
+ if (bInvisible)
+ nStatus |= ICQ_STATUS_FxPRIVATE;
- // call the right function
- bool b = o->StatusOffline();
- gUserManager.DropOwner();
- if (b)
- licqDaemon->icqLogon(nStatus);
- else
- licqDaemon->icqSetStatus(nStatus);
+ // call the right function
+ bool b = o->StatusOffline();
+ gUserManager.DropOwner(nPPID);
+ if (b)
+ {
+ licqDaemon->ProtoLogon(nPPID, nStatus);
+ }
+ else
+ {
+ licqDaemon->ProtoSetStatus(nPPID, nStatus);
+ }
+ }
}
@@ -462,15 +486,13 @@
for (it = m_lUsers.begin(); it != m_lUsers.end(); it++)
{
- u = gUserManager.FetchUser((*it)->nUin, LOCK_R);
- winMain->wprintf("%s %A-%Z %lu\n", u->GetAlias(), A_BOLD, A_BOLD, u->Uin());
+ u = gUserManager.FetchUser((*it)->szId, (*it)->nPPID, LOCK_R);
+ winMain->wprintf("%s %A-%Z %s\n", u->GetAlias(), A_BOLD, A_BOLD, u->IdString());
gUserManager.DropUser(u);
}
}
-
-
/*---------------------------------------------------------------------------
* CLicqConsole::GetUinFromArg
*-------------------------------------------------------------------------*/
@@ -533,7 +555,7 @@
if (nUin == 0)
{
- FOR_EACH_USER_START(LOCK_R)
+ FOR_EACH_PROTO_USER_START(LICQ_PPID, LOCK_R)
{
if (strcasecmp(szAlias, pUser->GetAlias()) == 0)
{
@@ -541,7 +563,7 @@
FOR_EACH_USER_BREAK;
}
}
- FOR_EACH_USER_END
+ FOR_EACH_PROTO_USER_END
if (nUin == 0)
{
winMain->wprintf("%CInvalid user: %A%s\n", COLOR_RED, A_BOLD, szAlias);
@@ -567,6 +589,86 @@
return nUin;
}
+/*---------------------------------------------------------------------------
+ * CLicqConsole::GetContactFromArg
+ *-------------------------------------------------------------------------*/
+struct SContact CLicqConsole::GetContactFromArg(char **p_szArg)
+{
+ char *szAlias, *szCmd;
+ char *szArg = *p_szArg;
+ struct SContact scon;
+ scon.szId = NULL;
+
+ if (szArg == NULL) {
+ return scon;
+ }
+
+ // Check if the alias is quoted
+ if (szArg[0] == '"')
+ {
+ szAlias = &szArg[1];
+ szCmd = strchr(&szArg[1], '"');
+ if (szCmd == NULL)
+ {
+ winMain->wprintf("%CUnbalanced quotes.\n", COLOR_RED);
+ return scon;
+ }
+ *szCmd++ = '\0';
+ szCmd = strchr(szCmd, ' ');
+ }
+ //TODO - fix this
+ //else if (szArg[0] == '#')
+ //{
+ // *p_szArg = NULL;
+ // return gUserManager.OwnerUin();
+ //}
+ //else if (szArg[0] == '$')
+ //{
+ // *p_szArg = NULL;
+ // return winMain->nLastUin;
+ //}
+ else
+ {
+ szAlias = szArg;
+ szCmd = strchr(szArg, ' ');
+ }
+
+ if (szCmd != NULL)
+ {
+ *szCmd++ = '\0';
+ STRIP(szCmd);
+ }
+ *p_szArg = szCmd;
+
+ FOR_EACH_USER_START(LOCK_R)
+ {
+ if (strcasecmp(szAlias, pUser->GetAlias()) == 0)
+ {
+ scon.szId = pUser->IdString();
+ scon.nPPID = pUser->PPID();
+ FOR_EACH_PROTO_USER_BREAK;
+ }
+ }
+ FOR_EACH_USER_END
+ if (scon.szId == NULL)
+ {
+ winMain->wprintf("%CInvalid user: %A%s\n", COLOR_RED, A_BOLD, szAlias);
+ scon.szId = NULL;
+ scon.nPPID = (unsigned long)-1;
+ return scon;
+ }
+
+ //TODO
+ // Save this as the last user
+ //if (winMain->nLastUin != nUin)
+ //{
+ // winMain->nLastUin = nUin;
+ // PrintStatus();
+ //}
+
+ return scon;
+}
+
/*---------------------------------------------------------------------------
@@ -575,20 +677,19 @@
void CLicqConsole::MenuMessage(char *szArg)
{
char *sz = szArg;
- unsigned long nUin = GetUinFromArg(&sz);
+ struct SContact scon = GetContactFromArg(&sz);
- if (nUin == gUserManager.OwnerUin())
- winMain->wprintf("%CYou can't send messages to yourself!\n", COLOR_RED);
- else if (nUin == 0)
+ if (!scon.szId && scon.nPPID != (unsigned long)-1)
winMain->wprintf("%CYou must specify a user to send a message to.\n", COLOR_RED);
- else if (nUin != (unsigned long)-1)
- UserCommand_Msg(nUin, sz);
+ else if (scon.nPPID != (unsigned long)-1)
+ UserCommand_Msg(scon.szId, scon.nPPID, sz);
}
/*---------------------------------------------------------------------------
* CLicqConsole::MenuInfo
*-------------------------------------------------------------------------*/
+//TODO: fix this for other protocols
void CLicqConsole::MenuInfo(char *szArg)
{
char *sz = szArg;
@@ -596,16 +697,20 @@
if (nUin == gUserManager.OwnerUin())
winMain->wprintf("%CSetting personal info not implemented yet.\n", COLOR_RED);
- else if (nUin == 0)
- UserCommand_Info(gUserManager.OwnerUin(), sz);
- else if (nUin != (unsigned long)-1)
- UserCommand_Info(nUin, sz);
+ else if (nUin == 0) {
+ char szUin[24];
+ sprintf(szArg, "%lu", gUserManager.OwnerUin());
+ UserCommand_Info(szUin, LICQ_PPID, sz);
+ } else if (nUin != (unsigned long)-1)
+ sprintf(szArg, "%lu", nUin);
+ UserCommand_Info(szArg, LICQ_PPID, sz);
}
/*---------------------------------------------------------------------------
* CLicqConsole::MenuUrl
*-------------------------------------------------------------------------*/
+//TODO: fix this for other protocols
void CLicqConsole::MenuUrl(char *szArg)
{
char *sz = szArg;
@@ -616,13 +721,16 @@
else if (nUin == 0)
winMain->wprintf("%CYou must specify a user to send a URL to.\n", COLOR_RED);
else if (nUin != (unsigned long)-1)
- UserCommand_Url(nUin, sz);
+ sprintf(szArg, "%lu", nUin);
+ UserCommand_Url(szArg, LICQ_PPID, sz);
+
}
/*---------------------------------------------------------------------------
* CLicqConsole::MenuSms
*-------------------------------------------------------------------------*/
+//TODO: fix this for other protocols
void CLicqConsole::MenuSms(char *szArg)
{
char *sz = szArg;
@@ -631,7 +739,10 @@
if (nUin == 0)
winMain->wprintf("%CInvalid user\n", COLOR_RED);
else if (nUin != (unsigned long)-1)
- UserCommand_Sms(nUin, sz);
+ {
+ sprintf(szArg, "%lu", nUin);
+ UserCommand_Sms(szArg, LICQ_PPID, sz);
+ }
}
@@ -640,21 +751,27 @@
*-------------------------------------------------------------------------*/
void CLicqConsole::MenuView(char *szArg)
{
- char *sz = szArg;
- unsigned long nUin = GetUinFromArg(&sz);
- if (nUin == 0)
+ char *sz = szArg;
+ char *szId = NULL;
+ unsigned long nPPID = (unsigned long)-1;
+ struct SContact scon = GetContactFromArg(&sz);
+
+ if (scon.szId == 0)
{
// Do nothing if there are no events pending
if (ICQUser::getNumUserEvents() == 0) return;
- // Do system messages first
- ICQOwner *o = gUserManager.FetchOwner(LOCK_R);
+ // Do icq system messages first
+ ICQOwner *o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R);
unsigned short nNumMsg = o->NewMessages();
gUserManager.DropOwner();
if (nNumMsg > 0)
{
- UserCommand_View(gUserManager.OwnerUin(), NULL);
+ //TODO which owner?
+ char szUin[24];
+ sprintf(szUin, "%lu", gUserManager.OwnerUin());
+ UserCommand_View(szUin, LICQ_PPID, NULL);
return;
}
@@ -663,17 +780,22 @@
{
if (pUser->NewMessages() > 0 && pUser->Touched() <= t)
{
- nUin = pUser->Uin();
+ szId = pUser->IdString();
+ nPPID = pUser->PPID();
t = pUser->Touched();
}
}
FOR_EACH_USER_END
- if (nUin != 0) UserCommand_View(nUin, NULL);
+ if (szId != NULL)
+ {
+ UserCommand_View(szId, nPPID, NULL);
+ }
}
- else if (nUin != (unsigned long)-1)
+ else if (scon.szId != NULL)
{
- UserCommand_View(nUin, sz);
+ UserCommand_View(scon.szId, scon.nPPID, sz);
}
+
}
@@ -690,7 +812,10 @@
else if (nUin == 0)
winMain->wprintf("%CYou must specify a user to talk to.\n", COLOR_RED);
else if (nUin != (unsigned long)-1)
- UserCommand_Secure(nUin, sz);
+ {
+ sprintf(szArg, "%lu", nUin);
+ UserCommand_Secure(szArg, LICQ_PPID, sz);
+ }
}
@@ -724,7 +849,10 @@
}
}
else if (nUin != (unsigned long)-1)
- UserCommand_SendFile(nUin, sz);
+ {
+ sprintf(szArg, "%lu", nUin);
+ UserCommand_SendFile(szArg, LICQ_PPID, sz);
+ }
}
@@ -742,7 +870,7 @@
for (unsigned short i = 0; i < winMain->Cols() - 10; i++)
waddch(winMain->Win(), ACS_HLINE);
waddch(winMain->Win(), '\n');
- ICQOwner *o = gUserManager.FetchOwner(LOCK_R);
+ ICQOwner *o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R);
winMain->wprintf("%B%CAuto response:\n%b%s\n",
COLOR_WHITE, o->AutoResponse());
gUserManager.DropOwner();
@@ -754,15 +882,16 @@
wattroff(winMain->Win(), A_BOLD);
}
else if (nUin == 0)
- UserCommand_SetAutoResponse(nUin, sz);
+ UserCommand_SetAutoResponse(NULL, LICQ_PPID, sz);
else if (nUin != (unsigned long)-1)
- UserCommand_FetchAutoResponse(nUin, sz);
+ UserCommand_FetchAutoResponse(NULL, LICQ_PPID, sz);
}
/*---------------------------------------------------------------------------
* CLicqConsole::MenuRemove
*-------------------------------------------------------------------------*/
+//TODO: add support for other protocols
void CLicqConsole::MenuRemove(char *szArg)
{
char *sz = szArg;
@@ -773,7 +902,10 @@
else if (nUin == 0)
winMain->wprintf("%CYou must specify a user to remove.\n", COLOR_RED);
else if (nUin != (unsigned long)-1)
- UserCommand_Remove(nUin, sz);
+ {
+ sprintf(szArg, "%lu", nUin);
+ UserCommand_Remove(szArg, LICQ_PPID, sz);
+ }
}
@@ -783,12 +915,12 @@
void CLicqConsole::MenuHistory(char *szArg)
{
char *sz = szArg;
- unsigned long nUin = GetUinFromArg(&sz);
+ struct SContact scon = GetContactFromArg(&sz);
- if (nUin == 0)
+ if (!scon.szId && scon.nPPID != (unsigned long)-1)
winMain->wprintf("%CYou must specify a user to view history.\n", COLOR_RED);
- else if (nUin != (unsigned long)-1)
- UserCommand_History(nUin, sz);
+ else if (scon.nPPID != (unsigned long)-1)
+ UserCommand_History(scon.szId, scon.nPPID, sz);
}
Index: console_print.cpp
===================================================================
RCS file: /cvsroot/licq/console/src/console_print.cpp,v
retrieving revision 1.39
diff -u -r1.39 console_print.cpp
--- console_print.cpp 22 Jun 2003 22:28:10 -0000 1.39
+++ console_print.cpp 10 Jun 2004 13:13:17 -0000
@@ -288,7 +288,8 @@
s = new SUser;
sprintf(s->szKey, "%05u%010lu", pUser->Status(), pUser->Touched() ^ 0xFFFFFFFF);
- s->nUin = pUser->Uin();
+ sprintf(s->szId, "%s", pUser->IdString());
+ s->nPPID = pUser->PPID();
s->bOffline = pUser->StatusOffline();
unsigned long iStatus = pUser->StatusFull();
@@ -498,10 +499,10 @@
/*---------------------------------------------------------------------------
* CLicqConsole::PrintInfo_General
*-------------------------------------------------------------------------*/
-void CLicqConsole::PrintInfo_General(unsigned long nUin)
+void CLicqConsole::PrintInfo_General(const char *szId, unsigned long nPPID)
{
// Print the users info to the main window
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if (u == NULL) return;
// Some IP, Real IP and last seen stuff
@@ -574,10 +575,10 @@
/*---------------------------------------------------------------------------
* CLicqConsole::PrintInfo_More
*-------------------------------------------------------------------------*/
-void CLicqConsole::PrintInfo_More(unsigned long nUin)
+void CLicqConsole::PrintInfo_More(const char *szId, unsigned long nPPID)
{
// Print the users info to the main window
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if (u == NULL) return;
wattron(winMain->Win(), A_BOLD);
@@ -620,10 +621,10 @@
/*---------------------------------------------------------------------------
* CLicqConsole::PrintInfo_Work
*-------------------------------------------------------------------------*/
-void CLicqConsole::PrintInfo_Work(unsigned long nUin)
+void CLicqConsole::PrintInfo_Work(const char *szId, unsigned long nPPID)
{
// Print the users info to the main window
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if (u == NULL) return;
wattron(winMain->Win(), A_BOLD);
@@ -670,10 +671,10 @@
/*----------------------------------------------------------------------------
* CLicqConsole::PrintInfo_About
*--------------------------------------------------------------------------*/
-void CLicqConsole::PrintInfo_About(unsigned long nUin)
+void CLicqConsole::PrintInfo_About(const char *szId, unsigned long nPPID)
{
// Print the user's about info to the main window
- ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R);
+ ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
if (u == NULL) return;
wattron(winMain->Win(), A_BOLD);
Index: event_data.h
===================================================================
RCS file: /cvsroot/licq/console/src/event_data.h,v
retrieving revision 1.11
diff -u -r1.11 event_data.h
--- event_data.h 23 Jun 2003 16:13:46 -0000 1.11
+++ event_data.h 10 Jun 2004 13:13:17 -0000
@@ -5,9 +5,10 @@
class CData
{
public:
- CData (unsigned long n)
- { nUin = n; nPos = 0; szQuery[0] = '\0'; }
- unsigned long nUin;
+ CData (const char *i, unsigned long n)
+ { szId = i; nPPID = n, nPos = 0; szQuery[0] = '\0'; }
+ const char *szId;
+ unsigned long nPPID;
unsigned short nPos;
char szQuery[80];
};
@@ -16,7 +17,7 @@
class DataMsg : public CData
{
public:
- DataMsg(unsigned long n) : CData(n)
+ DataMsg(const char *i, unsigned long n) : CData(i, n)
{ szMsg[0] = '\0'; bUrgent = false; bServer = false; }
char szMsg[1024];
bool bUrgent;
@@ -27,7 +28,7 @@
class DataSendFile : public CData
{
public:
- DataSendFile(unsigned long n) : CData(n)
+ DataSendFile(const char *i, unsigned long n) : CData(i, n)
{ szFileName[0] = '\0'; szDescription[0] = '\0'; bUrgent = false; }
char szFileName[512];
char szDescription[512];
@@ -38,7 +39,7 @@
class DataAutoResponse : public CData
{
public:
- DataAutoResponse() : CData(0)
+ DataAutoResponse() : CData(NULL, 0)
{ szRsp[0] = '\0'; }
char szRsp[1024];
};
@@ -47,7 +48,7 @@
class DataUrl : public CData
{
public:
- DataUrl(unsigned long n) : CData(n)
+ DataUrl(const char *i, unsigned long n) : CData(i, n)
{ szUrl[0] = '\0'; szDesc[0] = '\0'; bUrgent = false; bServer = false; }
char szUrl[1024];
char szDesc[1024];
@@ -58,14 +59,14 @@
class DataSms : public CData
{
public:
- DataSms(unsigned long n) : CData(n)
+ DataSms(const char *i, unsigned long n) : CData(i, n)
{ szMsg[0] = '\0'; }
char szMsg[1024];
};
class DataRegWizard : public CData
{
public:
- DataRegWizard(unsigned long n = 0) : CData(n)
+ DataRegWizard(const char *i = NULL, unsigned long n = 0) : CData(i, n)
{ szOption[0] = '\0'; szPassword1[0] = '\0'; szPassword2[0] = '\0'; szUin[0] =
'\0'; nState = 0; }
char szOption[80];
char szPassword1[80];
@@ -77,7 +78,7 @@
class DataUserSelect : public CData
{
public:
- DataUserSelect(unsigned long n) : CData(n)
+ DataUserSelect(const char *i, unsigned long n) : CData(i, n)
{ szPassword[0] = '\0'; }
char szPassword[80];
};
@@ -85,7 +86,7 @@
class DataSearch : public CData
{
public:
- DataSearch() : CData(0)
+ DataSearch() : CData(NULL, 0)
{ szAlias[0] = szFirstName[0] = szLastName[0] = szEmail[0] =
szCity[0] = szState[0] = szCoName[0] = szCoDept[0] = szCoPos[0] = '\0';
nState = nMinAge = nMaxAge = nGender = nLanguage = nCountryCode = 0;
@@ -113,7 +114,7 @@
class DataFileChatOffer : public CData
{
public:
- DataFileChatOffer(unsigned long _nSeq, unsigned long _nUin) : CData(_nUin)
+ DataFileChatOffer(unsigned long _nSeq, const char *i, unsigned long n) : CData(i, n)
{ szReason[0] = '\0'; nSequence = _nSeq; }
char szReason[256];
unsigned long nSequence;
Index: window.h
===================================================================
RCS file: /cvsroot/licq/console/src/window.h,v
retrieving revision 1.10
diff -u -r1.10 window.h
--- window.h 22 Jun 2003 22:28:10 -0000 1.10
+++ window.h 10 Jun 2004 13:13:17 -0000
@@ -42,6 +42,7 @@
InputState state;
CData *data;
unsigned long nLastUin;
+ //struct SContact sLastContact;
unsigned short nLastHistory;
protected:
WINDOW *win;