summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/src/chat/chat.h2
-rw-r--r--plugins/Scriver/src/chat/tools.cpp97
-rw-r--r--plugins/Scriver/src/chat/window.cpp6
3 files changed, 3 insertions, 102 deletions
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h
index 7b8bb4d3d7..324daba31f 100644
--- a/plugins/Scriver/src/chat/chat.h
+++ b/plugins/Scriver/src/chat/chat.h
@@ -93,7 +93,6 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw);
void LoadMsgLogBitmaps(void);
void FreeMsgLogBitmaps(void);
-TCHAR* GetChatLogsFilename(MCONTACT hContact, time_t tTime);
// window.c
int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth);
@@ -111,7 +110,6 @@ char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO *ui);
// tools.c
BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
-int GetColorIndex(const char* pszModule, COLORREF cr);
TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) ;
UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText);
void DestroyGCMenu(HMENU *hMenu, int iIndex);
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp
index 7af2a95929..f61b05a82c 100644
--- a/plugins/Scriver/src/chat/tools.cpp
+++ b/plugins/Scriver/src/chat/tools.cpp
@@ -21,19 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../commonheaders.h"
-int GetColorIndex(const char* pszModule, COLORREF cr)
-{
- MODULEINFO *pMod = pci->MM_FindModule(pszModule);
- if (!pMod || pMod->nColorCount == 0)
- return -1;
-
- for (int i = 0; i < pMod->nColorCount; i++)
- if (pMod->crColors[i] == cr)
- return i;
-
- return -1;
-}
-
TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2)
{
for (int i = 0; s1[i]; i++)
@@ -131,87 +118,3 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex)
RemoveMenu(*hMenu, iIndex, MF_BYPOSITION);
}
}
-
-BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
-{
- SESSION_INFO *si = pci->SM_FindSession(pszID, pszModule);
- if (si == NULL)
- return FALSE;
-
- GCDEST *gcd = (GCDEST*)mir_calloc(sizeof(GCDEST));
- gcd->pszModule = mir_strdup(pszModule);
- gcd->ptszID = mir_tstrdup(pszID);
- gcd->iType = iType;
-
- GCHOOK *gch = (GCHOOK*)mir_calloc(sizeof(GCHOOK));
- replaceStrT(gch->ptszUID, pszUID);
- replaceStrT(gch->ptszText, pszText);
- gch->dwData = dwItem;
- gch->pDest = gcd;
- PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM)gch);
- return TRUE;
-}
-
-TCHAR* GetChatLogsFilename(MCONTACT hContact, time_t tTime)
-{
- REPLACEVARSARRAY rva[11];
- TCHAR *p = { 0 }, *tszParsedName = { 0 };
-
- if (g_Settings.pszLogDir[_tcslen(g_Settings.pszLogDir) - 1] == '\\')
- _tcscat(g_Settings.pszLogDir, _T("%userid%.log"));
- if (!tTime)
- time(&tTime);
-
- // day 1-31
- rva[0].lptzKey = _T("d");
- rva[0].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%#d"), tTime));
- // day 01-31
- rva[1].lptzKey = _T("dd");
- rva[1].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%d"), tTime));
- // month 1-12
- rva[2].lptzKey = _T("m");
- rva[2].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%#m"), tTime));
- // month 01-12
- rva[3].lptzKey = _T("mm");
- rva[3].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%m"), tTime));
- // month text short
- rva[4].lptzKey = _T("mon");
- rva[4].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%b"), tTime));
- // month text
- rva[5].lptzKey = _T("month");
- rva[5].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%B"), tTime));
- // year 01-99
- rva[6].lptzKey = _T("yy");
- rva[6].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%y"), tTime));
- // year 1901-9999
- rva[7].lptzKey = _T("yyyy");
- rva[7].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%Y"), tTime));
- // weekday short
- rva[8].lptzKey = _T("wday");
- rva[8].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%a"), tTime));
- // weekday
- rva[9].lptzKey = _T("weekday");
- rva[9].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%A"), tTime));
- // end of array
- rva[10].lptzKey = NULL;
- rva[10].lptzValue = NULL;
-
- REPLACEVARSDATA dat = { sizeof(dat) };
- dat.dwFlags = RVF_TCHAR;
- dat.hContact = hContact;
- dat.variables = rva;
- tszParsedName = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)g_Settings.pszLogDir, (LPARAM)&dat);
-
- static TCHAR tszFileName[MAX_PATH];
- _tcsncpy(tszFileName, tszParsedName, MAX_PATH);
- mir_free(tszParsedName);
-
- for (int i = 0; i < SIZEOF(rva); i++)
- mir_free(rva[i].lptzValue);
-
- for (p = tszFileName + 2; *p; ++p)
- if (*p == ':' || *p == '*' || *p == '?' || *p == '"' || *p == '<' || *p == '>' || *p == '|')
- *p = _T('_');
-
- return tszFileName;
-}
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 833b8acfc1..beb8e305d1 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -478,7 +478,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bColor) {
- int index = GetColorIndex(Parentsi->pszModule, cf.crTextColor);
+ int index = pci->GetColorIndex(Parentsi->pszModule, cf.crTextColor);
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_COLOR);
if (index >= 0) {
@@ -493,7 +493,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bBkgColor) {
- int index = GetColorIndex(Parentsi->pszModule, cf.crBackColor);
+ int index = pci->GetColorIndex(Parentsi->pszModule, cf.crBackColor);
COLORREF crB = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BKGCOLOR);
@@ -1808,7 +1808,7 @@ LABEL_SHOWWINDOW:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_HISTORY))) {
MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule);
if (pInfo)
- ShellExecute(hwndDlg, NULL, GetChatLogsFilename(si->hContact, 0), NULL, NULL, SW_SHOW);
+ ShellExecute(hwndDlg, NULL, pci->GetChatLogsFilename(si, 0), NULL, NULL, SW_SHOW);
}
break;