summaryrefslogtreecommitdiff
path: root/plugins/MirandaG15/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-21 16:11:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-21 16:11:58 +0000
commit48266e479d1fcf5153b29c612866845990fccad8 (patch)
treec8cbc908cd3c5f08731e5e8d7eaac6b568007d09 /plugins/MirandaG15/src
parentebdb556f152734035846f120eb8112f88ef91281 (diff)
war against atavisms continues
- everything that goes to PSS_MESSAGE should be sent as utf8 string; - thus PREF_UNICODE & PREF_UTF support discontinued, these constants are removed; - support for PREF_UNICODE & PREF_UTF in protocols also removed; - PREF_UNICODE used in file transfers (PROTOFILERECVT) replaced with PRFF_UNICODE / PRFF_TCHAR git-svn-id: http://svn.miranda-ng.org/main/trunk@13734 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirandaG15/src')
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp70
-rw-r--r--plugins/MirandaG15/src/CAppletManager.h3
2 files changed, 9 insertions, 64 deletions
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index 4596306b56..7774c21448 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -629,27 +629,6 @@ void CAppletManager::HandleEvent(CEvent *pEvent)
}
}
-bool CAppletManager::IsUtfSendAvailable(MCONTACT hContact) {
- char* szProto = GetContactProto(hContact);
- if ( szProto == NULL )
- return FALSE;
-
- return ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF ) ? TRUE : FALSE;
-}
-
-//************************************************************************
-// returns the contacts message service name
-//************************************************************************
-char *CAppletManager::GetMessageServiceName(MCONTACT hContact,bool bIsUnicode)
-{
- char *szProto = GetContactProto(hContact);
-
- if(szProto == NULL)
- return NULL;
-
- return PSS_MESSAGE;
-}
-
//************************************************************************
// updates all pending message jobs
//************************************************************************
@@ -710,17 +689,13 @@ void CAppletManager::FinishMessageJob(SMessageJob *pJob)
DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.flags = DBEF_SENT;
+ dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = szProto;
dbei.timestamp = time(NULL);
// Check if protocoll is valid
if(dbei.szModule == NULL)
return;
- if(pJob->dwFlags & PREF_UTF) {
- dbei.flags |= DBEF_UTF;
- }
-
dbei.cbBlob = pJob->iBufferSize;
dbei.pBlob = (PBYTE) pJob->pcBuffer;
@@ -834,43 +809,16 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact,tstring strMessage
}
else
{
- DWORD pref = 0;
- bool bIsUnicode = false;
- if(CAppletManager::IsUtfSendAvailable(pJob->hContact)) {
- pref = PREF_UTF;
- char* szMsgUtf = NULL;
- szMsgUtf = mir_utf8encodeW( strMessage.c_str());
-
- pJob->iBufferSize = (int)strlen(szMsgUtf)+1;
- pJob->pcBuffer = (char *)malloc(pJob->iBufferSize);
- pJob->dwFlags = PREF_UTF;
-
- memcpy(pJob->pcBuffer,szMsgUtf,pJob->iBufferSize);
- mir_free(szMsgUtf);
- } else {
- bIsUnicode = !IsUnicodeAscii(strMessage.c_str(),mir_tstrlen(strMessage.c_str()));
- if(bIsUnicode) {
- pref = PREF_UNICODE;
- pJob->iBufferSize = bufSize * (sizeof(TCHAR) + 1);
- } else {
- pJob->iBufferSize = bufSize;
- }
- pJob->pcBuffer = (char *)malloc(pJob->iBufferSize);
- memcpy(pJob->pcBuffer,strAscii.c_str(),bufSize);
+ char* szMsgUtf = mir_utf8encodeW(strMessage.c_str());
- if(bIsUnicode) {
- memcpy(&pJob->pcBuffer[bufSize],strMessage.c_str(),bufSize*sizeof(TCHAR));
- }
- }
- char *szService = CAppletManager::GetMessageServiceName(pJob->hContact,bIsUnicode);
+ pJob->iBufferSize = (int)strlen(szMsgUtf)+1;
+ pJob->pcBuffer = (char *)malloc(pJob->iBufferSize);
+ pJob->dwFlags = 0;
- if(szService == NULL)
- {
- free(pJob->pcBuffer);
- pJob->pcBuffer = NULL;
- return NULL;
- }
- pJob->hEvent = (MEVENT)CallContactService(pJob->hContact, szService , pref, (LPARAM)pJob->pcBuffer );
+ memcpy(pJob->pcBuffer,szMsgUtf,pJob->iBufferSize);
+ mir_free(szMsgUtf);
+
+ pJob->hEvent = (MEVENT)CallContactService(pJob->hContact, PSS_MESSAGE, 0, (LPARAM)pJob->pcBuffer );
CAppletManager::GetInstance()->AddMessageJob(pJob);
}
diff --git a/plugins/MirandaG15/src/CAppletManager.h b/plugins/MirandaG15/src/CAppletManager.h
index 5af6058273..2e70f906ba 100644
--- a/plugins/MirandaG15/src/CAppletManager.h
+++ b/plugins/MirandaG15/src/CAppletManager.h
@@ -83,9 +83,6 @@ public:
// sends typing notifications to the specified contact
static void SendTypingNotification(MCONTACT hContact,bool bEnable);
- // returns the contacts message service name
- static char *GetMessageServiceName(MCONTACT hContact,bool bIsUnicode);
- static bool IsUtfSendAvailable(MCONTACT hContact);
// returns a formatted timestamp string
static tstring GetFormattedTimestamp(tm *time);