summaryrefslogtreecommitdiff
path: root/protocols/Sametime/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 /protocols/Sametime/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 'protocols/Sametime/src')
-rw-r--r--protocols/Sametime/src/StdAfx.h2
-rw-r--r--protocols/Sametime/src/files.cpp6
-rw-r--r--protocols/Sametime/src/messaging.cpp7
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp28
-rw-r--r--protocols/Sametime/src/sametime_proto.h2
5 files changed, 15 insertions, 30 deletions
diff --git a/protocols/Sametime/src/StdAfx.h b/protocols/Sametime/src/StdAfx.h
index 7e2bb9e1e1..7fbf8e695a 100644
--- a/protocols/Sametime/src/StdAfx.h
+++ b/protocols/Sametime/src/StdAfx.h
@@ -77,4 +77,4 @@ extern "C" {
#include <m_chat.h>
#include <m_genmenu.h>
#include <m_icolib.h>
-
+#include <m_string.h>
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp
index f890a3f19e..e3836b75ae 100644
--- a/protocols/Sametime/src/files.cpp
+++ b/protocols/Sametime/src/files.cpp
@@ -10,8 +10,8 @@ CSametimeProto* getProtoFromMwFileTransfer(mwFileTransfer* ft)
}
/** an incoming file transfer has been offered */
-void mwFileTransfer_offered(mwFileTransfer* ft) {
-
+void mwFileTransfer_offered(mwFileTransfer* ft)
+{
CSametimeProto* proto = getProtoFromMwFileTransfer(ft);
proto->debugLog(_T("mwFileTransfer_offered() start"));
@@ -39,7 +39,7 @@ void mwFileTransfer_offered(mwFileTransfer* ft) {
_tcsncpy_s(descriptionT, filenameT, _TRUNCATE);
PROTORECVFILET pre = {0};
- pre.flags = PREF_TCHAR;
+ pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
pre.tszDescription = descriptionT;
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp
index e6e953b38f..ce457d3611 100644
--- a/protocols/Sametime/src/messaging.cpp
+++ b/protocols/Sametime/src/messaging.cpp
@@ -84,7 +84,6 @@ void mwIm_conversation_recv(mwConversation* conv, mwImSendType type, gconstpoint
PROTORECVEVENT pre = { 0 };
time_t t = time(NULL);
pre.timestamp = t;
- pre.flags = PREF_UTF;
pre.szMessage = (char*)msg;
ProtoChainRecvMsg(hContact, &pre);
}
@@ -113,7 +112,7 @@ mwImHandler mwIm_handler = {
NULL
};
-HANDLE CSametimeProto::SendMessageToUser(MCONTACT hContact, char* msg_utf8)
+HANDLE CSametimeProto::SendMessageToUser(MCONTACT hContact, const char *szMsg)
{
debugLog(_T("CSametimeProto::SendMessageToUser() hContact=[%x]"), hContact);
@@ -128,12 +127,12 @@ HANDLE CSametimeProto::SendMessageToUser(MCONTACT hContact, char* msg_utf8)
if (!mwConversation_isOpen(conv)) {
debugLog(_T("CSametimeProto::SendMessageToUser() mwConversation_isOpen"));
mir_cslock lck(q_cs);
- contact_message_queue[hContact].push(msg_utf8);
+ contact_message_queue[hContact].push(szMsg);
mwConversation_open(conv);
}
else {
debugLog(_T("CSametimeProto::SendMessageToUser() !mwConversation_isOpen"));
- mwConversation_send(conv, mwImSend_PLAIN, (gconstpointer)msg_utf8);
+ mwConversation_send(conv, mwImSend_PLAIN, szMsg);
}
free(id_block.user);
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index cacb87a850..c807697ad1 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -131,7 +131,7 @@ DWORD_PTR CSametimeProto::GetCaps(int type, MCONTACT hContact)
ret = PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_LIGHTDND;
break;
case PFLAGNUM_4:
- ret = PF4_SUPPORTTYPING | PF4_IMSENDUTF;
+ ret = PF4_SUPPORTTYPING;
break;
case PFLAG_UNIQUEIDTEXT:
ret = (DWORD_PTR)Translate("ID");
@@ -231,9 +231,9 @@ HANDLE CSametimeProto::SendFile(MCONTACT hContact, const PROTOCHAR* szDescriptio
return 0; // failure
}
-int CSametimeProto::SendMsg(MCONTACT hContact, int flags, const char* msg)
+int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg)
{
- debugLog(_T("CSametimeProto::SendMsg() hContact=[%x], flags=[%d]"), hContact, flags);
+ debugLog(_T("CSametimeProto::SendMsg() hContact=[%x]"), hContact);
char *proto = GetContactProto(hContact);
int ret;
@@ -247,19 +247,10 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int flags, const char* msg)
return 0;
}
- char *msg_utf8;
- if (flags & PREF_UNICODE)
- msg_utf8 = mir_utf8encodeW((wchar_t*)&msg[strlen(msg) + 1]);
- else if (flags & PREF_UTF)
- msg_utf8 = mir_strdup(msg);
- else
- msg_utf8 = mir_utf8encode(msg);
-
- if (!msg_utf8)
+ if (!msg)
return 0;
- ret = (int)SendMessageToUser(hContact, msg_utf8);
- mir_free(msg_utf8);
+ ret = (int)SendMessageToUser(hContact, msg);
TFakeAckParams *tfap = (TFakeAckParams*)mir_alloc(sizeof(TFakeAckParams));
tfap->proto = this;
@@ -305,13 +296,8 @@ int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt
{
debugLog(_T("CSametimeProto::RecvAwayMsg() hContact=[%x], mode=[%d]"), hContact, mode);
- if (evt->flags & PREF_UTF) {
- TCHAR* pszMsg = mir_utf8decodeT(evt->szMessage);
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, (LPARAM)pszMsg);
- mir_free(pszMsg);
- }
- else ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, (LPARAM)(TCHAR*)_A2T(evt->szMessage));
-
+ ptrT pszMsg(mir_utf8decodeT(evt->szMessage));
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, pszMsg);
return 0;
}
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h
index 4243f16f61..c2a023317d 100644
--- a/protocols/Sametime/src/sametime_proto.h
+++ b/protocols/Sametime/src/sametime_proto.h
@@ -63,7 +63,7 @@ struct CSametimeProto : public PROTO<CSametimeProto>
void InitMessaging();
void DeinitMessaging();
void SendTyping(MCONTACT hContact, bool typing);
- HANDLE SendMessageToUser(MCONTACT hContact, char* msg_utf8);
+ HANDLE SendMessageToUser(MCONTACT hContact, const char *szMsg);
void CloseIm(MCONTACT hContact);
// userlist.cpp