diff options
author | George Hazan <ghazan@miranda.im> | 2017-09-19 14:12:58 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-09-19 14:13:06 +0300 |
commit | e254312f9a660c83081ce2062ab14ba3c3614089 (patch) | |
tree | 324dff386c4b394ed4dc0f9b912ce3332bd94e84 /plugins | |
parent | 54ad7c456325b4c7fd639ef2d7cca7d5aef81c05 (diff) |
useless structure GCDEST finally removed
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/MirLua/src/m_chat.cpp | 21 | ||||
-rw-r--r-- | plugins/MirandaG15/src/CAppletManager.cpp | 41 | ||||
-rw-r--r-- | plugins/RecentContacts/src/RecentContacts.cpp | 8 | ||||
-rw-r--r-- | plugins/Scriver/src/chat_main.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_main.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_tools.cpp | 10 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/xsn_main.cpp | 10 |
7 files changed, 38 insertions, 58 deletions
diff --git a/plugins/MirLua/src/m_chat.cpp b/plugins/MirLua/src/m_chat.cpp index dbecbc774e..f84caa4591 100644 --- a/plugins/MirLua/src/m_chat.cpp +++ b/plugins/MirLua/src/m_chat.cpp @@ -5,29 +5,14 @@ static luaL_Reg chatApi[] = { NULL, NULL }
};
-template <>
-int MT<GCEVENT>::Index(lua_State *L, GCEVENT *gce)
-{
- const char *key = lua_tostring(L, 2);
-
- if (mir_strcmp(key, "Destination") == 0)
- MT<GCDEST>::Set(L, gce->pDest);
- else
- lua_pushnil(L);
-
- return 1;
-}
-
LUAMOD_API int luaopen_m_chat(lua_State *L)
{
luaL_newlib(L, chatApi);
- MT<GCDEST>(L, "GCDEST")
- .Field(&GCDEST::pszModule, "Module", LUA_TSTRINGA)
- .Field(&GCDEST::ptszID, "Id", LUA_TSTRINGW)
- .Field(&GCDEST::iType, "Type", LUA_TINTEGER);
-
MT<GCEVENT>(L, "GCEVENT")
+ .Field(&GCEVENT::pszModule, "Module", LUA_TSTRINGA)
+ .Field(&GCEVENT::ptszID, "Id", LUA_TSTRINGW)
+ .Field(&GCEVENT::iType, "Type", LUA_TINTEGER)
.Field(&GCEVENT::time, "Timestamp", LUA_TINTEGER)
.Field(&GCEVENT::time, "IsMe", LUA_TINTEGER)
.Field(&GCEVENT::time, "Flags", LUA_TINTEGER)
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 6aee1a4f3c..323c1b7c70 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -1085,19 +1085,17 @@ CIRCHistory *CAppletManager::CreateIRCHistoryByName(tstring strProtocol, tstring int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) { GCEVENT *gce = (GCEVENT*)lParam; - GCDEST *gcd; - - if (gce == NULL || (gcd = gce->pDest) == NULL) { + if (gce == NULL) { TRACE(L"<< [%s] skipping invalid event\n"); return 0; } - TRACE(L"<< [%s:%s] event %04X\n", toTstring(gcd->pszModule).c_str(), gcd->ptszID, gcd->iType); + TRACE(L"<< [%s:%s] event %04X\n", toTstring(gce->pszModule).c_str(), gce->ptszID, gce->iType); // get the matching irc connection entry - CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(toTstring(gcd->pszModule)); + CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(toTstring(gce->pszModule)); if (!pIRCCon) { - TRACE(L"<< [%s] connection not found, skipping event\n", toTstring(gcd->pszModule).c_str()); + TRACE(L"<< [%s] connection not found, skipping event\n", toTstring(gce->pszModule).c_str()); return 0; } @@ -1115,23 +1113,23 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) Event.eType = EVENT_IRC_SENT; else Event.eType = EVENT_IRC_RECEIVED; - Event.iValue = gcd->iType; + Event.iValue = gce->iType; Event.hValue = lParam; CIRCHistory *pHistory = NULL; - if (gcd->ptszID) { - tstring strChannel = toTstring(gcd->ptszID); + if (gce->ptszID) { + tstring strChannel = toTstring(gce->ptszID); tstring::size_type pos = strChannel.find('-'); if (pos != tstring::npos) strChannel = strChannel.substr(0, pos - 1); else { - if (mir_wstrcmpi(gcd->ptszID, L"Network log")) + if (mir_wstrcmpi(gce->ptszID, L"Network log")) TRACE(L"\t WARNING: ignoring unknown event!\n"); return 0; } pHistory = CAppletManager::GetInstance()->GetIRCHistoryByName(pIRCCon->strProtocol, strChannel); if (!pHistory) { - if (gcd->iType == GC_EVENT_JOIN) { + if (gce->iType == GC_EVENT_JOIN) { pHistory = CAppletManager::GetInstance()->CreateIRCHistoryByName(pIRCCon->strProtocol, strChannel); if (pHistory) pHistory->LUsers.push_back(toTstring(gce->ptszNick)); @@ -1140,7 +1138,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) } Event.hContact = pHistory->hContact; } - else if (gcd->iType != GC_EVENT_INFORMATION) { + else if (gce->iType != GC_EVENT_INFORMATION) { TRACE(L"\t WARNING: ignoring unknown event!\n"); return 0; } @@ -1148,8 +1146,8 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) Event.hContact = NULL; // Ignore events from hidden chatrooms, except for join events - if (gcd->ptszID != NULL && db_get_b(Event.hContact, "CList", "Hidden", 0)) { - if (gcd->iType == GC_EVENT_JOIN && pHistory) + if (gce->ptszID != NULL && db_get_b(Event.hContact, "CList", "Hidden", 0)) { + if (gce->iType == GC_EVENT_JOIN && pHistory) pHistory->LUsers.push_back(toTstring(gce->ptszNick)); TRACE(L"\t Chatroom is hidden, skipping event!\n"); @@ -1165,7 +1163,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) TRACE(L"\t Handling event...\t"); - switch (gcd->iType) { + switch (gce->iType) { case GC_EVENT_INFORMATION: if (CConfig::GetBoolSetting(NOTIFY_IRC_CHANNEL)) Event.bNotification = true; @@ -1284,7 +1282,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) TRACE(L"OK!\n"); return 0; } - if (gce->bIsMe || gcd->ptszID == NULL) + if (gce->bIsMe || gce->ptszID == NULL) Event.bNotification = false; // set the event's timestamp @@ -1305,7 +1303,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) if (pHistory->LMessages.size() > CConfig::GetIntSetting(SESSION_LOGSIZE)) pHistory->LMessages.pop_front(); } - else if (gce->ptszNick && gcd->iType == GC_EVENT_QUIT) { + else if (gce->ptszNick && gce->iType == GC_EVENT_QUIT) { strNick = toTstring(gce->ptszNick); if (!CAppletManager::GetInstance()->m_LIRCHistorys.empty()) { @@ -1325,7 +1323,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) Event.hContact = (*iter)->hContact; tstring strName = CAppletManager::GetContactDisplayname((*iter)->hContact, true); Event.strDescription = strName + L" - " + Event.strValue; - Event.strSummary = L"(" + toTstring(gcd->pszModule) + L") " + strName; + Event.strSummary = L"(" + toTstring(gce->pszModule) + L") " + strName; CAppletManager::GetInstance()->HandleEvent(&Event); break; } @@ -1337,7 +1335,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) TRACE(L"OK!\n"); return 0; } - else if (gcd->ptszID != NULL) { + else if (gce->ptszID != NULL) { TRACE(L"OK!\n"); return 0; } @@ -1348,10 +1346,9 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) strChannel = strChannel.erase(CConfig::GetIntSetting(NOTIFY_CHANNELCUTOFF_OFFSET)) + L"..."; } Event.strDescription = strChannel + L" - " + Event.strValue; - Event.strSummary = L"(" + toTstring(gcd->pszModule) + L") " + pHistory->strChannel; + Event.strSummary = L"(" + toTstring(gce->pszModule) + L") " + pHistory->strChannel; } - else - Event.strDescription = Event.strValue; + else Event.strDescription = Event.strValue; TRACE(L"OK!\n"); diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index c88932e102..f89b112c78 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -476,8 +476,8 @@ static void SaveLastUsedTimeStamp(MCONTACT hContact) static int OnGCInEvent(WPARAM, LPARAM lParam)
{
GCEVENT *gce = (GCEVENT*)lParam;
- if (gce->pDest->iType == GC_EVENT_MESSAGE) {
- SESSION_INFO *si = pci->SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (gce->iType == GC_EVENT_MESSAGE) {
+ SESSION_INFO *si = pci->SM_FindSession(gce->ptszID, gce->pszModule);
if (si && si->hContact) {
// skip old events
if (gce->time && gce->time <= GetLastUsedTimeStamp(si->hContact))
@@ -491,8 +491,8 @@ static int OnGCInEvent(WPARAM, LPARAM lParam) static int OnGCOutEvent(WPARAM, LPARAM lParam)
{
GCEVENT *gce = (GCEVENT*)lParam;
- if (gce->pDest->iType == GC_USER_MESSAGE) {
- SESSION_INFO *si = pci->SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (gce->iType == GC_USER_MESSAGE) {
+ SESSION_INFO *si = pci->SM_FindSession(gce->ptszID, gce->pszModule);
if (si && si->hContact)
SaveLastUsedTimeStamp(si->hContact);
}
diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp index 9840936d74..7be39fdf65 100644 --- a/plugins/Scriver/src/chat_main.cpp +++ b/plugins/Scriver/src/chat_main.cpp @@ -105,14 +105,14 @@ static void OnCreateModule(MODULEINFO *mi) static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
{
- if (gce->pDest->iType & g_Settings.dwTrayIconFlags)
+ if (gce->iType & g_Settings.dwTrayIconFlags)
return oldDoTrayIcon(si, gce);
return TRUE;
}
static BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
{
- if (gce->pDest->iType & g_Settings.dwPopupFlags)
+ if (gce->iType & g_Settings.dwPopupFlags)
return oldDoPopup(si, gce);
return TRUE;
}
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index 02c906685f..d817fd08e7 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -227,7 +227,7 @@ static int OnHandleGCMenu(WPARAM, LPARAM lParam) return 1;
if (gch->dwData == 20020) { // add to highlight...
- SESSION_INFO *si = pci->SM_FindSession(gch->pDest->ptszID, gch->pDest->pszModule);
+ SESSION_INFO *si = pci->SM_FindSession(gch->ptszID, gch->pszModule);
THighLightEdit the = { THighLightEdit::CMD_ADD, si, pci->UM_FindUser(si->pUsers, gch->ptszUID) };
HWND hwndParent = si->pDlg->m_pContainer->m_hwnd;
HWND hwndDlg = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), hwndParent, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 864745498f..463b48320f 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -78,7 +78,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
{
- int iEvent = gce->pDest->iType;
+ int iEvent = gce->iType;
if (si && (iEvent & si->iLogTrayFlags))
return oldDoTrayIcon(si, gce);
return TRUE;
@@ -129,7 +129,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
{
- int iEvent = gce->pDest->iType;
+ int iEvent = gce->iType;
if (si == nullptr || !(iEvent & si->iLogPopupFlags))
return true;
@@ -301,12 +301,12 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight params->bInactive = FALSE;
}
params->bActiveTab = params->bMustFlash = params->bMustAutoswitch = FALSE;
- params->iEvent = gce->pDest->iType;
+ params->iEvent = gce->iType;
WPARAM wParamForHighLight = 0;
bool bFlagUnread = false;
if (bHighlight) {
- gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
+ gce->iType |= GC_EVENT_HIGHLIGHT;
params->sound = "ChatHighlight";
if (db_get_b(si->hContact, "CList", "Hidden", 0) != 0)
db_unset(si->hContact, "CList", "Hidden");
@@ -489,7 +489,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) /*
* check whether we have to log this event
*/
- if (!(gce->pDest->iType & si->iDiskLogFlags))
+ if (!(gce->iType & si->iDiskLogFlags))
return FALSE;
return oldLogToFile(si, gce); // call kernel method
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index 417dd08dbd..c5e132eb39 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -149,16 +149,14 @@ static int ProcessEvent(WPARAM hContact, LPARAM lParam) static int ProcessChatEvent(WPARAM, LPARAM lParam)
{
GCEVENT *gce = (GCEVENT*)lParam;
- if (gce == NULL || gce->pDest == NULL)
+ if (gce == nullptr)
return 0;
-
- GCDEST *gcd = (GCDEST*)gce->pDest;
- if (gcd->iType != GC_EVENT_MESSAGE)
+ if (gce->iType != GC_EVENT_MESSAGE)
return 0;
- MCONTACT hContact = pci->FindRoom(gcd->pszModule, gcd->ptszID);
+ MCONTACT hContact = pci->FindRoom(gce->pszModule, gce->ptszID);
if (hContact != 0) {
- ptrW nick(db_get_wsa(hContact, gcd->pszModule, "MyNick"));
+ ptrW nick(db_get_wsa(hContact, gce->pszModule, "MyNick"));
if (nick == NULL || gce->ptszText == NULL)
return 0;
if (wcsstr(gce->ptszText, nick)) {
|