summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp10
-rw-r--r--protocols/JabberG/src/jabber_disco.cpp6
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp6
-rw-r--r--protocols/JabberG/src/jabber_util.cpp33
-rw-r--r--protocols/JabberG/src/stdafx.h9
5 files changed, 16 insertions, 48 deletions
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index a657f1af40..da93040fa9 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -1129,16 +1129,16 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
break;
case IDM_CPY_NICK:
- JabberCopyText(g_clistApi.hwndContactList, him->m_szResourceName);
+ Utils_ClipboardCopy(him->m_szResourceName);
break;
case IDM_RJID_COPY:
case IDM_CPY_RJID:
- JabberCopyText(g_clistApi.hwndContactList, him->m_szRealJid);
+ Utils_ClipboardCopy(him->m_szRealJid);
break;
case IDM_CPY_INROOMJID:
- JabberCopyText(g_clistApi.hwndContactList, MakeJid(item->jid, him->m_szResourceName));
+ Utils_ClipboardCopy(MakeJid(item->jid, him->m_szResourceName));
break;
case IDM_RJID_VCARD:
@@ -1303,11 +1303,11 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK *g
break;
case IDM_CPY_RJID:
- JabberCopyText(g_clistApi.hwndContactList, item->jid);
+ Utils_ClipboardCopy(item->jid);
break;
case IDM_CPY_TOPIC:
- JabberCopyText(g_clistApi.hwndContactList, item->getTemp()->m_szStatusMessage);
+ Utils_ClipboardCopy(item->getTemp()->m_szStatusMessage);
break;
}
}
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp
index 7ec1988e6a..94168f47ff 100644
--- a/protocols/JabberG/src/jabber_disco.cpp
+++ b/protocols/JabberG/src/jabber_disco.cpp
@@ -1056,15 +1056,15 @@ public:
break;
case SD_ACT_COPYJID:
- JabberCopyText(m_hwnd, pNode->GetJid());
+ Utils_ClipboardCopy(pNode->GetJid());
break;
case SD_ACT_COPYNODE:
- JabberCopyText(m_hwnd, pNode->GetNode());
+ Utils_ClipboardCopy(pNode->GetNode());
break;
case SD_ACT_COPYINFO:
- JabberCopyText(m_hwnd, pNode->GetTooltipText());
+ Utils_ClipboardCopy(pNode->GetTooltipText());
break;
case SD_ACT_FAVORITE:
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index 595a0c663a..f164252fbd 100644
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -497,7 +497,7 @@ public:
if (nReturnCmd == 1) {
CMStringW buf;
GetNodeText(pos->hItem, buf);
- JabberCopyText(m_hwnd, buf);
+ Utils_ClipboardCopy(buf);
}
else if (nReturnCmd == 2) {
wchar_t szBuffer[1024];
@@ -508,9 +508,9 @@ public:
tvi.pszText = szBuffer;
if (m_tree.GetItem(&tvi)) {
if (wchar_t *str = wcsstr(szBuffer, L": "))
- JabberCopyText(m_hwnd, str + 2);
+ Utils_ClipboardCopy(str + 2);
else
- JabberCopyText(m_hwnd, szBuffer);
+ Utils_ClipboardCopy(szBuffer);
}
}
DestroyMenu(hMenu);
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index aad05772f7..3eebd4e2c7 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -740,39 +740,6 @@ const wchar_t *JabberStrIStr(const wchar_t *str, const wchar_t *substr)
}
////////////////////////////////////////////////////////////////////////
-// clipboard processing
-
-void JabberCopyText(HWND hwnd, const char *pszText)
-{
- if (!hwnd || !pszText) return;
-
- if (OpenClipboard(hwnd)) {
- Utf2T text(pszText);
-
- EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(text) + 1));
- wchar_t *s = (wchar_t *)GlobalLock(hMem);
- mir_wstrcpy(s, text);
- GlobalUnlock(hMem);
- SetClipboardData(CF_UNICODETEXT, hMem);
- CloseClipboard();
- }
-}
-
-void JabberCopyText(HWND hwnd, const wchar_t *text)
-{
- if (!hwnd || !text) return;
-
- if (OpenClipboard(hwnd)) {
- EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(text) + 1));
- wchar_t *s = (wchar_t *)GlobalLock(hMem);
- mir_wstrcpy(s, text);
- GlobalUnlock(hMem);
- SetClipboardData(CF_UNICODETEXT, hMem);
- CloseClipboard();
- }
-}
BOOL CJabberProto::EnterString(CMStringW &result, const wchar_t *caption, int type, char *windowName, int recentCount, int timeout)
{
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index dc0dc76647..67eaad3244 100644
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -682,7 +682,7 @@ char* JabberStripJid(const char *jid, char *dest, size_t destLen);
int JabberGetPacketID(const char*);
char* JabberId2string(int id);
-__inline int JabberGetPacketID(const TiXmlElement *n)
+__forceinline int JabberGetPacketID(const TiXmlElement *n)
{ return JabberGetPacketID(XmlGetAttr(n, "id"));
}
@@ -694,12 +694,13 @@ wchar_t* JabberStrFixLines(const wchar_t *str);
wchar_t* JabberErrorStr(int errorCode);
CMStringW JabberErrorMsg(const TiXmlElement *errorNode, int *errorCode = nullptr);
-void JabberCopyText(HWND hwnd, const char *text);
-void JabberCopyText(HWND hwnd, const wchar_t *text);
-
const wchar_t *JabberStrIStr(const wchar_t *str, const wchar_t *substr);
CJabberProto* JabberChooseInstance(bool bIsLink=false);
+__forceinline void Utils_ClipboardCopy(const char *p)
+{ Utils_ClipboardCopy(Utf2T(p));
+}
+
bool JabberReadXep203delay(const TiXmlElement *node, time_t &msgTime);
void SetWindowTextUtf(HWND hwndDlg, const char *szValue);