diff options
Diffstat (limited to 'protocols/IRCG')
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 41 | ||||
-rw-r--r-- | protocols/IRCG/src/input.cpp | 14 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 208 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.h | 5 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 4 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.h | 42 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 12 | ||||
-rw-r--r-- | protocols/IRCG/src/tools.cpp | 26 | ||||
-rw-r--r-- | protocols/IRCG/src/windows.cpp | 4 |
9 files changed, 182 insertions, 174 deletions
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index ab9a7e646f..eb846b07af 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -371,7 +371,7 @@ bool CIrcProto::OnIrc_QUIT(const CIrcMessage *pmsg) CONTACT user = { pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, false, false, false };
CList_SetOffline(&user);
if (pmsg->prefix.sNick == m_info.sNick)
- Chat_Control(m_szModuleName, nullptr, SESSION_OFFLINE);
+ setAllContactStatuses(SESSION_OFFLINE, false);
}
else ShowMessage(pmsg);
@@ -384,7 +384,7 @@ bool CIrcProto::OnIrc_PART(const CIrcMessage *pmsg) CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
DoEvent(GC_EVENT_PART, pmsg->parameters[0], pmsg->prefix.sNick, pmsg->parameters.getCount() > 1 ? pmsg->parameters[1].c_str() : nullptr, nullptr, host, NULL, true, false);
if (pmsg->prefix.sNick == m_info.sNick)
- Chat_Control(m_szModuleName, pmsg->parameters[0], SESSION_OFFLINE);
+ Chat_Control(pmsg->parameters[0], SESSION_OFFLINE);
}
else ShowMessage(pmsg);
@@ -399,10 +399,10 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage *pmsg) ShowMessage(pmsg);
if (pmsg->parameters[1] == m_info.sNick) {
- Chat_Control(m_szModuleName, pmsg->parameters[0], SESSION_OFFLINE);
+ Chat_Control(pmsg->parameters[0], SESSION_OFFLINE);
if (m_rejoinIfKicked) {
- CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, pmsg->parameters[0]);
+ auto *wi = GetChannelInfo(pmsg->parameters[0]);
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", pmsg->parameters[0].c_str(), wi->pszPassword);
else
@@ -486,7 +486,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage *pmsg) if ((int)pmsg->parameters.getCount() > iParametercount) {
if (!mir_wstrcmp(pmsg->parameters[2], m_info.sNick)) {
char cModeBit = -1;
- CHANNELINFO *wi = (CHANNELINFO*)Chat_GetUserInfo(m_szModuleName, pmsg->parameters[0]);
+ auto *wi = GetChannelInfo(pmsg->parameters[0]);
switch (*p1) {
case 'v': cModeBit = 0; break;
case 'h': cModeBit = 1; break;
@@ -503,7 +503,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage *pmsg) wi->OwnMode &= ~(1 << cModeBit);
}
- Chat_SetUserInfo(m_szModuleName, pmsg->parameters[0], wi);
+ SetChannelInfo(pmsg->parameters[0], wi);
}
DoEvent(bAdd ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS, pmsg->parameters[0], pmsg->parameters[iParametercount], pmsg->prefix.sNick, sStatus, nullptr, NULL, m_oldStyleModes ? false : true, false);
iParametercount++;
@@ -569,7 +569,7 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage *pmsg) CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
DoEvent(GC_EVENT_NICK, nullptr, pmsg->prefix.sNick, pmsg->parameters[0], nullptr, host, NULL, true, bIsMe);
- Chat_ChangeUserId(m_szModuleName, nullptr, pmsg->prefix.sNick, pmsg->parameters[0]);
+ Chat_ChangeUserId(m_szModuleName, pmsg->prefix.sNick, pmsg->parameters[0]);
CONTACT user = { pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
@@ -1243,7 +1243,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage *pmsg) }
if (bFlag) {
- const wchar_t* sChanName = pmsg->parameters[1];
+ const wchar_t *sChanName = pmsg->parameters[1];
if (sChanName[0] == '@' || sChanName[0] == '*' || sChanName[0] == '=')
sChanName++;
@@ -1276,8 +1276,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage *pmsg) while (PrefixToStatus(sTemp[0]) != pwszNormal)
sTemp.Delete(0, 1);
- GCEVENT gce = { m_szModuleName, 0, GC_EVENT_JOIN };
- gce.pszID.w = sChanName;
+ GCEVENT gce = { si, GC_EVENT_JOIN };
gce.pszUID.w = sTemp;
gce.pszNick.w = sTemp;
gce.pszStatus.w = sStat;
@@ -1319,7 +1318,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage *pmsg) //Set the item data for the window
{
- CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, sChanName);
+ auto *wi = GetChannelInfo(sChanName);
if (!wi)
wi = new CHANNELINFO;
wi->OwnMode = btOwnMode;
@@ -1328,7 +1327,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage *pmsg) wi->pszPassword = nullptr;
wi->pszTopic = nullptr;
wi->codepage = getCodepage();
- Chat_SetUserInfo(m_szModuleName, sChanName, wi);
+ SetChannelInfo(sChanName, wi);
if (!sTopic.IsEmpty() && !mir_wstrcmpi(GetWord(sTopic, 0), sChanName)) {
DoEvent(GC_EVENT_TOPIC, sChanName, sTopicName.IsEmpty() ? nullptr : sTopicName.c_str(), GetWordAddress(sTopic, 1), nullptr, sTopicTime.IsEmpty() ? nullptr : sTopicTime.c_str(), NULL, true, false);
@@ -1361,17 +1360,17 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage *pmsg) save += GetWordAddress(dbv.pwszVal, k);
switch (command[0]) {
case 'M':
- Chat_Control(m_szModuleName, sChanName, WINDOW_HIDDEN);
+ ::Chat_Control(si, WINDOW_HIDDEN);
break;
case 'X':
- Chat_Control(m_szModuleName, sChanName, WINDOW_VISIBLE);
+ ::Chat_Control(si, WINDOW_VISIBLE);
break;
default:
- Chat_Control(m_szModuleName, sChanName, SESSION_INITDONE);
+ ::Chat_Control(si, SESSION_INITDONE);
break;
}
}
- else Chat_Control(m_szModuleName, sChanName, SESSION_INITDONE);
+ else ::Chat_Control(si, SESSION_INITDONE);
if (save.IsEmpty())
db_unset(0, m_szModuleName, "JTemp");
@@ -1379,9 +1378,9 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage *pmsg) setWString("JTemp", save);
db_free(&dbv);
}
- else Chat_Control(m_szModuleName, sChanName, SESSION_INITDONE);
+ else ::Chat_Control(si, SESSION_INITDONE);
- Chat_Control(m_szModuleName, sChanName, SESSION_ONLINE);
+ ::Chat_Control(si, SESSION_ONLINE);
}
}
}
@@ -1888,7 +1887,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage *pmsg) User = GetWord(m_whoReply, 0);
}
- Chat_SetStatusEx(m_szModuleName, pmsg->parameters[1], GC_SSE_TABDELIMITED, S.IsEmpty() ? nullptr : S.c_str());
+ Chat_SetStatusEx(Chat_Find(pmsg->parameters[1], m_szModuleName), GC_SSE_TABDELIMITED, S.IsEmpty() ? nullptr : S.c_str());
return true;
}
@@ -2278,7 +2277,7 @@ void CIrcProto::OnIrcDisconnected() sDisconn += TranslateT("*Disconnected*");
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, sDisconn, nullptr, nullptr, NULL, true, false);
- Chat_Control(m_szModuleName, nullptr, SESSION_OFFLINE);
+ setAllContactStatuses(SESSION_OFFLINE, false);
if (!Miranda_IsTerminated())
CList_SetAllOffline(m_disconnectDCCChats);
@@ -2355,7 +2354,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) }
Chat_AddGroup(m_pServer, TranslateT("Normal"));
- Chat_Control(m_szModuleName, SERVERWINDOW, SESSION_ONLINE);
+ Chat_Control(SERVERWINDOW, SESSION_ONLINE);
CallFunctionAsync(sttMainThrdOnConnect, this);
nickflag = false;
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index 51f856bbf5..80c1c1070c 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -219,7 +219,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo if (command == L"/servershow" || command == L"/serverhide") {
if (m_useServer)
- Chat_Control(m_szModuleName, SERVERWINDOW, command == L"/servershow" ? WINDOW_VISIBLE : WINDOW_HIDDEN);
+ Chat_Control(SERVERWINDOW, command == L"/servershow" ? WINDOW_VISIBLE : WINDOW_HIDDEN);
return true;
}
@@ -245,7 +245,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo }
else S = window;
- Chat_Control(m_szModuleName, S, WINDOW_CLEARLOG);
+ Chat_Control(S, WINDOW_CLEARLOG);
return true;
}
@@ -452,7 +452,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo PostIrcMessage(L"/PART %s", window);
if ((one.IsEmpty() || !IsChannel(one))) {
- CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, window);
+ auto *wi = GetChannelInfo(window);
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", window, wi->pszPassword);
else
@@ -460,7 +460,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo return true;
}
- Chat_Terminate(m_szModuleName, window);
+ Chat_Terminate(Chat_Find(window, m_szModuleName));
PostIrcMessage(L"/JOIN %s", GetWordAddress(text, 1));
return true;
@@ -497,7 +497,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"%%");
- Chat_SendUserMessage(m_szModuleName, nullptr, S);
+ Chat_SendUserMessage(m_szModuleName, S);
return true;
}
@@ -507,7 +507,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo CMStringW S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
S.Replace(L"%", L"%%");
- Chat_SendUserMessage(m_szModuleName, nullptr, S);
+ Chat_SendUserMessage(m_szModuleName, S);
return true;
}
@@ -823,7 +823,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if (Message.IsEmpty())
return 0;
- CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, windowname);
+ auto *wi = GetChannelInfo(windowname);
int cp = (wi) ? wi->codepage : getCodepage();
// process the message
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 6cf422882d..aedbe97af5 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -36,23 +36,23 @@ OBJLIST<CIrcHandler> CIrcProto::m_handlers( 30, CompareHandlers ); //////////////////////////////////////////////////////////////////// -CIrcMessage::CIrcMessage( CIrcProto* _pro, const wchar_t* lpszCmdLine, int codepage, bool bIncoming, bool bNotify ) : - m_proto( _pro ), - m_bIncoming( bIncoming ), - m_bNotify( bNotify ), - m_codePage( codepage ), - parameters( 10 ) +CIrcMessage::CIrcMessage(CIrcProto *_pro, const wchar_t *lpszCmdLine, int codepage, bool bIncoming, bool bNotify) : + m_proto(_pro), + m_bIncoming(bIncoming), + m_bNotify(bNotify), + m_codePage(codepage), + parameters(10) { ParseIrcCommand(lpszCmdLine); } -CIrcMessage::CIrcMessage(const CIrcMessage& m) : - sCommand( m.sCommand ), - m_bIncoming( m.m_bIncoming ), - m_bNotify( m.m_bNotify ), - m_codePage( m.m_codePage ), - m_proto( m.m_proto ), - parameters( m.parameters.getCount()) +CIrcMessage::CIrcMessage(const CIrcMessage &m) : + sCommand(m.sCommand), + m_bIncoming(m.m_bIncoming), + m_bNotify(m.m_bNotify), + m_codePage(m.m_codePage), + m_proto(m.m_proto), + parameters(m.parameters.getCount()) { prefix.sNick = m.prefix.sNick; prefix.sUser = m.prefix.sUser; @@ -63,8 +63,7 @@ CIrcMessage::CIrcMessage(const CIrcMessage& m) : } CIrcMessage::~CIrcMessage() -{ -} +{} void CIrcMessage::Reset() { @@ -96,10 +95,10 @@ CIrcMessage& CIrcMessage::operator=(const wchar_t* lpszCmdLine) return *this; } -void CIrcMessage::ParseIrcCommand(const wchar_t* lpszCmdLine) +void CIrcMessage::ParseIrcCommand(const wchar_t *lpszCmdLine) { - const wchar_t* p1 = lpszCmdLine; - const wchar_t* p2 = lpszCmdLine; + const wchar_t *p1 = lpszCmdLine; + const wchar_t *p2 = lpszCmdLine; // prefix exists ? if (*p1 == ':') { @@ -168,18 +167,18 @@ int CIrcProto::getCodepage() const return (con != nullptr) ? codepage : CP_ACP; } -void CIrcProto::SendIrcMessage(const wchar_t* msg, bool bNotify, int cp) +void CIrcProto::SendIrcMessage(const wchar_t *msg, bool bNotify, int cp) { if (cp == -1) cp = getCodepage(); if (this) { - char* str = mir_u2a_cp(msg, cp); + char *str = mir_u2a_cp(msg, cp); rtrim(str); int cbLen = (int)mir_strlen(str); - str = (char*)mir_realloc(str, cbLen + 3); + str = (char *)mir_realloc(str, cbLen + 3); mir_strcat(str, "\r\n"); - NLSend((const uint8_t*)str, cbLen + 2); + NLSend((const uint8_t *)str, cbLen + 2); mir_free(str); if (bNotify) { @@ -190,7 +189,7 @@ void CIrcProto::SendIrcMessage(const wchar_t* msg, bool bNotify, int cp) } } -bool CIrcProto::Connect(const CIrcSessionInfo& info) +bool CIrcProto::Connect(const CIrcSessionInfo &info) { codepage = m_codepage; @@ -268,23 +267,23 @@ void CIrcProto::Disconnect(void) m_info.Reset(); } -void CIrcProto::Notify(const CIrcMessage* pmsg) +void CIrcProto::Notify(const CIrcMessage *pmsg) { OnIrcMessage(pmsg); } -int CIrcProto::NLSend(const unsigned char* buf, int cbBuf) +int CIrcProto::NLSend(const unsigned char *buf, int cbBuf) { if (!con || !buf) return 0; - + if (cbBuf == 0) cbBuf = (int)mir_strlen((const char *)buf); - - return Netlib_Send(con, (const char*)buf, cbBuf, MSG_DUMPASTEXT); + + return Netlib_Send(con, (const char *)buf, cbBuf, MSG_DUMPASTEXT); } -int CIrcProto::NLSend(const wchar_t* fmt, ...) +int CIrcProto::NLSend(const wchar_t *fmt, ...) { va_list marker; va_start(marker, fmt); @@ -293,13 +292,13 @@ int CIrcProto::NLSend(const wchar_t* fmt, ...) mir_vsnwprintf(szBuf, _countof(szBuf), fmt, marker); va_end(marker); - char* buf = mir_u2a_cp(szBuf, getCodepage()); - int result = NLSend((unsigned char*)buf, (int)mir_strlen(buf)); + char *buf = mir_u2a_cp(szBuf, getCodepage()); + int result = NLSend((unsigned char *)buf, (int)mir_strlen(buf)); mir_free(buf); return result; } -int CIrcProto::NLSend(const char* fmt, ...) +int CIrcProto::NLSend(const char *fmt, ...) { va_list marker; va_start(marker, fmt); @@ -308,20 +307,20 @@ int CIrcProto::NLSend(const char* fmt, ...) int cbLen = mir_vsnprintf(szBuf, _countof(szBuf), fmt, marker); va_end(marker); - return NLSend((unsigned char*)szBuf, cbLen); + return NLSend((unsigned char *)szBuf, cbLen); } -int CIrcProto::NLSendNoScript(const unsigned char* buf, int cbBuf) +int CIrcProto::NLSendNoScript(const unsigned char *buf, int cbBuf) { if (con) - return Netlib_Send(con, (const char*)buf, cbBuf, MSG_DUMPASTEXT); + return Netlib_Send(con, (const char *)buf, cbBuf, MSG_DUMPASTEXT); return 0; } -int CIrcProto::NLReceive(unsigned char* buf, int cbBuf) +int CIrcProto::NLReceive(unsigned char *buf, int cbBuf) { - return Netlib_Recv(con, (char*)buf, cbBuf, MSG_DUMPASTEXT); + return Netlib_Recv(con, (char *)buf, cbBuf, MSG_DUMPASTEXT); } void CIrcProto::KillIdent() @@ -333,7 +332,7 @@ void CIrcProto::KillIdent() } } -void CIrcProto::InsertIncomingEvent(wchar_t* pszRaw) +void CIrcProto::InsertIncomingEvent(wchar_t *pszRaw) { CIrcMessage msg(this, pszRaw, true); Notify(&msg); @@ -349,7 +348,7 @@ void CIrcProto::DoReceive() nb.pfnNewConnection = DoIdent; nb.pExtra = this; nb.wPort = m_info.iIdentServerPort; - + hBindPort = Netlib_BindPort(m_hNetlibUser, &nb); if (!hBindPort || nb.wPort != m_info.iIdentServerPort) { debugLogA("Error: unable to bind local port %u", m_info.iIdentServerPort); @@ -360,16 +359,16 @@ void CIrcProto::DoReceive() while (con) { int nLinesProcessed = 0; - int cbRead = NLReceive((unsigned char*)chBuf + cbInBuf, sizeof(chBuf)-cbInBuf - 1); + int cbRead = NLReceive((unsigned char *)chBuf + cbInBuf, sizeof(chBuf) - cbInBuf - 1); if (cbRead <= 0) break; cbInBuf += cbRead; chBuf[cbInBuf] = 0; - char* pStart = chBuf; + char *pStart = chBuf; while (*pStart) { - char* pEnd; + char *pEnd; // seek end-of-line for (pEnd = pStart; *pEnd && *pEnd != '\r' && *pEnd != '\n'; ++pEnd) @@ -388,7 +387,7 @@ void CIrcProto::DoReceive() ptrW ptszMsg; if (codepage != CP_UTF8 && m_utfAutodetect && Utf8CheckString(pStart)) ptszMsg = mir_utf8decodeW(pStart); - + if (ptszMsg == nullptr) ptszMsg = mir_a2u_cp(pStart, codepage); @@ -414,7 +413,7 @@ void CIrcProto::DoReceive() Notify(nullptr); } -void __cdecl CIrcProto::ThreadProc(void*) +void __cdecl CIrcProto::ThreadProc(void *) { Thread_SetName("IRC: CIrcProto"); DoReceive(); @@ -425,14 +424,14 @@ void CIrcProto::AddDCCSession(MCONTACT, CDccSession *dcc) { mir_cslock lck(m_dcc); - CDccSession* p = m_dcc_chats.find(dcc); + CDccSession *p = m_dcc_chats.find(dcc); if (p) m_dcc_chats.remove(p); 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); @@ -461,7 +460,7 @@ void CIrcProto::RemoveDCCSession(DCCINFO *pdci) } } -CDccSession* CIrcProto::FindDCCSession(MCONTACT hContact) +CDccSession *CIrcProto::FindDCCSession(MCONTACT hContact) { mir_cslock lck(m_dcc); @@ -472,7 +471,7 @@ CDccSession* CIrcProto::FindDCCSession(MCONTACT hContact) return nullptr; } -CDccSession* CIrcProto::FindDCCSession(DCCINFO *pdci) +CDccSession *CIrcProto::FindDCCSession(DCCINFO *pdci) { mir_cslock lck(m_dcc); @@ -483,7 +482,7 @@ CDccSession* CIrcProto::FindDCCSession(DCCINFO *pdci) return nullptr; } -CDccSession* CIrcProto::FindDCCSendByPort(int iPort) +CDccSession *CIrcProto::FindDCCSendByPort(int iPort) { mir_cslock lck(m_dcc); @@ -494,7 +493,7 @@ CDccSession* CIrcProto::FindDCCSendByPort(int iPort) return nullptr; } -CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szName) +CDccSession *CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t *szName) { mir_cslock lck(m_dcc); @@ -512,7 +511,7 @@ CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szNam return nullptr; } -CDccSession* CIrcProto::FindPassiveDCCSend(int iToken) +CDccSession *CIrcProto::FindPassiveDCCSend(int iToken) { mir_cslock lck(m_dcc); @@ -523,7 +522,7 @@ CDccSession* CIrcProto::FindPassiveDCCSend(int iToken) return nullptr; } -CDccSession* CIrcProto::FindPassiveDCCRecv(CMStringW sName, CMStringW sToken) +CDccSession *CIrcProto::FindPassiveDCCRecv(CMStringW sName, CMStringW sToken) { mir_cslock lck(m_dcc); @@ -558,21 +557,18 @@ void CIrcProto::CheckDCCTimeout(void) //////////////////////////////////////////////////////////////////// -CIrcIgnoreItem::CIrcIgnoreItem(const wchar_t* _mask, const wchar_t* _flags) : +CIrcIgnoreItem::CIrcIgnoreItem(const wchar_t *_mask, const wchar_t *_flags) : mask(_mask), flags(_flags) -{ -} +{} -CIrcIgnoreItem::CIrcIgnoreItem(int codepage, const char* _mask, const char* _flags) : - mask((wchar_t*)_A2T(_mask, codepage)), - flags((wchar_t*)_A2T(_flags, codepage)) -{ -} +CIrcIgnoreItem::CIrcIgnoreItem(int codepage, const char *_mask, const char *_flags) : + mask((wchar_t *)_A2T(_mask, codepage)), + flags((wchar_t *)_A2T(_flags, codepage)) +{} CIrcIgnoreItem::~CIrcIgnoreItem() -{ -} +{} //////////////////////////////////////////////////////////////////// @@ -580,10 +576,9 @@ CIrcSessionInfo::CIrcSessionInfo() : iPort(0), bIdentServer(false), iIdentServerPort(0) -{ -} +{} -CIrcSessionInfo::CIrcSessionInfo(const CIrcSessionInfo& si) : +CIrcSessionInfo::CIrcSessionInfo(const CIrcSessionInfo &si) : sServer(si.sServer), sServerName(si.sServerName), iPort(si.iPort), @@ -595,8 +590,7 @@ CIrcSessionInfo::CIrcSessionInfo(const CIrcSessionInfo& si) : m_iSSL(si.m_iSSL), sIdentServerType(si.sIdentServerType), iIdentServerPort(si.iIdentServerPort) -{ -} +{} void CIrcSessionInfo::Reset() { @@ -616,7 +610,7 @@ void CIrcSessionInfo::Reset() //////////////////////////////////////////////////////////////////// -void CIrcProto::OnIrcMessage(const CIrcMessage* pmsg) +void CIrcProto::OnIrcMessage(const CIrcMessage *pmsg) { if (pmsg != nullptr) { PfnIrcMessageHandler pfn = FindMethod(pmsg->sCommand.c_str()); @@ -632,10 +626,10 @@ void CIrcProto::OnIrcMessage(const CIrcMessage* pmsg) else OnIrcDisconnected(); } -PfnIrcMessageHandler CIrcProto::FindMethod(const wchar_t* lpszName) +PfnIrcMessageHandler CIrcProto::FindMethod(const wchar_t *lpszName) { CIrcHandler temp(lpszName, nullptr); - CIrcHandler* p = m_handlers.find(&temp); + CIrcHandler *p = m_handlers.find(&temp); return (p == nullptr) ? nullptr : p->m_handler; } @@ -643,7 +637,7 @@ PfnIrcMessageHandler CIrcProto::FindMethod(const wchar_t* lpszName) #define IPC_ADDR_SIZE 4 /* Size of IP address, change for IPv6. */ -char* ConvertIntegerToIP(unsigned long int_ip_addr) +char *ConvertIntegerToIP(unsigned long int_ip_addr) { IN_ADDR intemp; IN_ADDR in; @@ -657,7 +651,7 @@ char* ConvertIntegerToIP(unsigned long int_ip_addr) return inet_ntoa(in); } -unsigned long ConvertIPToInteger(char* IP) +unsigned long ConvertIPToInteger(char *IP) { IN_ADDR in; IN_ADDR intemp; @@ -677,7 +671,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(nullptr), dwWhatNeedsDoing(0), @@ -751,31 +745,31 @@ CDccSession::~CDccSession() // destroy all that needs destroying m_proto->KillChatTimer(m_proto->DCCTimer); // destroy the timer when no dcc objects remain } -int CDccSession::NLSend(const unsigned char* buf, int cbBuf) +int CDccSession::NLSend(const unsigned char *buf, int cbBuf) { tLastActivity = time(0); if (con) - return Netlib_Send(con, (const char*)buf, cbBuf, di->iType == DCC_CHAT ? MSG_DUMPASTEXT : MSG_NODUMP); + return Netlib_Send(con, (const char *)buf, cbBuf, di->iType == DCC_CHAT ? MSG_DUMPASTEXT : MSG_NODUMP); return 0; } -int CDccSession::NLReceive(const unsigned char* buf, int cbBuf) +int CDccSession::NLReceive(const unsigned char *buf, int cbBuf) { int n = 0; if (con) - n = Netlib_Recv(con, (char*)buf, cbBuf, di->iType == DCC_CHAT ? MSG_DUMPASTEXT : MSG_NODUMP); + n = Netlib_Recv(con, (char *)buf, cbBuf, di->iType == DCC_CHAT ? MSG_DUMPASTEXT : MSG_NODUMP); tLastActivity = time(0); return n; } -int CDccSession::SendStuff(const wchar_t* fmt) +int CDccSession::SendStuff(const wchar_t *fmt) { CMStringA buf = _T2A(fmt, m_proto->getCodepage()); - return NLSend((const unsigned char*)buf.c_str(), buf.GetLength()); + return NLSend((const unsigned char *)buf.c_str(), buf.GetLength()); } // called when the user wants to connect/create a new connection given the parameters in the constructor. @@ -797,7 +791,7 @@ void __cdecl CDccSession::ConnectProc(void *pparam) { Thread_SetName("IRC: ConnectProc"); - CDccSession* pThis = (CDccSession*)pparam; + CDccSession *pThis = (CDccSession *)pparam; if (!pThis->con) pThis->SetupConnection(); } @@ -819,11 +813,11 @@ int CDccSession::SetupConnection() // Set up stuff needed for the filetransfer dialog (if it is a filetransfer) if (di->iType == DCC_SEND) { - file[0] = (wchar_t*)di->sFileAndPath.c_str(); + file[0] = (wchar_t *)di->sFileAndPath.c_str(); file[1] = nullptr; - pfts.szCurrentFile.w = (wchar_t*)di->sFileAndPath.c_str(); - pfts.szWorkingDir.w = (wchar_t*)di->sPath.c_str(); + pfts.szCurrentFile.w = (wchar_t *)di->sFileAndPath.c_str(); + pfts.szWorkingDir.w = (wchar_t *)di->sPath.c_str(); pfts.hContact = di->hContact; pfts.flags = PFTS_UNICODE + ((di->bSender) ? PFTS_SENDING : PFTS_RECEIVING); pfts.totalFiles = 1; @@ -841,7 +835,7 @@ int CDccSession::SetupConnection() NETLIBBIND nb = {}; nb.pfnNewConnection = DoIncomingDcc; // this is the (helper) function to be called once an incoming connection is made. The 'real' function that is called is IncomingConnection() nb.pExtra = this; - + hBindPort = Netlib_BindPort(m_proto->hNetlibDCC, &nb); if (hBindPort == nullptr) { delete this; // dcc objects destroy themselves when the connection has been closed or failed for some reasson. @@ -988,7 +982,7 @@ void __cdecl CDccSession::ThreadProc(void *pparam) { Thread_SetName("IRC: CDccSession::ThreadProc"); - CDccSession* pThis = (CDccSession*)pparam; + CDccSession *pThis = (CDccSession *)pparam; // if it is an incoming connection on a listening port, then we should close the listenting port so only one can connect (the one you offered // the connection to) can connect and not evil IRCopers with haxxored IRCDs @@ -1022,7 +1016,7 @@ void CDccSession::DoSendFile() if (wPacketSize > 32 * 1024) wPacketSize = 32 * 1024; - uint8_t* chBuf = new uint8_t[wPacketSize + 1]; + uint8_t *chBuf = new uint8_t[wPacketSize + 1]; // is there a connection? if (con) { @@ -1061,7 +1055,7 @@ void CDccSession::DoSendFile() break; // break out if everything has already been read // send the package - int cbSent = NLSend((unsigned char*)chBuf, iRead); + int cbSent = NLSend((unsigned char *)chBuf, iRead); if (cbSent <= 0) break; // break out if connection is lost or a transmission error has occured @@ -1082,11 +1076,10 @@ void CDccSession::DoSendFile() if (dwRead <= 0) break; // connection closed, or a timeout occurred. - dwPacket = *(uint32_t*)npr.buffer; + dwPacket = *(uint32_t *)npr.buffer; dwLastAck = ntohl(dwPacket); - } - while (con && dwTotal != dwLastAck); + } while (con && dwTotal != dwLastAck); if (!con || dwRead <= 0) goto DCC_STOP; @@ -1102,13 +1095,12 @@ void CDccSession::DoSendFile() if (dwRead <= 0) break; // connection closed, or a timeout occurred. - dwPacket = *(uint32_t*)npr.buffer; + dwPacket = *(uint32_t *)npr.buffer; dwLastAck = ntohl(dwPacket); - } - while (con && (di->dwSize != dwTotal - && dwTotal - dwLastAck >= 100 * 1024 - || di->dwSize == dwTotal // get the last packets when the whole file has been sent - && dwTotal != dwLastAck)); + } while (con && (di->dwSize != dwTotal + && dwTotal - dwLastAck >= 100 * 1024 + || di->dwSize == dwTotal // get the last packets when the whole file has been sent + && dwTotal != dwLastAck)); if (!con || dwRead <= 0) goto DCC_STOP; @@ -1129,7 +1121,7 @@ void CDccSession::DoSendFile() } } - DCC_STOP: +DCC_STOP: // need to close the connection if it isn't allready if (con) { Netlib_CloseHandle(con); @@ -1191,7 +1183,7 @@ void CDccSession::DoReceiveFile() // the while loop will spin around till the connection is dropped, locally or by the remote computer. while (con) { // read - int cbRead = NLReceive((unsigned char*)chBuf, sizeof(chBuf)); + int cbRead = NLReceive((unsigned char *)chBuf, sizeof(chBuf)); if (cbRead <= 0) break; @@ -1257,16 +1249,16 @@ void CDccSession::DoChatReceive() int cbRead; int nLinesProcessed = 0; - cbRead = NLReceive((unsigned char*)chBuf + cbInBuf, sizeof(chBuf)-cbInBuf - 1); + cbRead = NLReceive((unsigned char *)chBuf + cbInBuf, sizeof(chBuf) - cbInBuf - 1); if (cbRead <= 0) break; cbInBuf += cbRead; chBuf[cbInBuf] = 0; - char* pStart = chBuf; + char *pStart = chBuf; while (*pStart) { - char* pEnd; + char *pEnd; // seek end-of-line for (pEnd = pStart; *pEnd && *pEnd != '\r' && *pEnd != '\n'; ++pEnd) @@ -1330,23 +1322,23 @@ VOID CALLBACK DCCTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) } // helper function for incoming dcc connections. -void DoIncomingDcc(HNETLIBCONN hConnection, uint32_t dwRemoteIP, void * p1) +void DoIncomingDcc(HNETLIBCONN hConnection, uint32_t dwRemoteIP, void *p1) { - CDccSession *dcc = (CDccSession*)p1; + CDccSession *dcc = (CDccSession *)p1; dcc->IncomingConnection(hConnection, dwRemoteIP); } // ident server -void DoIdent(HNETLIBCONN hConnection, uint32_t, void* extra) +void DoIdent(HNETLIBCONN hConnection, uint32_t, void *extra) { - CIrcProto *ppro = (CIrcProto*)extra; + CIrcProto *ppro = (CIrcProto *)extra; char szBuf[1024]; int cbTotal = 0; while (true) { - int cbRead = Netlib_Recv(hConnection, szBuf + cbTotal, sizeof(szBuf)-1 - cbTotal, 0); + int cbRead = Netlib_Recv(hConnection, szBuf + cbTotal, sizeof(szBuf) - 1 - cbTotal, 0); if (cbRead == SOCKET_ERROR || cbRead == 0) break; @@ -1354,7 +1346,7 @@ void DoIdent(HNETLIBCONN hConnection, uint32_t, void* extra) szBuf[cbTotal] = 0; LBL_Parse: - char* EOLPos = strstr(szBuf, "\r\n"); + char *EOLPos = strstr(szBuf, "\r\n"); if (EOLPos == nullptr) continue; @@ -1382,7 +1374,7 @@ LBL_Parse: cbLen = mir_snprintf(buf, "%s : ERROR : INVALID-PORT\r\n", szBuf); } - if (Netlib_Send(hConnection, (const char*)buf, cbLen, 0) > 0) + if (Netlib_Send(hConnection, (const char *)buf, cbLen, 0) > 0) ppro->debugLogA("Sent Ident answer: %s", buf); else ppro->debugLogA("Sending Ident answer failed."); diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h index fee6eca5a7..07327fee11 100644 --- a/protocols/IRCG/src/irclib.h +++ b/protocols/IRCG/src/irclib.h @@ -74,9 +74,8 @@ public : bool m_bNotify;
int m_codePage;
- //CIrcMessage( CIrcProto* ); // default constructor
- CIrcMessage( CIrcProto*, const wchar_t* lpszCmdLine, int codepage, bool bIncoming=false, bool bNotify = true); // parser constructor
- CIrcMessage( const CIrcMessage& m ); // copy constructor
+ CIrcMessage(CIrcProto *ppro, const wchar_t *lpszCmdLine, int codepage, bool bIncoming = false, bool bNotify = true); // parser constructor
+ CIrcMessage(const CIrcMessage &m); // copy constructor
~CIrcMessage();
void Reset();
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 95b233d8dc..77ac527e30 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -189,9 +189,9 @@ void CIrcProto::OnModulesLoaded() m_pServer = Chat_NewSession(GCW_SERVER, m_szModuleName, SERVERWINDOW, m_tszUserName);
if (m_useServer && !m_hideServerWindow)
- Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_VISIBLE);
+ Chat_Control(SERVERWINDOW, WINDOW_VISIBLE);
else
- Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_HIDDEN);
+ Chat_Control(SERVERWINDOW, WINDOW_HIDDEN);
ptrA szNetwork(getStringA("Network"));
if (szNetwork) {
diff --git a/protocols/IRCG/src/ircproto.h b/protocols/IRCG/src/ircproto.h index 5804e3631a..0e2ee41f68 100644 --- a/protocols/IRCG/src/ircproto.h +++ b/protocols/IRCG/src/ircproto.h @@ -262,23 +262,31 @@ struct CIrcProto : public PROTO<CIrcProto> 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(HNETLIBCONN con); - bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis); - bool IsChannel(const char* sName); - bool IsChannel(const wchar_t* sName); - void KillChatTimer(UINT_PTR &nIDEvent); - CMStringW ModeToStatus(int sMode); - CMStringW PrefixToStatus(int cPrefix); - 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, const wchar_t *userhostparams, ...); - CMStringW GetNextUserhostReason(int type); - CMStringW PeekAtReasons(int type); + 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(HNETLIBCONN con); + bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis); + bool IsChannel(const char* sName); + bool IsChannel(const wchar_t* sName); + void KillChatTimer(UINT_PTR &nIDEvent); + CMStringW ModeToStatus(int sMode); + CMStringW PrefixToStatus(int cPrefix); + int SetChannelSBText(CMStringW sWindow, CHANNELINFO *wi); + void SetChatTimer(UINT_PTR &nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc); + + CHANNELINFO *GetChannelInfo(const wchar_t *pwszChatName); + void SetChannelInfo(const wchar_t *pwszChatName, CHANNELINFO *pInfo); + + void ClearUserhostReasons(int type); + void DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, const wchar_t *userhostparams, ...); + CMStringW GetNextUserhostReason(int type); + CMStringW PeekAtReasons(int type); + + void __forceinline Chat_Control(const wchar_t *pwszChat, int state) + { + ::Chat_Control(Chat_Find(pwszChat, m_szModuleName), state); + } //////////////////////////////////////////////////////////////////////////////////////// // former CIrcSession class diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 0564c7d538..ac585d03b7 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -180,7 +180,7 @@ void CIrcProto::OnContactDeleted(MCONTACT hContact) S = dbv.pwszVal;
if (type == GCW_SERVER)
S = SERVERWINDOW;
- int i = Chat_Terminate(m_szModuleName, S);
+ int i = Chat_Terminate(Chat_Find(S, m_szModuleName));
if (i && type == GCW_CHATROOM)
PostIrcMessage(L"/PART %s %s", dbv.pwszVal, m_userInfo);
}
@@ -220,7 +220,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.pwszVal, m_userInfo);
- Chat_Terminate(m_szModuleName, dbv.pwszVal);
+ Chat_Terminate(Chat_Find(dbv.pwszVal, m_szModuleName));
}
db_free(&dbv);
}
@@ -317,7 +317,7 @@ INT_PTR __cdecl CIrcProto::OnShowListMenuCommand(WPARAM, LPARAM) INT_PTR __cdecl CIrcProto::OnShowServerMenuCommand(WPARAM, LPARAM)
{
- Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_VISIBLE);
+ Chat_Control(SERVERWINDOW, WINDOW_VISIBLE);
return 0;
}
@@ -477,7 +477,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case 3:
PostIrcMessage(L"/PART %s %s", p1, m_userInfo);
- Chat_Terminate(m_szModuleName, p1);
+ Chat_Terminate(Chat_Find(p1, m_szModuleName));
break;
case 4: // show server window
@@ -788,7 +788,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
nickItems[23].bDisabled = ulAdr == 0 ? TRUE : FALSE; // DCC submenu
- CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, gcmi->pszID);
+ auto *wi = GetChannelInfo(gcmi->pszID);
BOOL bServOwner = strchr(sUserModes.c_str(), 'q') == nullptr ? FALSE : TRUE;
BOOL bServAdmin = strchr(sUserModes.c_str(), 'a') == nullptr ? FALSE : TRUE;
BOOL bOwner = bServOwner ? ((wi->OwnMode >> 4) & 01) : FALSE;
@@ -985,7 +985,7 @@ void CIrcProto::DisconnectFromServer(void) if (m_perform && IsConnected())
DoPerform("Event: Disconnect");
- Chat_Terminate(m_szModuleName, nullptr);
+ Chat_Terminate(m_szModuleName);
ForkThread(&CIrcProto::DisconnectServerThread, nullptr);
}
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index b1d3817489..dd0f6d158d 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -21,6 +21,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
+CHANNELINFO *CIrcProto::GetChannelInfo(const wchar_t *pwszChatName)
+{
+ return (CHANNELINFO *)Chat_GetUserInfo(Chat_Find(pwszChatName, m_szModuleName));
+}
+
+void CIrcProto::SetChannelInfo(const wchar_t *pwszChatName, CHANNELINFO *pInfo)
+{
+ Chat_SetUserInfo(Chat_Find(pwszChatName, m_szModuleName), pInfo);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
void CIrcProto::AddToJTemp(wchar_t op, CMStringW& sCommand)
@@ -347,8 +357,8 @@ wchar_t* __stdcall DoColorCodes(const wchar_t *text, bool bStrip, bool bReplaceP return szTemp;
}
-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,
+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)
{
CMStringW sID;
@@ -360,12 +370,12 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* if (pszText)
sText = DoColorCodes(pszText, FALSE, TRUE);
- GCEVENT gce = { m_szModuleName, nullptr, iEvent };
+ GCEVENT gce = { 0, iEvent };
if (pszWindow) {
sID = pszWindow;
- gce.pszID.w = (wchar_t*)sID.c_str();
+ gce.si = Chat_Find(sID.c_str(), m_szModuleName);
}
- else gce.pszID.w = nullptr;
+ else gce.si = nullptr;
gce.pszStatus.w = pszStatus;
gce.dwFlags = (bAddToLog) ? GCEF_ADDTOLOG : 0;
@@ -500,7 +510,7 @@ int CIrcProto::SetChannelSBText(CMStringW sWindow, CHANNELINFO *wi) if (wi->pszTopic)
sTemp += wi->pszTopic;
sTemp = DoColorCodes(sTemp.c_str(), TRUE, FALSE);
- Chat_SetStatusbarText(m_szModuleName, sWindow, sTemp);
+ Chat_SetStatusbarText(Chat_Find(sWindow, m_szModuleName), sTemp);
return 0;
}
@@ -508,7 +518,7 @@ bool CIrcProto::FreeWindowItemData(CMStringW window, CHANNELINFO *wis) {
CHANNELINFO *wi;
if (!wis)
- wi = (CHANNELINFO*)Chat_GetUserInfo(m_szModuleName, window);
+ wi = GetChannelInfo(window);
else
wi = wis;
if (wi) {
@@ -524,7 +534,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 *)Chat_GetUserInfo(m_szModuleName, window);
+ auto *wi = GetChannelInfo(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 8a16147cfa..9c3bdafade 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -927,7 +927,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) {
wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
- CHANNELINFO *wi = (CHANNELINFO*)Chat_GetUserInfo(m_proto->m_szModuleName, window);
+ auto *wi = m_proto->GetChannelInfo(window);
if (wi) {
wchar_t toadd[10]; *toadd = 0;
wchar_t toremove[10]; *toremove = 0;
@@ -1122,7 +1122,7 @@ void CManagerDlg::InitManager(int mode, const wchar_t* window) {
SetDlgItemText(m_hwnd, IDC_CAPTION, window);
- CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_proto->m_szModuleName, window);
+ auto *wi = m_proto->GetChannelInfo(window);
if (wi) {
if (m_proto->IsConnected()) {
wchar_t temp[1000];
|