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 /protocols/JabberG/src | |
parent | 54ad7c456325b4c7fd639ef2d7cca7d5aef81c05 (diff) |
useless structure GCDEST finally removed
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 54 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_groupchat.cpp | 16 |
2 files changed, 33 insertions, 37 deletions
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 7958016283..dc92fabb9b 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -229,8 +229,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus if (!buf.IsEmpty()) {
buf.Replace(L"%", L"%%");
- GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_INFORMATION };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, item->jid, GC_EVENT_INFORMATION };
gce.ptszNick = user->m_tszResourceName;
gce.ptszUID = user->m_tszResourceName;
gce.ptszText = buf;
@@ -256,8 +255,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t if (myNick == nullptr)
myNick = JabberNickFromJID(m_szJabberJID);
- GCDEST gcd = { m_szModuleName, item->jid };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, item->jid };
gce.ptszNick = nick;
gce.ptszUID = resource;
if (jid != nullptr)
@@ -268,11 +266,12 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t gce.time = time(0);
}
- switch (gcd.iType = action) {
+ switch (gce.iType = action) {
case GC_EVENT_PART: break;
case GC_EVENT_KICK:
gce.ptszStatus = TranslateT("Moderator");
break;
+
default:
mir_cslock lck(m_csLists);
for (int i = 0; i < item->arResources.getCount(); i++) {
@@ -281,7 +280,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t if (action != GC_EVENT_JOIN) {
switch (action) {
case 0:
- gcd.iType = GC_EVENT_ADDSTATUS;
+ gce.iType = GC_EVENT_ADDSTATUS;
case GC_EVENT_REMOVESTATUS:
gce.dwFlags &= ~GCEF_ADDTOLOG;
}
@@ -303,10 +302,10 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t flags += GC_SSE_ONLINE;
Chat_SetStatusEx(m_szModuleName, item->jid, flags, nick);
+ gce.iType = GC_EVENT_SETCONTACTSTATUS;
gce.ptszText = nick;
gce.ptszUID = resource;
gce.dwItemData = statusToSet;
- gcd.iType = GC_EVENT_SETCONTACTSTATUS;
Chat_Event(&gce);
}
}
@@ -1220,66 +1219,65 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g switch (gch->dwData) {
case IDM_LST_PARTICIPANT:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"role", L"participant", &CJabberProto::OnIqResultMucGetVoiceList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"role", L"participant", &CJabberProto::OnIqResultMucGetVoiceList);
break;
case IDM_LST_MEMBER:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"member", &CJabberProto::OnIqResultMucGetMemberList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"member", &CJabberProto::OnIqResultMucGetMemberList);
break;
case IDM_LST_MODERATOR:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"role", L"moderator", &CJabberProto::OnIqResultMucGetModeratorList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"role", L"moderator", &CJabberProto::OnIqResultMucGetModeratorList);
break;
case IDM_LST_BAN:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"outcast", &CJabberProto::OnIqResultMucGetBanList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"outcast", &CJabberProto::OnIqResultMucGetBanList);
break;
case IDM_LST_ADMIN:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"admin", &CJabberProto::OnIqResultMucGetAdminList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"admin", &CJabberProto::OnIqResultMucGetAdminList);
break;
case IDM_LST_OWNER:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"owner", &CJabberProto::OnIqResultMucGetOwnerList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"owner", &CJabberProto::OnIqResultMucGetOwnerList);
break;
case IDM_TOPIC:
- szTitle.Format(TranslateT("Set topic for %s"), gch->pDest->ptszID);
+ szTitle.Format(TranslateT("Set topic for %s"), gch->ptszID);
szBuffer = item->getTemp()->m_tszStatusMessage;
szBuffer.Replace(L"\n", L"\r\n");
if (ppro->EnterString(szBuffer, szTitle, ESF_RICHEDIT, "gcTopic_"))
ppro->m_ThreadInfo->send(
- XmlNode(L"message") << XATTR(L"to", gch->pDest->ptszID) << XATTR(L"type", L"groupchat")
- << XCHILD(L"subject", szBuffer));
+ XmlNode(L"message") << XATTR(L"to", gch->ptszID) << XATTR(L"type", L"groupchat") << XCHILD(L"subject", szBuffer));
break;
case IDM_NICK:
- szTitle.Format(TranslateT("Change nickname in %s"), gch->pDest->ptszID);
+ szTitle.Format(TranslateT("Change nickname in %s"), gch->ptszID);
if (item->nick)
szBuffer = item->nick;
if (ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
- if (ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID) != nullptr) {
+ if (ppro->ListGetItemPtr(LIST_CHATROOM, gch->ptszID) != nullptr) {
wchar_t text[1024];
- mir_snwprintf(text, L"%s/%s", gch->pDest->ptszID, szBuffer.c_str());
+ mir_snwprintf(text, L"%s/%s", gch->ptszID, szBuffer.c_str());
ppro->SendPresenceTo(ppro->m_iStatus == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : ppro->m_iStatus, text, nullptr);
}
}
break;
case IDM_INVITE:
- (new CGroupchatInviteDlg(ppro, gch->pDest->ptszID))->Show();
+ (new CGroupchatInviteDlg(ppro, gch->ptszID))->Show();
break;
case IDM_CONFIG:
ppro->m_ThreadInfo->send(
- XmlNodeIq(ppro->AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, gch->pDest->ptszID))
+ XmlNodeIq(ppro->AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, gch->ptszID))
<< XQUERY(JABBER_FEAT_MUC_OWNER));
break;
case IDM_BOOKMARKS:
- item = ppro->ListGetItemPtr(LIST_BOOKMARK, gch->pDest->ptszID);
+ item = ppro->ListGetItemPtr(LIST_BOOKMARK, gch->ptszID);
if (item == nullptr) {
- item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID);
+ item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->ptszID);
if (item != nullptr) {
item->type = L"conference";
MCONTACT hContact = ppro->HContactFromJID(item->jid);
@@ -1290,10 +1288,10 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g break;
case IDM_DESTROY:
- szTitle.Format(TranslateT("Reason to destroy %s"), gch->pDest->ptszID);
+ szTitle.Format(TranslateT("Reason to destroy %s"), gch->ptszID);
if (ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE, "gcReason_"))
ppro->m_ThreadInfo->send(
- XmlNodeIq(L"set", ppro->SerialNext(), gch->pDest->ptszID) << XQUERY(JABBER_FEAT_MUC_OWNER)
+ XmlNodeIq(L"set", ppro->SerialNext(), gch->ptszID) << XQUERY(JABBER_FEAT_MUC_OWNER)
<< XCHILD(L"destroy") << XCHILD(L"reason", szBuffer));
// fall through
@@ -1368,14 +1366,14 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) if (gch == nullptr)
return 0;
- if (mir_strcmpi(gch->pDest->pszModule, m_szModuleName))
+ if (mir_strcmpi(gch->pszModule, m_szModuleName))
return 0;
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID);
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, gch->ptszID);
if (item == nullptr)
return 0;
- switch (gch->pDest->iType) {
+ switch (gch->iType) {
case GC_USER_MESSAGE:
if (gch->ptszText && mir_wstrlen(gch->ptszText) > 0) {
rtrimw(gch->ptszText);
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 00904b34ea..879b9bca10 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -797,8 +797,7 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t * Chat_ChangeUserId(m_szModuleName, item->jid, oldNick, newNick);
- GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_NICK };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, item->jid, GC_EVENT_NICK };
if (jid != nullptr)
gce.ptszUserInfo = jid;
gce.time = time(0);
@@ -1033,7 +1032,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if (!mir_wstrcmp(type, L"error"))
return;
- GCDEST gcd = { m_szModuleName, item->jid, 0 };
+ GCEVENT gce = { m_szModuleName, item->jid, 0 };
const wchar_t *msgText = nullptr;
@@ -1046,7 +1045,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if (msgText == nullptr || msgText[0] == '\0')
return;
- gcd.iType = GC_EVENT_TOPIC;
+ gce.iType = GC_EVENT_TOPIC;
if (resource == nullptr && (m = XmlGetChild(node, "body")) != nullptr) {
const wchar_t *tmpnick = XmlGetText(m);
@@ -1075,12 +1074,12 @@ void CJabberProto::GroupchatProcessMessage(HXML node) return;
if (resource == nullptr)
- gcd.iType = GC_EVENT_INFORMATION;
+ gce.iType = GC_EVENT_INFORMATION;
else if (wcsncmp(msgText, L"/me ", 4) == 0 && mir_wstrlen(msgText) > 4) {
msgText += 4;
- gcd.iType = GC_EVENT_ACTION;
+ gce.iType = GC_EVENT_ACTION;
}
- else gcd.iType = GC_EVENT_MESSAGE;
+ else gce.iType = GC_EVENT_MESSAGE;
}
GcInit(item);
@@ -1107,7 +1106,6 @@ void CJabberProto::GroupchatProcessMessage(HXML node) tszText.Replace(L"%", L"%%");
tszText += imgLink;
- GCEVENT gce = { &gcd };
gce.ptszUID = resource;
gce.ptszNick = nick;
gce.time = msgTime;
@@ -1124,7 +1122,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) item->bChatActive = 2;
- if (gcd.iType == GC_EVENT_TOPIC)
+ if (gce.iType == GC_EVENT_TOPIC)
Chat_SetStatusbarText(m_szModuleName, item->jid, tszText);
}
|