diff options
Diffstat (limited to 'protocols/IRCG')
-rw-r--r-- | protocols/IRCG/src/clist.cpp | 4 | ||||
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 101 | ||||
-rw-r--r-- | protocols/IRCG/src/input.cpp | 29 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 14 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.h | 2 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 18 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 40 | ||||
-rw-r--r-- | protocols/IRCG/src/stdafx.h | 326 | ||||
-rw-r--r-- | protocols/IRCG/src/tools.cpp | 28 | ||||
-rw-r--r-- | protocols/IRCG/src/windows.cpp | 4 |
10 files changed, 253 insertions, 313 deletions
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index a0406973c6..3095d7096a 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -40,7 +40,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmas hContact = CList_AddContact(&user, false, false);
setByte(hContact, "DCC", 1);
- DCCINFO* pdci = new DCCINFO;
+ DCCINFO *pdci = new DCCINFO;
pdci->sHostmask = hostmask;
pdci->hContact = hContact;
pdci->dwAdr = (DWORD)adr;
@@ -50,7 +50,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmas pdci->sContactName = name;
if (m_DCCChatAccept == 3 || m_DCCChatAccept == 2 && bFlag) {
- CDccSession* dcc = new CDccSession(this, pdci);
+ CDccSession *dcc = new CDccSession(this, pdci);
CDccSession* olddcc = FindDCCSession(hContact);
if (olddcc)
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index b291319818..2d619b8c71 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -235,7 +235,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, wchar_t* msg) return 1;
}
-void __cdecl CIrcProto::ResolveIPThread(LPVOID di)
+void __cdecl CIrcProto::ResolveIPThread(void *di)
{
Thread_SetName("IRC: ResolveIPThread");
IPRESOLVE* ipr = (IPRESOLVE *)di;
@@ -373,11 +373,8 @@ bool CIrcProto::OnIrc_QUIT(const CIrcMessage* pmsg) DoEvent(GC_EVENT_QUIT, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters.getCount() > 0 ? pmsg->parameters[0].c_str() : NULL, NULL, host.c_str(), NULL, true, false);
struct CONTACT user = { (LPTSTR)pmsg->prefix.sNick.c_str(), (LPTSTR)pmsg->prefix.sUser.c_str(), (LPTSTR)pmsg->prefix.sHost.c_str(), false, false, false };
CList_SetOffline(&user);
- if (pmsg->prefix.sNick == m_info.sNick) {
- GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, &gce);
- }
+ if (pmsg->prefix.sNick == m_info.sNick)
+ Chat_Control(m_szModuleName, NULL, SESSION_OFFLINE);
}
else ShowMessage(pmsg);
@@ -391,9 +388,7 @@ bool CIrcProto::OnIrc_PART(const CIrcMessage* pmsg) DoEvent(GC_EVENT_PART, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), pmsg->parameters.getCount() > 1 ? pmsg->parameters[1].c_str() : NULL, NULL, host.c_str(), NULL, true, false);
if (pmsg->prefix.sNick == m_info.sNick) {
CMStringW S = MakeWndID(pmsg->parameters[0].c_str());
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, &gce);
+ Chat_Control(m_szModuleName, S, SESSION_OFFLINE);
}
}
else ShowMessage(pmsg);
@@ -410,12 +405,10 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg) if (pmsg->parameters[1] == m_info.sNick) {
CMStringW S = MakeWndID(pmsg->parameters[0].c_str());
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, &gce);
+ Chat_Control(m_szModuleName, S, SESSION_OFFLINE);
if (m_rejoinIfKicked) {
- CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, pmsg->parameters[0].c_str());
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", pmsg->parameters[0].c_str(), wi->pszPassword);
else
@@ -499,7 +492,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) if ((int)pmsg->parameters.getCount() > iParametercount) {
if (!mir_wstrcmp(pmsg->parameters[2].c_str(), m_info.sNick.c_str())) {
char cModeBit = -1;
- CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, NULL, false, false, 0);
+ CHANNELINFO *wi = (CHANNELINFO*)Chat_GetUserInfo(m_szModuleName, pmsg->parameters[0].c_str());
switch (*p1) {
case 'v': cModeBit = 0; break;
case 'h': cModeBit = 1; break;
@@ -514,7 +507,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) else
wi->OwnMode &= ~(1 << cModeBit);
- DoEvent(GC_EVENT_SETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, (DWORD_PTR)wi, false, false, 0);
+ Chat_SetUserInfo(m_szModuleName, pmsg->parameters[0].c_str(), wi);
}
DoEvent(bAdd ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS, pmsg->parameters[0].c_str(), pmsg->parameters[iParametercount].c_str(), pmsg->prefix.sNick.c_str(), sStatus.c_str(), NULL, NULL, m_oldStyleModes ? false : true, false);
iParametercount++;
@@ -581,7 +574,7 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg) CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
DoEvent(GC_EVENT_NICK, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, host.c_str(), NULL, true, bIsMe);
- DoEvent(GC_EVENT_CHUID, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, NULL, NULL, true, false);
+ Chat_ChangeUserId(m_szModuleName, NULL, pmsg->prefix.sNick, pmsg->parameters[0]);
struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
MCONTACT hContact = CList_FindContact(&user);
@@ -1086,7 +1079,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // remote requested that the file should be resumed
if (type == L"resume") {
- CDccSession* dcc;
+ CDccSession *dcc;
if (sToken.IsEmpty())
dcc = FindDCCSendByPort(iPort);
else
@@ -1101,7 +1094,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // remote accepted your request for a file resume
if (type == L"accept") {
- CDccSession* dcc;
+ CDccSession *dcc;
if (sToken.IsEmpty())
dcc = FindDCCRecvByPortAndName(iPort, pmsg->prefix.sNick.c_str());
else
@@ -1128,7 +1121,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // a reverse filetransfer. The plugin should connect to that computer
// and start sedning the file (if the token is valid). Compare to DCC RECV
if (!sToken.IsEmpty() && iPort) {
- CDccSession* dcc = FindPassiveDCCSend(_wtoi(sToken.c_str()));
+ CDccSession *dcc = FindPassiveDCCSend(_wtoi(sToken.c_str()));
if (dcc) {
dcc->SetupPassive(dwAdr, iPort);
dcc->Connect();
@@ -1273,31 +1266,31 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) CMStringW sID = MakeWndID(sChanName);
BYTE btOwnMode = 0;
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.ptszID = sID.c_str();
gcw.pszModule = m_szModuleName;
gcw.ptszName = sChanName;
if (!Chat_NewSession(&gcw)) {
DBVARIANT dbv;
- GCDEST gcd = { m_szModuleName, sID.c_str(), GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
PostIrcMessage(L"/MODE %s", sChanName);
// register the statuses
+ GCDEST gcd = { m_szModuleName, sID.c_str(), GC_EVENT_ADDGROUP };
+ GCEVENT gce = { &gcd };
gce.ptszStatus = L"Owner";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Admin";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Op";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Halfop";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Voice";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Normal";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
{
int k = 0;
CMStringW sTemp = GetWord(sNamesList.c_str(), k);
@@ -1333,7 +1326,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) }
gce.bIsMe = bIsMe;
gce.time = bIsMe ? time(0) : 0;
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
DoEvent(GC_EVENT_SETCONTACTSTATUS, sChanName, sTemp.c_str(), NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE);
// fix for networks like freshirc where they allow more than one prefix
if (PrefixToStatus(sTemp2[0]) != L"Normal") {
@@ -1353,7 +1346,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) //Set the item data for the window
{
- CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, sChanName, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, sChanName);
if (!wi)
wi = new CHANNELINFO;
wi->OwnMode = btOwnMode;
@@ -1362,7 +1355,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) wi->pszPassword = 0;
wi->pszTopic = 0;
wi->codepage = getCodepage();
- DoEvent(GC_EVENT_SETITEMDATA, sChanName, NULL, NULL, NULL, NULL, (DWORD_PTR)wi, false, false, 0);
+ Chat_SetUserInfo(m_szModuleName, sChanName, wi);
if (!sTopic.IsEmpty() && !mir_wstrcmpi(GetWord(sTopic.c_str(), 0).c_str(), sChanName)) {
DoEvent(GC_EVENT_TOPIC, sChanName, sTopicName.IsEmpty() ? NULL : sTopicName.c_str(), GetWordAddress(sTopic.c_str(), 1), NULL, sTopicTime.IsEmpty() ? NULL : sTopicTime.c_str(), NULL, true, false);
@@ -1370,21 +1363,8 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) sTopic = L"";
sTopicName = L"";
sTopicTime = L"";
- } }
-
- gcd.ptszID = (wchar_t*)sID.c_str();
- gcd.iType = GC_EVENT_CONTROL;
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = 0;
- gce.bIsMe = false;
- gce.dwItemData = false;
- gce.ptszNick = NULL;
- gce.ptszStatus = NULL;
- gce.ptszText = NULL;
- gce.ptszUID = NULL;
- gce.ptszUserInfo = NULL;
- gce.time = time(0);
- gce.pDest = &gcd;
+ }
+ }
if (!getWString("JTemp", &dbv)) {
CMStringW command = L"a";
@@ -1407,17 +1387,17 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) save += GetWordAddress(dbv.ptszVal, k);
switch (command[0]) {
case 'M':
- CallChatEvent(WINDOW_HIDDEN, &gce);
+ Chat_Control(m_szModuleName, sID, WINDOW_HIDDEN);
break;
case 'X':
- CallChatEvent(WINDOW_MAXIMIZE, &gce);
+ Chat_Control(m_szModuleName, sID, WINDOW_MAXIMIZE);
break;
default:
- CallChatEvent(SESSION_INITDONE, &gce);
+ Chat_Control(m_szModuleName, sID, SESSION_INITDONE);
break;
}
}
- else CallChatEvent(SESSION_INITDONE, &gce);
+ else Chat_Control(m_szModuleName, sID, SESSION_INITDONE);
if (save.IsEmpty())
db_unset(NULL, m_szModuleName, "JTemp");
@@ -1425,11 +1405,9 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) setWString("JTemp", save.c_str());
db_free(&dbv);
}
- else CallChatEvent(SESSION_INITDONE, &gce);
+ else Chat_Control(m_szModuleName, sID, SESSION_INITDONE);
- gcd.iType = GC_EVENT_CONTROL;
- gce.pDest = &gcd;
- CallChatEvent(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, sID, SESSION_ONLINE);
}
}
}
@@ -1929,7 +1907,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) User = GetWord(m_whoReply.c_str(), 0);
}
- DoEvent(GC_EVENT_SETSTATUSEX, pmsg->parameters[1].c_str(), NULL, S.IsEmpty() ? NULL : S.c_str(), NULL, NULL, GC_SSE_TABDELIMITED, FALSE, FALSE);
+ Chat_SetStatusEx(m_szModuleName, pmsg->parameters[1], GC_SSE_TABDELIMITED, S.IsEmpty() ? NULL : S.c_str());
return true;
}
@@ -2281,9 +2259,7 @@ void CIrcProto::OnIrcDisconnected() sDisconn += TranslateT("*Disconnected*");
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, sDisconn.c_str(), NULL, NULL, NULL, true, false);
- GCDEST gcd = { m_szModuleName, 0, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, &gce);
+ Chat_Control(m_szModuleName, NULL, SESSION_OFFLINE);
if (!Miranda_Terminated())
CList_SetAllOffline(m_disconnectDCCChats);
@@ -2351,7 +2327,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) gci.iItem = i;
gci.pszModule = m_szModuleName;
if (!Chat_GetInfo(&gci) && gci.iType == GCW_CHATROOM) {
- CHANNELINFO *wi = (CHANNELINFO*)gci.dwItemData;
+ CHANNELINFO *wi = (CHANNELINFO*)gci.pItemData;
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", gci.pszName, wi->pszPassword);
else
@@ -2361,11 +2337,8 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) }
DoEvent(GC_EVENT_ADDGROUP, SERVERWINDOW, NULL, NULL, L"Normal", NULL, NULL, FALSE, TRUE);
- {
- GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_ONLINE, &gce);
- }
+
+ Chat_Control(m_szModuleName, SERVERWINDOW, SESSION_ONLINE);
CallFunctionAsync(sttMainThrdOnConnect, this);
nickflag = false;
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index 6cc5de8669..cf66f3273b 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -218,11 +218,9 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo CMStringW therest = GetWordAddress(text, 4);
if (command == L"/servershow" || command == L"/serverhide") {
- if (m_useServer) {
- GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(command == L"/servershow" ? WINDOW_VISIBLE : WINDOW_HIDDEN, &gce);
- }
+ if (m_useServer)
+ Chat_Control(m_szModuleName, SERVERWINDOW, command == L"/servershow" ? WINDOW_VISIBLE : WINDOW_HIDDEN);
+
return true;
}
@@ -250,9 +248,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo else
S = MakeWndID(window);
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(WINDOW_CLEARLOG, &gce);
+ Chat_Control(m_szModuleName, S, WINDOW_CLEARLOG);
return true;
}
@@ -466,7 +462,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo PostIrcMessage(L"/PART %s", window);
if ((one.IsEmpty() || !IsChannel(one))) {
- CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, window);
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", window, wi->pszPassword);
else
@@ -474,10 +470,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo return true;
}
- CMStringW S = MakeWndID(window);
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, &gce);
+ Chat_Terminate(m_szModuleName, MakeWndID(window));
PostIrcMessage(L"/JOIN %s", GetWordAddress(text, 1));
return true;
@@ -518,7 +511,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo CMStringW S = L"/ME " + DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
S.Replace(L"%", L"%%");
- DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
+ Chat_SendUserMessage(m_szModuleName, NULL, S);
return true;
}
@@ -528,7 +521,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo CMStringW S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
S.Replace(L"%", L"%%");
- DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
+ Chat_SendUserMessage(m_szModuleName, NULL, S);
return true;
}
@@ -683,7 +676,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo dci->iType = DCC_CHAT;
dci->bSender = true;
- CDccSession* dcc = new CDccSession(this, dci);
+ CDccSession *dcc = new CDccSession(this, dci);
CDccSession* olddcc = FindDCCSession(ccNew);
if (olddcc)
olddcc->Disconnect();
@@ -844,7 +837,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if (Message.IsEmpty())
return 0;
- CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, windowname, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, windowname);
int cp = (wi) ? wi->codepage : getCodepage();
// process the message
@@ -899,7 +892,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if (hContact) {
if (flag && bDCC) {
- CDccSession* dcc = FindDCCSession(hContact);
+ CDccSession *dcc = FindDCCSession(hContact);
if (dcc) {
FormatMsg(DoThis);
CMStringW mess = GetWordAddress(DoThis.c_str(), 2);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index d734c12ee4..36c9f09f40 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -443,7 +443,7 @@ void __cdecl CIrcProto::ThreadProc(void*) m_info.Reset(); } -void CIrcProto::AddDCCSession(MCONTACT, CDccSession* dcc) +void CIrcProto::AddDCCSession(MCONTACT, CDccSession *dcc) { mir_cslock lck(m_dcc); @@ -454,7 +454,7 @@ void CIrcProto::AddDCCSession(MCONTACT, CDccSession* dcc) m_dcc_chats.insert(dcc); } -void CIrcProto::AddDCCSession(DCCINFO*, CDccSession* dcc) +void CIrcProto::AddDCCSession(DCCINFO*, CDccSession *dcc) { mir_cslock lck(m_dcc); m_dcc_xfers.insert(dcc); @@ -471,7 +471,7 @@ void CIrcProto::RemoveDCCSession(MCONTACT hContact) } } -void CIrcProto::RemoveDCCSession(DCCINFO* pdci) +void CIrcProto::RemoveDCCSession(DCCINFO *pdci) { mir_cslock lck(m_dcc); @@ -494,7 +494,7 @@ CDccSession* CIrcProto::FindDCCSession(MCONTACT hContact) return 0; } -CDccSession* CIrcProto::FindDCCSession(DCCINFO* pdci) +CDccSession* CIrcProto::FindDCCSession(DCCINFO *pdci) { mir_cslock lck(m_dcc); @@ -718,7 +718,7 @@ unsigned long ConvertIPToInteger(char* IP) //////////////////////////////////////////////////////////////////// // initialize basic stuff needed for the dcc objects, also start a timer for checking the status of connections (timeouts) -CDccSession::CDccSession(CIrcProto* _pro, DCCINFO* pdci) : +CDccSession::CDccSession(CIrcProto* _pro, DCCINFO *pdci) : m_proto(_pro), NewFileName(0), dwWhatNeedsDoing(0), @@ -767,7 +767,7 @@ CDccSession::~CDccSession() // destroy all that needs destroying } if (di->iType == DCC_CHAT) { - CDccSession* dcc = m_proto->FindDCCSession(di->hContact); + CDccSession *dcc = m_proto->FindDCCSession(di->hContact); if (dcc && this == dcc) { m_proto->RemoveDCCSession(di->hContact); // objects automatically remove themselves from the list of objects m_proto->setWord(di->hContact, "Status", ID_STATUS_OFFLINE); @@ -1389,7 +1389,7 @@ VOID CALLBACK DCCTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) // helper function for incoming dcc connections. void DoIncomingDcc(HANDLE hConnection, DWORD dwRemoteIP, void * p1) { - CDccSession* dcc = (CDccSession*)p1; + CDccSession *dcc = (CDccSession*)p1; dcc->IncomingConnection(hConnection, dwRemoteIP); } diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h index 4e46810551..4c0395e3f6 100644 --- a/protocols/IRCG/src/irclib.h +++ b/protocols/IRCG/src/irclib.h @@ -145,7 +145,7 @@ protected: public:
- CDccSession(CIrcProto*, DCCINFO* pdci); // constructor
+ CDccSession(CIrcProto*, DCCINFO *pdci); // constructor
~CDccSession(); // destructor, что характерно
time_t tLastPercentageUpdate; // time of last update of the filetransfer dialog
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index c625469aec..f80950ae5f 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -193,7 +193,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) nlu.ptszDescriptiveName = name;
hNetlibDCC = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- GCREGISTER gcr = { sizeof(GCREGISTER) };
+ GCREGISTER gcr = {};
gcr.dwFlags = GC_CHANMGR | GC_BOLD | GC_ITALICS | GC_UNDERLINE | GC_COLOR | GC_BKGCOLOR;
gcr.nColors = 16;
gcr.pColors = colors;
@@ -204,19 +204,17 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook);
- GCSESSION gcw = { sizeof(GCSESSION) };
+ GCSESSION gcw = {};
gcw.iType = GCW_SERVER;
gcw.ptszID = SERVERWINDOW;
gcw.pszModule = m_szModuleName;
gcw.ptszName = NEWWSTR_ALLOCA((wchar_t*)_A2T(m_network));
Chat_NewSession(&gcw);
- GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
if (m_useServer && !m_hideServerWindow)
- CallChatEvent(WINDOW_VISIBLE, &gce);
+ Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_VISIBLE);
else
- CallChatEvent(WINDOW_HIDDEN, &gce);
+ Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_HIDDEN);
wchar_t szTemp[MAX_PATH];
mir_snwprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
@@ -357,7 +355,7 @@ HANDLE __cdecl CIrcProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* s di->sPath = szPath;
di->sFileAndPath = di->sPath + di->sFile;
- CDccSession* dcc = new CDccSession(this, di);
+ CDccSession *dcc = new CDccSession(this, di);
AddDCCSession(di, dcc);
dcc->Connect();
return di;
@@ -370,7 +368,7 @@ int __cdecl CIrcProto::FileCancel(MCONTACT, HANDLE hTransfer) {
DCCINFO* di = (DCCINFO*)hTransfer;
- CDccSession* dcc = FindDCCSession(di);
+ CDccSession *dcc = FindDCCSession(di);
if (dcc) {
InterlockedExchange(&dcc->dwWhatNeedsDoing, (long)FILERESUME_CANCEL);
SetEvent(dcc->hEvent);
@@ -398,7 +396,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** long i = (long)*action;
- CDccSession* dcc = FindDCCSession(di);
+ CDccSession *dcc = FindDCCSession(di);
if (dcc) {
InterlockedExchange(&dcc->dwWhatNeedsDoing, i);
if (*action == FILERESUME_RENAME) {
@@ -573,7 +571,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** dci->dwSize = size;
// create new dcc object
- CDccSession* dcc = new CDccSession(this, dci);
+ CDccSession *dcc = new CDccSession(this, dci);
// keep track of all objects created
AddDCCSession(dci, dcc);
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 5c208d2ec5..226eeb971e 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -177,7 +177,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam) CLISTEVENT* pcle = (CLISTEVENT*)lParam;
if (getByte(pcle->hContact, "DCC", 0) != 0) {
- DCCINFO* pdci = (DCCINFO*)pcle->lParam;
+ DCCINFO *pdci = (DCCINFO*)pcle->lParam;
CMessageBoxDlg* dlg = new CMessageBoxDlg(this, pdci);
dlg->Show();
HWND hWnd = dlg->GetHwnd();
@@ -201,21 +201,19 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM) if (!getWString(hContact, "Nick", &dbv)) {
int type = getByte(hContact, "ChatRoom", 0);
if (type != 0) {
- CMStringW S = L"";
+ CMStringW S;
if (type == GCW_CHATROOM)
S = MakeWndID(dbv.ptszVal);
if (type == GCW_SERVER)
S = SERVERWINDOW;
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- int i = CallChatEvent(SESSION_TERMINATE, &gce);
+ int i = Chat_Terminate(m_szModuleName, S, false);
if (i && type == GCW_CHATROOM)
PostIrcMessage(L"/PART %s %s", dbv.ptszVal, m_userInfo);
}
else {
BYTE bDCC = getByte((MCONTACT)wp, "DCC", 0);
if (bDCC) {
- CDccSession* dcc = FindDCCSession((MCONTACT)wp);
+ CDccSession *dcc = FindDCCSession((MCONTACT)wp);
if (dcc)
dcc->Disconnect();
}
@@ -249,11 +247,7 @@ INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM wp, LPARAM) if (!getWString((MCONTACT)wp, "Nick", &dbv)) {
if (getByte((MCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM) {
PostIrcMessage(L"/PART %s %s", dbv.ptszVal, m_userInfo);
-
- CMStringW S = MakeWndID(dbv.ptszVal);
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, &gce);
+ Chat_Terminate(m_szModuleName, MakeWndID(dbv.ptszVal));
}
db_free(&dbv);
}
@@ -290,7 +284,7 @@ INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM wp, LPARAM) INT_PTR __cdecl CIrcProto::OnMenuDisconnect(WPARAM wp, LPARAM)
{
- CDccSession* dcc = FindDCCSession((MCONTACT)wp);
+ CDccSession *dcc = FindDCCSession((MCONTACT)wp);
if (dcc)
dcc->Disconnect();
return 0;
@@ -367,9 +361,7 @@ INT_PTR __cdecl CIrcProto::OnShowListMenuCommand(WPARAM, LPARAM) INT_PTR __cdecl CIrcProto::OnShowServerMenuCommand(WPARAM, LPARAM)
{
- GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(WINDOW_VISIBLE, &gce);
+ Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_VISIBLE);
return 0;
}
@@ -531,13 +523,9 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case 3:
PostIrcMessage(L"/PART %s %s", p1, m_userInfo);
- {
- S = MakeWndID(p1);
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, &gce);
- }
+ Chat_Terminate(m_szModuleName, MakeWndID(p1));
break;
+
case 4: // show server window
PostIrcMessageWnd(p1, NULL, L"/SERVERSHOW");
break;
@@ -856,14 +844,14 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) ulAdr = ConvertIPToInteger(m_mySpecifiedHostIP);
else
ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
- gcmi->Item[23].bDisabled = ulAdr == 0 ? TRUE : FALSE; //DCC submenu
+ gcmi->Item[23].bDisabled = ulAdr == 0 ? TRUE : FALSE; // DCC submenu
wchar_t stzChanName[100];
const wchar_t* temp = wcschr(gcmi->pszID, ' ');
size_t len = min(((temp == NULL) ? mir_wstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), _countof(stzChanName) - 1);
mir_wstrncpy(stzChanName, gcmi->pszID, len);
stzChanName[len] = 0;
- CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, stzChanName, NULL, NULL, NULL, NULL, NULL, false, false, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, stzChanName);
BOOL bServOwner = strchr(sUserModes.c_str(), 'q') == NULL ? FALSE : TRUE;
BOOL bServAdmin = strchr(sUserModes.c_str(), 'a') == NULL ? FALSE : TRUE;
BOOL bOwner = bServOwner ? ((wi->OwnMode >> 4) & 01) : FALSE;
@@ -1002,7 +990,7 @@ void __cdecl CIrcProto::ConnectServerThread(void*) if (m_mySpecifiedHost[0])
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(m_mySpecifiedHost, IP_MANUAL));
- DoEvent(GC_EVENT_CHANGESESSIONAME, SERVERWINDOW, NULL, m_info.sNetwork.c_str(), NULL, NULL, NULL, FALSE, TRUE);
+ Chat_ChangeSessionName(m_szModuleName, SERVERWINDOW, m_info.sNetwork);
}
else {
Temp = m_iDesiredStatus;
@@ -1066,9 +1054,7 @@ void CIrcProto::DisconnectFromServer(void) if (m_perform && IsConnected())
DoPerform("Event: Disconnect");
- GCDEST gcd = { m_szModuleName, 0, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, &gce);
+ Chat_Terminate(m_szModuleName, NULL);
ForkThread(&CIrcProto::DisconnectServerThread, 0);
}
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index e3190007ca..e28616db4e 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -97,23 +97,26 @@ struct CIrcProto; // special service for tweaking performance, implemented in chat.dll
#define MS_GC_GETEVENTPTR "GChat/GetNewEventPtr"
typedef int (*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
-typedef struct {
+typedef struct
+{
GETEVENTFUNC pfnAddEvent;
}
- GCPTRS;
+GCPTRS;
#define IP_AUTO 1
#define IP_MANUAL 2
struct IPRESOLVE // Contains info about the channels
{
- IPRESOLVE( const char* _addr, int _type ) :
- sAddr( _addr ),
- iType( _type )
- {}
+ IPRESOLVE(const char* _addr, int _type) :
+ sAddr(_addr),
+ iType(_type)
+ {
+ }
~IPRESOLVE()
- {}
+ {
+ }
CMStringA sAddr;
int iType;
@@ -144,13 +147,15 @@ struct SERVER_INFO // Contains info about different servers struct PERFORM_INFO // Contains 'm_perform buffer' for different networks
{
- PERFORM_INFO( const char* szSetting, const wchar_t* value ) :
- mSetting( szSetting ),
- mText( value )
- {}
+ PERFORM_INFO(const char* szSetting, const wchar_t* value) :
+ mSetting(szSetting),
+ mText(value)
+ {
+ }
~PERFORM_INFO()
- {}
+ {
+ }
CMStringA mSetting;
CMStringW mText;
@@ -186,14 +191,15 @@ using namespace irc; /////////////////////////////////////////////////////////////////////////////////////////
-typedef bool (CIrcProto::*PfnIrcMessageHandler)(const CIrcMessage* pmsg);
+typedef bool (CIrcProto::*PfnIrcMessageHandler)(const CIrcMessage *pmsg);
struct CIrcHandler
{
- CIrcHandler( const wchar_t* _name, PfnIrcMessageHandler _handler ) :
- m_name( _name ),
- m_handler( _handler )
- {}
+ CIrcHandler(const wchar_t* _name, PfnIrcMessageHandler _handler) :
+ m_name(_name),
+ m_handler(_handler)
+ {
+ }
const wchar_t* m_name;
PfnIrcMessageHandler m_handler;
@@ -201,22 +207,22 @@ struct CIrcHandler struct CIrcProto : public PROTO<CIrcProto>
{
- CIrcProto(const char*, const wchar_t*);
- ~CIrcProto();
+ CIrcProto(const char*, const wchar_t*);
+ ~CIrcProto();
- // Protocol interface
+ // Protocol interface
- virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr );
+ virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
virtual int __cdecl Authorize(MEVENT hDbEvent);
virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath);
- virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer );
+ virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason);
- virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const wchar_t **szFilename);
+ virtual int __cdecl FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename);
- virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL);
+ virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
@@ -240,10 +246,10 @@ struct CIrcProto : public PROTO<CIrcProto> INT_PTR __cdecl OnJoinMenuCommand(WPARAM, LPARAM);
INT_PTR __cdecl OnLeaveChat(WPARAM, LPARAM);
INT_PTR __cdecl OnMenuChanSettings(WPARAM, LPARAM);
- INT_PTR __cdecl OnMenuDisconnect( WPARAM , LPARAM );
+ INT_PTR __cdecl OnMenuDisconnect(WPARAM, LPARAM);
INT_PTR __cdecl OnMenuIgnore(WPARAM, LPARAM);
INT_PTR __cdecl OnMenuWhois(WPARAM, LPARAM);
- INT_PTR __cdecl OnQuickConnectMenuCommand(WPARAM, LPARAM );
+ INT_PTR __cdecl OnQuickConnectMenuCommand(WPARAM, LPARAM);
INT_PTR __cdecl OnShowListMenuCommand(WPARAM, LPARAM);
INT_PTR __cdecl OnShowServerMenuCommand(WPARAM, LPARAM);
@@ -262,25 +268,25 @@ struct CIrcProto : public PROTO<CIrcProto> // Data
char m_serverName[100];
- char m_password [500];
- wchar_t m_identSystem[10];
+ char m_password[500];
+ wchar_t m_identSystem[10];
char m_network[30];
char m_portStart[10];
char m_portEnd[10];
int m_iSSL;
- wchar_t m_identPort[10];
- wchar_t m_nick[30], m_pNick[30];
- wchar_t m_alternativeNick[30];
- wchar_t m_name[200];
- wchar_t m_userID[200];
- wchar_t m_quitMessage[400];
- wchar_t m_userInfo[500];
+ wchar_t m_identPort[10];
+ wchar_t m_nick[30], m_pNick[30];
+ wchar_t m_alternativeNick[30];
+ wchar_t m_name[200];
+ wchar_t m_userID[200];
+ wchar_t m_quitMessage[400];
+ wchar_t m_userInfo[500];
char m_myHost[50];
char m_mySpecifiedHost[500];
char m_mySpecifiedHostIP[50];
char m_myLocalHost[50];
WORD m_myLocalPort;
- wchar_t* m_alias;
+ wchar_t *m_alias;
int m_serverComboSelection;
int m_quickComboSelection;
int m_onlineNotificationTime;
@@ -345,28 +351,26 @@ struct CIrcProto : public PROTO<CIrcProto> bool bPerformDone;
- CJoinDlg* m_joinDlg;
- CListDlg* m_listDlg;
- CManagerDlg* m_managerDlg;
- CNickDlg* m_nickDlg;
- CWhoisDlg* m_whoisDlg;
- CQuickDlg* m_quickDlg;
- CIgnorePrefsDlg* m_ignoreDlg;
+ CJoinDlg *m_joinDlg;
+ CListDlg *m_listDlg;
+ CNickDlg *m_nickDlg;
+ CWhoisDlg *m_whoisDlg;
+ CQuickDlg *m_quickDlg;
+ CManagerDlg *m_managerDlg;
+ CIgnorePrefsDlg *m_ignoreDlg;
int m_noOfChannels, m_manualWhoisCount;
CMStringA sChannelModes, sUserModes;
CMStringW sChannelPrefixes, sUserModePrefixes, WhoisAwayReply;
- //clist.cpp
+ // clist.cpp
MCONTACT CList_AddContact(CONTACT *user, bool InList, bool SetOnline);
bool CList_SetAllOffline(BYTE ChatsToo);
MCONTACT CList_SetOffline(CONTACT *user);
-
- bool CList_AddEvent(CONTACT *user, HICON Icon, HANDLE event, const char *tooltip, int type );
MCONTACT CList_FindContact(CONTACT *user);
BOOL CList_AddDCCChat(const CMStringW &name, const CMStringW &hostmask, unsigned long adr, int port);
- //commandmonitor.cpp
+ // commandmonitor.cpp
UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3;
int AddOutgoingMessageToDB(MCONTACT hContact, wchar_t *msg);
@@ -374,18 +378,18 @@ struct CIrcProto : public PROTO<CIrcProto> int DoPerform(const char *event);
void __cdecl ResolveIPThread(void *di);
- bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network) ;
+ bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network);
int IsIgnored(const CMStringW &nick, const CMStringW &address, const CMStringW &host, char type);
int IsIgnored(CMStringW user, char type);
- bool RemoveIgnore(const wchar_t *mask) ;
+ bool RemoveIgnore(const wchar_t *mask);
- //input.cpp
- CMStringW DoAlias( const wchar_t *text, wchar_t *window);
- BOOL DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact);
+ // input.cpp
+ CMStringW DoAlias(const wchar_t *text, wchar_t *window);
+ BOOL DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact);
CMStringW DoIdentifiers(CMStringW text, const wchar_t *window);
- void FormatMsg(CMStringW &text);
- bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf);
- bool PostIrcMessage(const wchar_t *fmt, ...);
+ void FormatMsg(CMStringW &text);
+ bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf);
+ bool PostIrcMessage(const wchar_t *fmt, ...);
// irclib.cpp
UINT_PTR DCCTimer;
@@ -404,12 +408,12 @@ struct CIrcProto : public PROTO<CIrcProto> OBJLIST<CIrcIgnoreItem> m_ignoreItems;
- int m_channelNumber;
+ int m_channelNumber;
CMStringW m_whoReply;
CMStringW sNamesList;
CMStringW sTopic;
CMStringW sTopicName;
- CMStringW sTopicTime;
+ CMStringW sTopicTime;
CMStringW m_namesToWho;
CMStringW m_channelsToWho;
CMStringW m_namesToUserhost;
@@ -417,18 +421,18 @@ struct CIrcProto : public PROTO<CIrcProto> void InitPrefs(void);
void InitIgnore(void);
- void ReadSettings( TDbSetting* sets, int count );
- void RewriteIgnoreSettings( void );
- void WriteSettings( TDbSetting* sets, int count );
+ void ReadSettings(TDbSetting* sets, int count);
+ void RewriteIgnoreSettings(void);
+ void WriteSettings(TDbSetting* sets, int count);
- //output
- BOOL ShowMessage (const CIrcMessage* pmsg);
+ // output
+ BOOL ShowMessage(const CIrcMessage *pmsg);
- //scripting.cpp
- INT_PTR __cdecl Scripting_InsertRawIn(WPARAM wParam,LPARAM lParam);
- INT_PTR __cdecl Scripting_InsertRawOut(WPARAM wParam,LPARAM lParam);
- INT_PTR __cdecl Scripting_InsertGuiIn(WPARAM wParam,LPARAM lParam);
- INT_PTR __cdecl Scripting_InsertGuiOut(WPARAM wParam,LPARAM lParam);
+ // scripting.cpp
+ INT_PTR __cdecl Scripting_InsertRawIn(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl Scripting_InsertRawOut(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl Scripting_InsertGuiIn(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl Scripting_InsertGuiOut(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl Scripting_GetIrcData(WPARAM wparam, LPARAM lparam);
// services.cpp
@@ -436,59 +440,55 @@ struct CIrcProto : public PROTO<CIrcProto> void DisconnectFromServer(void);
void InitMainMenus(void);
- void __cdecl ConnectServerThread( void* );
- void __cdecl DisconnectServerThread( void* );
-
- //tools.cpp
- void AddToJTemp(wchar_t op, CMStringW& sCommand);
- bool AddWindowItemData(CMStringW window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic);
- INT_PTR CallChatEvent(WPARAM wParam, GCEVENT *);
- INT_PTR DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick, const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe,time_t timestamp = 1);
- void FindLocalIP(HANDLE con);
- bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis);
- bool IsChannel(const char* sName);
- bool IsChannel(const wchar_t* sName);
- void KillChatTimer(UINT_PTR &nIDEvent);
+ void __cdecl ConnectServerThread(void*);
+ void __cdecl DisconnectServerThread(void*);
+
+ // tools.cpp
+ void AddToJTemp(wchar_t op, CMStringW& sCommand);
+ bool AddWindowItemData(CMStringW window, const wchar_t *pszLimit, const wchar_t *pszMode, const wchar_t *pszPassword, const wchar_t *pszTopic);
+ INT_PTR DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *pszNick, const wchar_t *pszText, const wchar_t *pszStatus, const wchar_t *pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp = 1);
+ void FindLocalIP(HANDLE con);
+ bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis);
+ bool IsChannel(const char* sName);
+ bool IsChannel(const wchar_t* sName);
+ void KillChatTimer(UINT_PTR &nIDEvent);
CMStringW MakeWndID(const wchar_t* sWindow);
CMStringW ModeToStatus(int sMode);
CMStringW PrefixToStatus(int cPrefix);
- int SetChannelSBText(CMStringW sWindow, CHANNELINFO * wi);
- void SetChatTimer(UINT_PTR &nIDEvent,UINT uElapse, TIMERPROC lpTimerFunc);
+ int SetChannelSBText(CMStringW sWindow, CHANNELINFO *wi);
+ void SetChatTimer(UINT_PTR &nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc);
- void ClearUserhostReasons(int type);
- void DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, CMStringW userhostparams, ...);
+ void ClearUserhostReasons(int type);
+ void DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, CMStringW userhostparams, ...);
CMStringW GetNextUserhostReason(int type);
CMStringW PeekAtReasons(int type);
- // userinfo.cpp
- void __cdecl AckUserInfoSearch( void* hContact );
-
////////////////////////////////////////////////////////////////////////////////////////
// former CIrcSession class
- void AddDCCSession(MCONTACT hContact, CDccSession* dcc);
- void AddDCCSession(DCCINFO* pdci, CDccSession* dcc);
+ void AddDCCSession(MCONTACT hContact, CDccSession *dcc);
+ void AddDCCSession(DCCINFO *pdci, CDccSession *dcc);
void RemoveDCCSession(MCONTACT hContact);
- void RemoveDCCSession(DCCINFO* pdci);
+ void RemoveDCCSession(DCCINFO *pdci);
CDccSession* FindDCCSession(MCONTACT hContact);
- CDccSession* FindDCCSession(DCCINFO* pdci);
+ CDccSession* FindDCCSession(DCCINFO *pdci);
CDccSession* FindDCCSendByPort(int iPort);
- CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t* szName);
+ CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t *szName);
CDccSession* FindPassiveDCCSend(int iToken);
CDccSession* FindPassiveDCCRecv(CMStringW sName, CMStringW sToken);
void DisconnectAllDCCSessions(bool Shutdown);
void CheckDCCTimeout(void);
- bool Connect(const CIrcSessionInfo& info);
+ bool Connect(const CIrcSessionInfo &info);
void Disconnect(void);
void KillIdent(void);
int NLSend(const wchar_t* fmt, ...);
int NLSend(const char* fmt, ...);
int NLSend(const unsigned char* buf, int cbBuf);
- int NLSendNoScript( const unsigned char* buf, int cbBuf);
+ int NLSendNoScript(const unsigned char* buf, int cbBuf);
int NLReceive(unsigned char* buf, int cbBuf);
void InsertIncomingEvent(wchar_t* pszRaw);
@@ -496,11 +496,11 @@ struct CIrcProto : public PROTO<CIrcProto> // send-to-stream operators
int getCodepage() const;
- __inline void setCodepage( int aPage ) { codepage = aPage; }
+ __inline void setCodepage(int aPage) { codepage = aPage; }
CIrcSessionInfo m_info;
-protected :
+protected:
int codepage;
HANDLE con;
HANDLE hBindPort;
@@ -508,74 +508,74 @@ protected : LIST<CDccSession> m_dcc_chats;
LIST<CDccSession> m_dcc_xfers;
-private :
+private:
mir_cs m_dcc; // protect the dcc objects
- void createMessageFromPchar( const char* p );
- void Notify(const CIrcMessage* pmsg);
- void __cdecl ThreadProc( void *pparam );
+ void createMessageFromPchar(const char* p);
+ void Notify(const CIrcMessage *pmsg);
+ void __cdecl ThreadProc(void *pparam);
////////////////////////////////////////////////////////////////////////////////////////
// former CIrcMonitor class
- bool OnIrc_PING(const CIrcMessage* pmsg);
- bool OnIrc_WELCOME(const CIrcMessage* pmsg);
- bool OnIrc_YOURHOST(const CIrcMessage* pmsg);
- bool OnIrc_NICK(const CIrcMessage* pmsg);
- bool OnIrc_PRIVMSG(const CIrcMessage* pmsg);
- bool OnIrc_JOIN(const CIrcMessage* pmsg);
- bool OnIrc_QUIT(const CIrcMessage* pmsg);
- bool OnIrc_PART(const CIrcMessage* pmsg);
- bool OnIrc_KICK(const CIrcMessage* pmsg);
- bool OnIrc_MODE(const CIrcMessage* pmsg);
- bool OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg);
- bool OnIrc_MODEQUERY(const CIrcMessage* pmsg);
- bool OnIrc_NAMES(const CIrcMessage* pmsg);
- bool OnIrc_ENDNAMES(const CIrcMessage* pmsg);
- bool OnIrc_INITIALTOPIC(const CIrcMessage* pmsg);
- bool OnIrc_INITIALTOPICNAME(const CIrcMessage* pmsg);
- bool OnIrc_TOPIC(const CIrcMessage* pmsg);
- bool OnIrc_TRYAGAIN(const CIrcMessage* pmsg);
- bool OnIrc_NOTICE(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_NAME(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_CHANNELS(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_SERVER(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_AWAY(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_END(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_AUTH(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg);
- bool OnIrc_NICK_ERR(const CIrcMessage* pmsg);
- bool OnIrc_ENDMOTD(const CIrcMessage* pmsg);
- bool OnIrc_LISTSTART(const CIrcMessage* pmsg);
- bool OnIrc_LIST(const CIrcMessage* pmsg);
- bool OnIrc_LISTEND(const CIrcMessage* pmsg);
- bool OnIrc_BANLIST(const CIrcMessage* pmsg);
- bool OnIrc_BANLISTEND(const CIrcMessage* pmsg);
- bool OnIrc_SUPPORT(const CIrcMessage* pmsg);
- bool OnIrc_BACKFROMAWAY(const CIrcMessage* pmsg);
- bool OnIrc_SETAWAY(const CIrcMessage* pmsg);
- bool OnIrc_JOINERROR(const CIrcMessage* pmsg);
- bool OnIrc_UNKNOWN(const CIrcMessage* pmsg);
- bool OnIrc_ERROR(const CIrcMessage* pmsg);
- bool OnIrc_NOOFCHANNELS(const CIrcMessage* pmsg);
- bool OnIrc_PINGPONG(const CIrcMessage* pmsg);
- bool OnIrc_INVITE(const CIrcMessage* pmsg);
- bool OnIrc_WHO_END(const CIrcMessage* pmsg);
- bool OnIrc_WHO_REPLY(const CIrcMessage* pmsg);
- bool OnIrc_WHOTOOLONG(const CIrcMessage* pmsg);
-
- bool IsCTCP(const CIrcMessage* pmsg);
-
- void OnIrcDefault(const CIrcMessage* pmsg);
+ bool OnIrc_PING(const CIrcMessage *pmsg);
+ bool OnIrc_WELCOME(const CIrcMessage *pmsg);
+ bool OnIrc_YOURHOST(const CIrcMessage *pmsg);
+ bool OnIrc_NICK(const CIrcMessage *pmsg);
+ bool OnIrc_PRIVMSG(const CIrcMessage *pmsg);
+ bool OnIrc_JOIN(const CIrcMessage *pmsg);
+ bool OnIrc_QUIT(const CIrcMessage *pmsg);
+ bool OnIrc_PART(const CIrcMessage *pmsg);
+ bool OnIrc_KICK(const CIrcMessage *pmsg);
+ bool OnIrc_MODE(const CIrcMessage *pmsg);
+ bool OnIrc_USERHOST_REPLY(const CIrcMessage *pmsg);
+ bool OnIrc_MODEQUERY(const CIrcMessage *pmsg);
+ bool OnIrc_NAMES(const CIrcMessage *pmsg);
+ bool OnIrc_ENDNAMES(const CIrcMessage *pmsg);
+ bool OnIrc_INITIALTOPIC(const CIrcMessage *pmsg);
+ bool OnIrc_INITIALTOPICNAME(const CIrcMessage *pmsg);
+ bool OnIrc_TOPIC(const CIrcMessage *pmsg);
+ bool OnIrc_TRYAGAIN(const CIrcMessage *pmsg);
+ bool OnIrc_NOTICE(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_NAME(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_CHANNELS(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_SERVER(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_AWAY(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_IDLE(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_END(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_OTHER(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_AUTH(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_NO_USER(const CIrcMessage *pmsg);
+ bool OnIrc_NICK_ERR(const CIrcMessage *pmsg);
+ bool OnIrc_ENDMOTD(const CIrcMessage *pmsg);
+ bool OnIrc_LISTSTART(const CIrcMessage *pmsg);
+ bool OnIrc_LIST(const CIrcMessage *pmsg);
+ bool OnIrc_LISTEND(const CIrcMessage *pmsg);
+ bool OnIrc_BANLIST(const CIrcMessage *pmsg);
+ bool OnIrc_BANLISTEND(const CIrcMessage *pmsg);
+ bool OnIrc_SUPPORT(const CIrcMessage *pmsg);
+ bool OnIrc_BACKFROMAWAY(const CIrcMessage *pmsg);
+ bool OnIrc_SETAWAY(const CIrcMessage *pmsg);
+ bool OnIrc_JOINERROR(const CIrcMessage *pmsg);
+ bool OnIrc_UNKNOWN(const CIrcMessage *pmsg);
+ bool OnIrc_ERROR(const CIrcMessage *pmsg);
+ bool OnIrc_NOOFCHANNELS(const CIrcMessage *pmsg);
+ bool OnIrc_PINGPONG(const CIrcMessage *pmsg);
+ bool OnIrc_INVITE(const CIrcMessage *pmsg);
+ bool OnIrc_WHO_END(const CIrcMessage *pmsg);
+ bool OnIrc_WHO_REPLY(const CIrcMessage *pmsg);
+ bool OnIrc_WHOTOOLONG(const CIrcMessage *pmsg);
+
+ bool IsCTCP(const CIrcMessage *pmsg);
+
+ void OnIrcDefault(const CIrcMessage *pmsg);
void OnIrcDisconnected();
static OBJLIST<CIrcHandler> m_handlers;
PfnIrcMessageHandler FindMethod(const wchar_t* lpszName);
- void OnIrcMessage(const CIrcMessage* pmsg);
+ void OnIrcMessage(const CIrcMessage *pmsg);
CMStringW sNick4Perform;
};
@@ -594,16 +594,14 @@ extern LIST<CIrcProto> g_Instances; extern OBJLIST<SERVER_INFO> g_servers;
-void UpgradeCheck(void);
-
-CIrcProto* GetTimerOwner( UINT_PTR eventId );
+CIrcProto* GetTimerOwner(UINT_PTR eventId);
-VOID CALLBACK IdentTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK TimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK KeepAliveTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK OnlineNotifTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK OnlineNotifTimerProc3( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK DCCTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
+VOID CALLBACK IdentTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK KeepAliveTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK OnlineNotifTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK OnlineNotifTimerProc3(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK DCCTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
// options.cpp
@@ -622,9 +620,9 @@ int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string); char* __stdcall IrcLoadFile(wchar_t * szPath);
CMStringW __stdcall GetWord(const wchar_t* text, int index);
const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index);
-void __stdcall RemoveLinebreaks( CMStringW& Message );
-wchar_t* __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2) ;
-wchar_t* __stdcall DoColorCodes (const wchar_t* text, bool bStrip, bool bReplacePercent);
+void __stdcall RemoveLinebreaks(CMStringW& Message);
+wchar_t* __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2);
+wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplacePercent);
CMStringA __stdcall GetWord(const char* text, int index);
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index c3a1c1e1a1..4b5159450f 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -376,28 +376,19 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP return szTemp;
}
-INT_PTR CIrcProto::CallChatEvent(WPARAM wParam, GCEVENT *lParam)
-{
- return Chat_Event(wParam, lParam);
-}
-
INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick,
const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo,
DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp)
{
GCDEST gcd = { m_szModuleName, NULL, iEvent };
CMStringW sID;
- CMStringW sText = L"";
+ CMStringW sText;
if (iEvent == GC_EVENT_INFORMATION && bIsMe && !bEcho)
return false;
- if (pszText) {
- if (iEvent != GC_EVENT_SENDMESSAGE)
- sText = DoColorCodes(pszText, FALSE, TRUE);
- else
- sText = pszText;
- }
+ if (pszText)
+ sText = DoColorCodes(pszText, FALSE, TRUE);
if (pszWindow) {
if (mir_wstrcmpi(pszWindow, SERVERWINDOW))
@@ -408,7 +399,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* }
else gcd.ptszID = NULL;
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszStatus = pszStatus;
gce.dwFlags = (bAddToLog) ? GCEF_ADDTOLOG : 0;
gce.ptszNick = pszNick;
@@ -427,7 +418,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* else
gce.time = timestamp;
gce.bIsMe = bIsMe;
- return CallChatEvent(0, &gce);
+ return Chat_Event(&gce);
}
CMStringW CIrcProto::ModeToStatus(int sMode)
@@ -542,7 +533,8 @@ int CIrcProto::SetChannelSBText(CMStringW sWindow, CHANNELINFO * wi) if (wi->pszTopic)
sTemp += wi->pszTopic;
sTemp = DoColorCodes(sTemp.c_str(), TRUE, FALSE);
- return DoEvent(GC_EVENT_SETSBTEXT, sWindow.c_str(), NULL, sTemp.c_str(), NULL, NULL, NULL, FALSE, FALSE, 0);
+ Chat_SetStatusbarText(m_szModuleName, sWindow, sTemp);
+ return 0;
}
CMStringW CIrcProto::MakeWndID(const wchar_t* sWindow)
@@ -552,11 +544,11 @@ CMStringW CIrcProto::MakeWndID(const wchar_t* sWindow) return CMStringW(buf);
}
-bool CIrcProto::FreeWindowItemData(CMStringW window, CHANNELINFO* wis)
+bool CIrcProto::FreeWindowItemData(CMStringW window, CHANNELINFO *wis)
{
CHANNELINFO *wi;
if (!wis)
- wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ wi = (CHANNELINFO*)Chat_GetUserInfo(m_szModuleName, window);
else
wi = wis;
if (wi) {
@@ -572,7 +564,7 @@ bool CIrcProto::FreeWindowItemData(CMStringW window, CHANNELINFO* wis) bool CIrcProto::AddWindowItemData(CMStringW window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic)
{
- CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, window);
if (wi) {
if (pszLimit) {
wi->pszLimit = (wchar_t*)realloc(wi->pszLimit, sizeof(wchar_t)*(mir_wstrlen(pszLimit) + 1));
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index 40c30af560..8c19b06bd8 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -1079,7 +1079,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) {
wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
- CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO*)Chat_GetUserInfo(m_proto->m_szModuleName, window);
if (wi) {
wchar_t toadd[10]; *toadd = '\0';
wchar_t toremove[10]; *toremove = '\0';
@@ -1274,7 +1274,7 @@ void CManagerDlg::InitManager(int mode, const wchar_t* window) {
SetDlgItemText(m_hwnd, IDC_CAPTION, window);
- CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_proto->m_szModuleName, window);
if (wi) {
if (m_proto->IsConnected()) {
wchar_t temp[1000];
|