diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Scriver/src/chat/log.cpp | 28 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.cpp | 28 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_log.cpp | 31 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_main.cpp | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 25 |
6 files changed, 7 insertions, 107 deletions
diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index c3c716981d..ded37a01bc 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -25,32 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define EM_GETSCROLLPOS (WM_USER+221)
#endif
-static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
-{
- LOGSTREAMDATA *lstrdat = (LOGSTREAMDATA*)dwCookie;
- if (lstrdat) {
- // create the RTF
- if (lstrdat->buffer == nullptr) {
- lstrdat->bufferOffset = 0;
- lstrdat->buffer = pci->Log_CreateRTF(lstrdat);
- lstrdat->bufferLen = (int)mir_strlen(lstrdat->buffer);
- }
-
- // give the RTF to the RE control
- *pcb = min(cb, LONG(lstrdat->bufferLen - lstrdat->bufferOffset));
- memcpy(pbBuff, lstrdat->buffer + lstrdat->bufferOffset, *pcb);
- lstrdat->bufferOffset += *pcb;
-
- // free stuff if the streaming operation is complete
- if (lstrdat->bufferOffset == lstrdat->bufferLen) {
- mir_free(lstrdat->buffer);
- lstrdat->buffer = nullptr;
- }
- }
-
- return 0;
-}
-
void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw)
{
if (hwndDlg == 0 || lin == 0 || si == 0)
@@ -72,7 +46,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra streamData.isFirst = bRedraw ? 1 : (GetRichTextLength(hwndRich, CP_ACP, FALSE) == 0);
EDITSTREAM stream = { 0 };
- stream.pfnCallback = Log_StreamCallback;
+ stream.pfnCallback = Srmm_LogStreamCallback;
stream.dwCookie = (DWORD_PTR)&streamData;
SCROLLINFO scroll;
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index f15c4d957e..9fa78c4ecf 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -101,32 +101,6 @@ int SetRichTextRTF(HWND hwnd, const char *text) return GetRichTextLength(hwnd, 1200, FALSE);
}
-static DWORD CALLBACK RichTextStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
-{
- static DWORD dwRead;
- char **ppText = (char**)dwCookie;
-
- if (*ppText == nullptr) {
- *ppText = (char*)mir_alloc(cb + 1);
- memcpy(*ppText, pbBuff, cb);
- (*ppText)[cb] = 0;
- *pcb = cb;
- dwRead = cb;
- }
- else {
- char *p = (char*)mir_alloc(dwRead + cb + 1);
- memcpy(p, *ppText, dwRead);
- memcpy(p + dwRead, pbBuff, cb);
- p[dwRead + cb] = 0;
- mir_free(*ppText);
- *ppText = p;
- *pcb = cb;
- dwRead += cb;
- }
-
- return 0;
-}
-
char* GetRichTextRTF(HWND hwnd)
{
if (hwnd == 0)
@@ -134,7 +108,7 @@ char* GetRichTextRTF(HWND hwnd) char *pszText = nullptr;
EDITSTREAM stream = { 0 };
- stream.pfnCallback = RichTextStreamCallback;
+ stream.pfnCallback = Srmm_MessageStreamCallback;
stream.dwCookie = (DWORD_PTR)&pszText; // pass pointer to pointer
SendMessage(hwnd, EM_STREAMOUT, SF_RTFNOOBJS | SFF_PLAINRTF | SF_USECODEPAGE | (CP_UTF8 << 16), (LPARAM)&stream);
return pszText; // pszText contains the text
diff --git a/plugins/TabSRMM/src/chat.h b/plugins/TabSRMM/src/chat.h index 9551527c54..0fdd8849c0 100644 --- a/plugins/TabSRMM/src/chat.h +++ b/plugins/TabSRMM/src/chat.h @@ -101,6 +101,7 @@ extern CHAT_MANAGER saveCI; // log.c
char* Log_CreateRtfHeader(MODULEINFO *mi);
+char* Log_CreateRTF(LOGSTREAMDATA *streamData);
// window.c
int GetTextPixelSize(wchar_t* pszText, HFONT hFont, bool bWidth);
diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp index 38d6a0d134..e598846f4d 100644 --- a/plugins/TabSRMM/src/chat_log.cpp +++ b/plugins/TabSRMM/src/chat_log.cpp @@ -696,7 +696,7 @@ char* Log_CreateRtfHeader(MODULEINFO *mi) return str.Detach();
}
-static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
+char* Log_CreateRTF(LOGSTREAMDATA *streamData)
{
LOGINFO *lin = streamData->lin;
MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule);
@@ -830,33 +830,6 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) return str.Detach();
}
-static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
-{
- LOGSTREAMDATA *lstrdat = (LOGSTREAMDATA*)dwCookie;
-
- if (lstrdat) {
- // create the RTF
- if (lstrdat->buffer == nullptr) {
- lstrdat->bufferOffset = 0;
- lstrdat->buffer = Log_CreateRTF(lstrdat);
- lstrdat->bufferLen = (int)mir_strlen(lstrdat->buffer);
- }
-
- // give the RTF to the RE control
- *pcb = min(cb, lstrdat->bufferLen - lstrdat->bufferOffset);
- memcpy(pbBuff, lstrdat->buffer + lstrdat->bufferOffset, *pcb);
- lstrdat->bufferOffset += *pcb;
-
- // mir_free stuff if the streaming operation is complete
- if (lstrdat->bufferOffset == lstrdat->bufferLen) {
- mir_free(lstrdat->buffer);
- lstrdat->buffer = nullptr;
- }
- }
-
- return 0;
-}
-
void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw)
{
CHARRANGE oldsel, sel, newsel;
@@ -881,7 +854,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw) bool bFlag = false, fDoReplace;
EDITSTREAM stream = { 0 };
- stream.pfnCallback = Log_StreamCallback;
+ stream.pfnCallback = Srmm_LogStreamCallback;
stream.dwCookie = (DWORD_PTR)& streamData;
SCROLLINFO scroll = { 0 };
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index 570dd311be..31aed38421 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -235,6 +235,7 @@ int Chat_Load() pci->LogToFile = LogToFile;
pci->DoPopup = DoPopup;
pci->ShowPopup = ShowPopup;
+ pci->Log_CreateRTF = Log_CreateRTF;
pci->Log_CreateRtfHeader = Log_CreateRtfHeader;
pci->UM_CompareItem = UM_CompareItem;
pci->ReloadSettings();
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index cd1a49147b..30c5fff688 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -764,29 +764,6 @@ void CTabBaseDlg::FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei) // caller must mir_free the returned pointer.
// UNICODE version returns UTF-8 encoded string.
-static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
-{
- static DWORD dwRead;
- char **ppText = (char **)dwCookie;
-
- if (*ppText == nullptr) {
- *ppText = (char *)mir_alloc(cb + 2);
- memcpy(*ppText, pbBuff, cb);
- *pcb = cb;
- dwRead = cb;
- *(*ppText + cb) = '\0';
- }
- else {
- char *p = (char *)mir_realloc(*ppText, dwRead + cb + 2);
- memcpy(p + dwRead, pbBuff, cb);
- *ppText = p;
- *pcb = cb;
- dwRead += cb;
- *(*ppText + dwRead) = '\0';
- }
- return 0;
-}
-
char* TSAPI Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags)
{
if (hwndRtf == 0)
@@ -800,7 +777,7 @@ char* TSAPI Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags) char *pszText = nullptr;
EDITSTREAM stream = { 0 };
- stream.pfnCallback = Message_StreamCallback;
+ stream.pfnCallback = Srmm_MessageStreamCallback;
stream.dwCookie = (DWORD_PTR)&pszText; // pass pointer to pointer
SendMessage(hwndRtf, EM_STREAMOUT, dwFlags, (LPARAM)&stream);
return pszText; // pszText contains the text
|