diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-10-04 16:04:25 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-10-04 16:04:25 +0000 |
commit | c7bb55b7586eeb85258759dd71c2a1012d772556 (patch) | |
tree | 729c53830fc725fbcd32aec08df65e0550063325 /plugins/MirandaG15 | |
parent | 7db5dec75a13047e90ab9acafc5c5acc06223b60 (diff) |
MirandaG15:
- fixed group chat messages (broken in r14971)
- minor cleanup, leaks fixed, etc...
git-svn-id: http://svn.miranda-ng.org/main/trunk@15508 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirandaG15')
-rw-r--r-- | plugins/MirandaG15/res/MirandaG15.rc | 2 | ||||
-rw-r--r-- | plugins/MirandaG15/src/CAppletManager.cpp | 29 | ||||
-rw-r--r-- | plugins/MirandaG15/src/CContactList.cpp | 31 | ||||
-rw-r--r-- | plugins/MirandaG15/src/LCDFramework/CLCDList.h | 3 |
4 files changed, 30 insertions, 35 deletions
diff --git a/plugins/MirandaG15/res/MirandaG15.rc b/plugins/MirandaG15/res/MirandaG15.rc index 808acdaaaf..7e9800efa4 100644 --- a/plugins/MirandaG15/res/MirandaG15.rc +++ b/plugins/MirandaG15/res/MirandaG15.rc @@ -146,7 +146,7 @@ BEGIN CONTROL "User events",IDC_NOTIFY_IRC_USERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,184,76,9
CONTROL "Emotes",IDC_NOTIFY_IRC_EMOTES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,195,76,9
CONTROL "Status changes",IDC_NOTIFY_IRC_STATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,206,76,9
- LTEXT "Special IRC events:",IDC_STC4,110,151,64,9,NOT WS_GROUP
+ LTEXT "Gruup chat events:",IDC_STC4,110,151,64,9,NOT WS_GROUP
CONTROL "Notices",IDC_NOTIFY_IRC_NOTICES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,173,74,9
CONTROL "Channel events",IDC_NOTIFY_IRC_CHANNEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,217,76,9
CONTROL "Cut off nicknames after",IDC_NOTIFY_NICKCUTOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,46,90,9
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 2ec2cb4f48..d7c9388caa 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -750,9 +750,6 @@ void CAppletManager::SendTypingNotification(MCONTACT hContact, bool bEnable) MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessage) { tstring strAscii = _A2T(toNarrowString(strMessage).c_str()); - SMessageJob *pJob = new SMessageJob(); - pJob->dwTimestamp = GetTickCount(); - pJob->hContact = hContact; char *szProto = GetContactProto(hContact); tstring strProto = toTstring(szProto); @@ -760,14 +757,13 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(strProto); if (pIRCCon && db_get_b(hContact, szProto, "ChatRoom", 0) != 0) { - GCDEST gcd = { szProto, 0, GC_EVENT_SENDMESSAGE }; - DBVARIANT dbv; - if (!db_get_ts(hContact, szProto, "Nick", &dbv)) - gcd.ptszID = dbv.ptszVal; - else + if (db_get_ts(hContact, szProto, "Nick", &dbv)) return NULL; + GCDEST gcd = { szProto, 0, GC_EVENT_SENDMESSAGE }; + gcd.ptszID = dbv.ptszVal; + tstring strID = tstring(gcd.ptszID) + _T(" - ") + tstring(_A2T(toNarrowString(pIRCCon->strNetwork).c_str())); gcd.ptszID = (LPTSTR)strID.c_str(); @@ -778,9 +774,14 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag gce.bIsMe = true; CallService(MS_GC_EVENT, NULL, (LPARAM)&gce); - pJob->hEvent = NULL; + db_free(&dbv); + return 0; } else { + SMessageJob *pJob = new SMessageJob(); + pJob->dwTimestamp = GetTickCount(); + pJob->hContact = hContact; + char* szMsgUtf = mir_utf8encodeW(strMessage.c_str()); pJob->iBufferSize = (int)mir_strlen(szMsgUtf) + 1; @@ -792,9 +793,8 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag pJob->hEvent = (MEVENT)CallContactService(pJob->hContact, PSS_MESSAGE, 0, (LPARAM)pJob->pcBuffer); CAppletManager::GetInstance()->AddMessageJob(pJob); + return pJob->hEvent; } - - return pJob->hEvent; } //************************************************************************ @@ -1361,7 +1361,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) TRACE(_T("OK!\n")); return 0; } - if (gcd->ptszID != NULL) { + else if (gcd->ptszID != NULL) { TRACE(_T("OK!\n")); return 0; } @@ -1583,6 +1583,7 @@ int CAppletManager::HookProtoAck(WPARAM, LPARAM lParam) if (pProtoData == NULL) return 0; + // Skip connecting status if (iNewStatus == ID_STATUS_CONNECTING) return 0; @@ -1602,10 +1603,6 @@ int CAppletManager::HookProtoAck(WPARAM, LPARAM lParam) Event.eType = EVENT_PROTO_STATUS; } - // Skip connecting status - if (iNewStatus == ID_STATUS_CONNECTING) - return 0; - pProtoData->iStatus = iNewStatus; Event.iValue = iNewStatus; diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index 6964d74d59..7a61b0d39a 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -813,7 +813,7 @@ void CContactList::OnContactDeleted(MCONTACT hContact) if(!db_mc_isSub(hContact))
ChangeGroupObjectCounters(strGroup,-1);
- if(pGroup->iMembers <= 0)
+ if(pGroup && pGroup->iMembers <= 0)
DeleteGroupObjectByPath(pGroup->strPath);
}
}
@@ -997,14 +997,11 @@ void CContactList::UninitializeGroupObjects() void CContactList::InitializeGroupObjects()
{
UninitializeGroupObjects();
-
- CContactListGroup *pGroup = NULL;
- char *szProto = NULL;
for(MCONTACT hContact = db_find_first();hContact != NULL;hContact = db_find_next(hContact))
{
tstring strGroup = GetContactGroupPath(hContact);
- szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if(szProto && db_get_b(NULL,META_PROTO,"Enabled",1) && !mir_strcmpi(szProto,META_PROTO))
{
tstring strName = CAppletManager::GetContactDisplayname(hContact);
@@ -1013,7 +1010,7 @@ void CContactList::InitializeGroupObjects() strPath += strGroup;
strPath += (strPath.empty()?_T(""):_T("\\")) + strName;
- pGroup = CreateGroupObjectByPath(strPath);
+ CContactListGroup *pGroup = CreateGroupObjectByPath(strPath);
pGroup->hMetaContact = hContact;
if(!strGroup.empty())
@@ -1022,11 +1019,11 @@ void CContactList::InitializeGroupObjects() // If the contact has no group, continue
else if(!strGroup.empty() && CConfig::GetBoolSetting(CLIST_USEGROUPS))
{
- pGroup = GetGroupObjectByPath(strGroup);
+ CContactListGroup *pGroup = GetGroupObjectByPath(strGroup);
// create the group
if(!pGroup)
- pGroup = CreateGroupObjectByPath(strGroup);
+ CreateGroupObjectByPath(strGroup);
// update it's counters
if(!db_mc_isSub(hContact))
@@ -1104,9 +1101,7 @@ void CContactList::DeleteGroupObjectByPath(tstring strPath) {
ASSERT(!strPath.empty());
- CContactListGroup *pParentGroup = NULL;
- vector<CContactListGroup*>::iterator iter = m_Groups.begin();
- for(iter = m_Groups.begin();iter != m_Groups.end();iter++)
+ for(vector<CContactListGroup*>::iterator iter = iter = m_Groups.begin();iter != m_Groups.end();iter++)
{
if((*iter)->strPath == strPath)
{
@@ -1120,13 +1115,15 @@ void CContactList::DeleteGroupObjectByPath(tstring strPath) tstring strParse = strPath;
tstring::size_type pos = strParse.rfind('\\');
- if(pos != tstring::npos )
+ if (pos != tstring::npos)
{
- strParse = strParse.substr(0,pos);
- pParentGroup = GetGroupObjectByPath(strParse);
- pParentGroup->iGroups--;
- if(pParentGroup->iMembers <= 0 && pParentGroup->iGroups <= 0)
- DeleteGroupObjectByPath(strParse);
+ strParse = strParse.substr(0, pos);
+ CContactListGroup *pParentGroup = GetGroupObjectByPath(strParse);
+ if (pParentGroup) {
+ pParentGroup->iGroups--;
+ if (pParentGroup->iMembers <= 0 && pParentGroup->iGroups <= 0)
+ DeleteGroupObjectByPath(strParse);
+ }
}
return;
}
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDList.h b/plugins/MirandaG15/src/LCDFramework/CLCDList.h index 0f7006d46d..93284ba71a 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDList.h +++ b/plugins/MirandaG15/src/LCDFramework/CLCDList.h @@ -400,7 +400,8 @@ public: delete *iter; m_Entrys.erase(iter); - m_pRoot->UpdateEntryCount(); + if (m_pRoot) + m_pRoot->UpdateEntryCount(); return; } } |