diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-23 18:52:14 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-23 18:52:14 +0300 |
commit | 35c6f6ccbb11f24a1385c5296a0f2b32c0b90dc9 (patch) | |
tree | 3e40f085a7114254966ddadafd1b92388c85b54e | |
parent | ac6a2d3c5a668324d4115305a621a81e4b5d99fb (diff) |
no need to implement the same code in each plugin
-rw-r--r-- | bin10/lib/mir_app.lib | bin | 102520 -> 102750 bytes | |||
-rw-r--r-- | bin10/lib/mir_app64.lib | bin | 97948 -> 98158 bytes | |||
-rw-r--r-- | bin12/lib/mir_app.lib | bin | 102520 -> 102750 bytes | |||
-rw-r--r-- | bin12/lib/mir_app64.lib | bin | 97948 -> 98158 bytes | |||
-rw-r--r-- | bin14/lib/mir_app.lib | bin | 102520 -> 102750 bytes | |||
-rw-r--r-- | bin14/lib/mir_app64.lib | bin | 97948 -> 98158 bytes | |||
-rw-r--r-- | include/m_chat.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_misc.cpp | 15 | ||||
-rw-r--r-- | protocols/JabberG/src/stdafx.h | 4 | ||||
-rw-r--r-- | protocols/MSN/src/msn_chat.cpp | 2 | ||||
-rw-r--r-- | protocols/MSN/src/msn_libstr.cpp | 12 | ||||
-rw-r--r-- | protocols/MSN/src/stdafx.h | 1 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 14 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 14 | ||||
-rw-r--r-- | src/mir_app/src/chat_tools.cpp | 14 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 |
18 files changed, 23 insertions, 61 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib Binary files differindex bc514b0f6a..a7beab2991 100644 --- a/bin10/lib/mir_app.lib +++ b/bin10/lib/mir_app.lib diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib Binary files differindex 99ab49648b..e7fa88fb0e 100644 --- a/bin10/lib/mir_app64.lib +++ b/bin10/lib/mir_app64.lib diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib Binary files differindex bc514b0f6a..a7beab2991 100644 --- a/bin12/lib/mir_app.lib +++ b/bin12/lib/mir_app.lib diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib Binary files differindex 99ab49648b..e7fa88fb0e 100644 --- a/bin12/lib/mir_app64.lib +++ b/bin12/lib/mir_app64.lib diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib Binary files differindex bc514b0f6a..a7beab2991 100644 --- a/bin14/lib/mir_app.lib +++ b/bin14/lib/mir_app.lib diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib Binary files differindex 99ab49648b..e7fa88fb0e 100644 --- a/bin14/lib/mir_app64.lib +++ b/bin14/lib/mir_app64.lib diff --git a/include/m_chat.h b/include/m_chat.h index 7f1adaac8d..7b1a0b569f 100644 --- a/include/m_chat.h +++ b/include/m_chat.h @@ -389,6 +389,8 @@ EXTERN_C MIR_APP_DLL(int) Chat_SetStatusbarText(const char *szModule, const wcha EXTERN_C MIR_APP_DLL(void) Chat_HoverMouse(struct SESSION_INFO *si, HWND hwnd, LPARAM lParam, bool bUseToolTip);
+EXTERN_C MIR_APP_DLL(wchar_t*) Chat_UnescapeTags(wchar_t *str_in);
+
/////////////////////////////////////////////////////////////////////////////////////////
#define GC_SSE_ONLYLISTED 0x0001 // processes only listed contacts, resets all contacts otherwise
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index bc5d850268..6cb09aabc2 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1002,7 +1002,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* mir_snwprintf(buf, L"%s%s%s", szMessage, him->m_tszResourceName, p + 2);
}
else mir_wstrncpy(buf, szMessage, _countof(buf));
- UnEscapeChatTags(buf);
+ Chat_UnescapeTags(buf);
ppro->m_ThreadInfo->send(
XmlNode(L"message") << XATTR(L"to", item->jid) << XATTR(L"type", L"groupchat")
@@ -1385,7 +1385,7 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) int64_t id = (_time64(0) << 16) + (GetTickCount() & 0xFFFF);
wchar_t *buf = NEWWSTR_ALLOCA(gch->ptszText);
- UnEscapeChatTags(buf);
+ Chat_UnescapeTags(buf);
m_ThreadInfo->send(
XmlNode(L"message") << XATTR(L"id", _i64tot(id, tszID, 36)) << XATTR(L"to", item->jid) << XATTR(L"type", L"groupchat")
<< XCHILD(L"body", buf));
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index ee64e3c348..4950875dd3 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -240,21 +240,6 @@ void CJabberProto::SetServerStatus(int iNewStatus) ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
}
-// Process a string, and double all % characters, according to chat.dll's restrictions
-// Returns a pointer to the new string (old one is not freed)
-
-wchar_t* UnEscapeChatTags(wchar_t* str_in)
-{
- wchar_t *s = str_in, *d = str_in;
- while (*s) {
- if (*s == '%' && s[1] == '%')
- s++;
- *d++ = *s++;
- }
- *d = 0;
- return str_in;
-}
-
//////////////////////////////////////////////////////////////////////////
// update MirVer with data for active resource
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index df2533fbfc..e3e320f2c9 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -666,10 +666,6 @@ void g_MenuInit(); void g_MenuUninit();
int g_OnToolbarInit(WPARAM, LPARAM);
-//---- jabber_misc.c ------------------------------------------------
-
-wchar_t* UnEscapeChatTags(wchar_t* str_in);
-
//---- jabber_adhoc.cpp ---------------------------------------------
struct CJabberAdhocStartupParams
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 0f5551f253..605577750c 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -480,7 +480,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) if (gch->ptszText && gch->ptszText[0]) {
GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
if (thread) {
- wchar_t* pszMsg = UnEscapeChatTags(NEWWSTR_ALLOCA(gch->ptszText));
+ wchar_t* pszMsg = Chat_UnescapeTags(NEWWSTR_ALLOCA(gch->ptszText));
rtrimw(pszMsg); // remove the ending linebreak
msnNsThread->sendMessage('N', thread->szEmail, thread->netId, UTF8(pszMsg), 0);
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 5e5d834067..7f543bc1b7 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -322,18 +322,6 @@ wchar_t* EscapeChatTags(const wchar_t* pszText) return pszNewText;
}
-wchar_t* UnEscapeChatTags(wchar_t* str_in)
-{
- wchar_t *s = str_in, *d = str_in;
- while (*s) {
- if ((*s == '%' && s[1] == '%') || (*s == '\n' && s[1] == '\n'))
- s++;
- *d++ = *s++;
- }
- *d = 0;
- return str_in;
-}
-
#pragma comment(lib, "Rpcrt4.lib")
char* getNewUuid(void)
diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index e0ea208c9c..633b842f78 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -240,7 +240,6 @@ time_t IsoToUnixTime(const char *stamp); time_t MsnTSToUnixtime(const char *pszTS);
wchar_t* EscapeChatTags(const wchar_t* pszText);
-wchar_t* UnEscapeChatTags(wchar_t* str_in);
void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def = NULL);
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 55d810ab86..30f566e0fc 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -402,18 +402,6 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) }
}
-wchar_t* UnEscapeChatTags(wchar_t* str_in)
-{
- wchar_t *s = str_in, *d = str_in;
- while (*s) {
- if (*s == '%' && s[1] == '%')
- s++;
- *d++ = *s++;
- }
- *d = 0;
- return str_in;
-}
-
void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszMessage)
{
if (!IsOnline())
@@ -421,7 +409,7 @@ void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszM wchar_t *buf = NEWWSTR_ALLOCA(tszMessage);
rtrimw(buf);
- UnEscapeChatTags(buf);
+ Chat_UnescapeTags(buf);
ptrA szChatId(mir_u2a(chat_id));
ptrA szMessage(mir_utf8encodeW(buf));
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 0de83aaa15..39cd7f2704 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -453,18 +453,6 @@ void CVkProto::SetChatStatus(MCONTACT hContact, int iStatus) /////////////////////////////////////////////////////////////////////////////////////////
-wchar_t* UnEscapeChatTags(wchar_t *str_in)
-{
- wchar_t *s = str_in, *d = str_in;
- while (*s) {
- if (*s == '%' && s[1] == '%')
- s++;
- *d++ = *s++;
- }
- *d = 0;
- return str_in;
-}
-
int CVkProto::OnChatEvent(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK*)lParam;
@@ -483,7 +471,7 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) if (IsOnline() && mir_wstrlen(gch->ptszText) > 0) {
ptrW pwszBuf(mir_wstrdup(gch->ptszText));
rtrimw(pwszBuf);
- UnEscapeChatTags(pwszBuf);
+ Chat_UnescapeTags(pwszBuf);
SendMsg(cc->m_hContact, 0, T2Utf(pwszBuf));
}
break;
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 6670695478..5501a5e9ba 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -906,3 +906,17 @@ MIR_APP_DLL(void) Chat_HoverMouse(SESSION_INFO *si, HWND hwnd, LPARAM lParam, bo }
}
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(wchar_t*) Chat_UnescapeTags(wchar_t *str_in)
+{
+ wchar_t *s = str_in, *d = str_in;
+ while (*s) {
+ if (*s == '%' && s[1] == '%')
+ s++;
+ *d++ = *s++;
+ }
+ *d = 0;
+ return str_in;
+}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 5fb730b3d6..e3106f9927 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -395,3 +395,4 @@ Netlib_NtlmCreateResponse @383 ?get_uin@DB_AUTH_BLOB@@QBEKXZ @396 NONAME
?makeBlob@DB_AUTH_BLOB@@AAEPAEXZ @397 NONAME
?size@DB_AUTH_BLOB@@QBEKXZ @398 NONAME
+Chat_UnescapeTags @399 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index c239ba0fec..da54dec2d5 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -395,3 +395,4 @@ Netlib_NtlmCreateResponse @383 ?get_uin@DB_AUTH_BLOB@@QEBAKXZ @396 NONAME
?makeBlob@DB_AUTH_BLOB@@AEAAPEAEXZ @397 NONAME
?size@DB_AUTH_BLOB@@QEBAKXZ @398 NONAME
+Chat_UnescapeTags @399 NONAME
|