diff options
Diffstat (limited to 'plugins/Scriver')
-rw-r--r-- | plugins/Scriver/src/chat_main.cpp | 26 | ||||
-rw-r--r-- | plugins/Scriver/src/chat_manager.cpp | 4 | ||||
-rw-r--r-- | plugins/Scriver/src/chat_options.cpp | 8 | ||||
-rw-r--r-- | plugins/Scriver/src/chat_window.cpp | 40 | ||||
-rw-r--r-- | plugins/Scriver/src/globals.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/input.cpp | 4 |
6 files changed, 41 insertions, 43 deletions
diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp index 503c8b07b0..2a8e500710 100644 --- a/plugins/Scriver/src/chat_main.cpp +++ b/plugins/Scriver/src/chat_main.cpp @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
// globals
-CHAT_MANAGER *pci;
-
pfnDoTrayIcon oldDoTrayIcon;
pfnDoPopup oldDoPopup;
@@ -130,23 +128,23 @@ static void OnLoadSettings() int Chat_Load()
{
CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Messaging") L"/" LPGENW("Group chats"), FONTMODE_SKIP, g_plugin.m_hLang };
- pci = Chat_GetInterface(&data);
+ Chat_CustomizeApi(&data);
- pci->OnCreateModule = OnCreateModule;
- pci->OnDestroyModule = OnDestroyModule;
- pci->OnLoadSettings = OnLoadSettings;
+ g_chatApi.OnCreateModule = OnCreateModule;
+ g_chatApi.OnDestroyModule = OnDestroyModule;
+ g_chatApi.OnLoadSettings = OnLoadSettings;
- pci->OnSetStatus = OnSetStatus;
+ g_chatApi.OnSetStatus = OnSetStatus;
- pci->OnReplaceSession = OnReplaceSession;
+ g_chatApi.OnReplaceSession = OnReplaceSession;
- pci->OnFlashWindow = OnFlashWindow;
- pci->OnFlashHighlight = OnFlashHighlight;
- pci->ShowRoom = ShowRoom;
+ g_chatApi.OnFlashWindow = OnFlashWindow;
+ g_chatApi.OnFlashHighlight = OnFlashHighlight;
+ g_chatApi.ShowRoom = ShowRoom;
- oldDoPopup = pci->DoPopup; pci->DoPopup = DoPopup;
- oldDoTrayIcon = pci->DoTrayIcon; pci->DoTrayIcon = DoTrayIcon;
- pci->ReloadSettings();
+ oldDoPopup = g_chatApi.DoPopup; g_chatApi.DoPopup = DoPopup;
+ oldDoTrayIcon = g_chatApi.DoTrayIcon; g_chatApi.DoTrayIcon = DoTrayIcon;
+ g_chatApi.ReloadSettings();
return 0;
}
diff --git a/plugins/Scriver/src/chat_manager.cpp b/plugins/Scriver/src/chat_manager.cpp index 0bfadfeb7e..c76d4e3179 100644 --- a/plugins/Scriver/src/chat_manager.cpp +++ b/plugins/Scriver/src/chat_manager.cpp @@ -31,7 +31,7 @@ SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO *cu if (currSession == prevSession)
pszCurrent = pszOriginal;
- for (auto &si : pci->arSessions) {
+ for (auto &si : g_chatApi.arSessions) {
if (si != currSession && !mir_strcmpi(pszModule, si->pszModule)) {
if (my_strstri(si->ptszName, pszOriginal) == si->ptszName) {
if (prevSession != si && mir_wstrcmpi(si->ptszName, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(si->ptszName, pszName) < 0)) {
@@ -50,7 +50,7 @@ char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO *ui) if (!ui || !si)
return '\0';
- STATUSINFO *ti = pci->TM_FindStatus(si->pStatuses, pci->TM_WordToString(si->pStatuses, ui->Status));
+ STATUSINFO *ti = g_chatApi.TM_FindStatus(si->pStatuses, g_chatApi.TM_WordToString(si->pStatuses, ui->Status));
if (ti) {
switch (si->iStatusCount - ti->iIconIndex - 1) {
case 0: return '\0';
diff --git a/plugins/Scriver/src/chat_options.cpp b/plugins/Scriver/src/chat_options.cpp index 9f19428273..4d2efeb4db 100644 --- a/plugins/Scriver/src/chat_options.cpp +++ b/plugins/Scriver/src/chat_options.cpp @@ -309,7 +309,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_WIZFINISH:
- pci->ReloadSettings();
+ g_chatApi.ReloadSettings();
Chat_UpdateOptions();
break;
@@ -514,7 +514,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM else if (((LPNMHDR)lParam)->idFrom == 0) {
switch (((LPNMHDR)lParam)->code) {
case PSN_WIZFINISH:
- pci->ReloadSettings();
+ g_chatApi.ReloadSettings();
Chat_UpdateOptions();
break;
@@ -551,7 +551,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM mir_wstrncpy(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
db_unset(0, CHAT_MODULE, "LogDirectory");
}
- pci->SM_InvalidateLogDirectories();
+ g_chatApi.SM_InvalidateLogDirectories();
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGTIMESTAMP));
if (iLen > 0) {
@@ -609,7 +609,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM g_Settings.bPopupInactiveOnly = db_get_b(0, CHAT_MODULE, "PopUpInactiveOnly", 1) != 0;
g_Settings.bLogIndentEnabled = (db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
- pci->MM_FontsChanged();
+ g_chatApi.MM_FontsChanged();
return TRUE;
}
}
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index cf8ab79cda..afd499701b 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -83,7 +83,7 @@ LBL_SkipEnd: if (m_pLastSession != nullptr)
pszName = m_pLastSession->ptszName;
}
- else pszName = pci->UM_FindUserAutoComplete(m_si->pUsers, m_wszSearchQuery, m_wszSearchResult);
+ else pszName = g_chatApi.UM_FindUserAutoComplete(m_si->pUsers, m_wszSearchQuery, m_wszSearchResult);
mir_free(pszText);
replaceStrW(m_wszSearchResult, nullptr);
@@ -116,9 +116,9 @@ void CChatRoomDlg::FixTabIcons() HICON hIcon;
if (!(m_si->wState & GC_EVENT_HIGHLIGHT)) {
if (m_si->wState & STATE_TALK)
- hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(m_si->pszModule)->hOnlineTalkIcon : pci->MM_FindModule(m_si->pszModule)->hOfflineTalkIcon;
+ hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? g_chatApi.MM_FindModule(m_si->pszModule)->hOnlineTalkIcon : g_chatApi.MM_FindModule(m_si->pszModule)->hOfflineTalkIcon;
else
- hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(m_si->pszModule)->hOnlineIcon : pci->MM_FindModule(m_si->pszModule)->hOfflineIcon;
+ hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? g_chatApi.MM_FindModule(m_si->pszModule)->hOnlineIcon : g_chatApi.MM_FindModule(m_si->pszModule)->hOfflineIcon;
}
else hIcon = g_dat.hMsgIcon;
@@ -157,7 +157,7 @@ void CChatRoomDlg::MessageDialogResize(int w, int h) m_btnNickList.Enable(true);
m_btnFilter.Enable(true);
if (m_si->iType == GCW_CHATROOM)
- m_btnChannelMgr.Enable(pci->MM_FindModule(m_si->pszModule)->bChanMgr);
+ m_btnChannelMgr.Enable(g_chatApi.MM_FindModule(m_si->pszModule)->bChanMgr);
}
int toolbarTopY = bToolbar ? h - m_pParent->iSplitterY - toolbarHeight : h - m_pParent->iSplitterY;
@@ -309,7 +309,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) if (!pButton->Enabled())
return;
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule);
if (mi == nullptr)
return;
@@ -327,7 +327,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) cmdList = tcmdlist_append(cmdList, pszRtf, 20, FALSE);
CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf)));
- pci->DoRtfToTags(ptszText, 0, nullptr);
+ g_chatApi.DoRtfToTags(ptszText, 0, nullptr);
ptszText.Trim();
ptszText.Replace(L"%", L"%%");
@@ -437,7 +437,7 @@ void CChatRoomDlg::UpdateNickList() m_nickList.SendMsg(WM_SETREDRAW, FALSE, 0);
m_nickList.SendMsg(LB_RESETCONTENT, 0, 0);
for (int index = 0; index < m_si->nUsersInNicklist; index++) {
- USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
+ USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
if (ui) {
char szIndicator = SM_GetStatusIndicator(m_si, ui);
if (szIndicator > '\0') {
@@ -459,7 +459,7 @@ void CChatRoomDlg::UpdateOptions() m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bFilterEnabled ? "chat_filter" : "chat_filter2"));
{
- MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
+ MODULEINFO *pInfo = g_chatApi.MM_FindModule(m_si->pszModule);
if (pInfo) {
m_btnBold.Enable(pInfo->bBold);
m_btnItalic.Enable(pInfo->bItalics);
@@ -510,7 +510,7 @@ void CChatRoomDlg::UpdateOptions() void CChatRoomDlg::UpdateStatusBar()
{
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule);
wchar_t szTemp[512];
mir_snwprintf(szTemp, L"%s : %s", mi->ptszModDispName, m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"");
@@ -533,7 +533,7 @@ void CChatRoomDlg::UpdateStatusBar() void CChatRoomDlg::UpdateTitle()
{
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule);
TitleBarData tbd = {};
tbd.hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
@@ -819,7 +819,7 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) if (wParam == VK_RETURN) {
int index = m_nickList.SendMsg(LB_GETCURSEL, 0, 0);
if (index != LB_ERR) {
- USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
+ USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0);
}
break;
@@ -858,7 +858,7 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) // string we have
int iItems = m_nickList.SendMsg(LB_GETCOUNT, 0, 0);
for (int i = 0; i < iItems; i++) {
- USERINFO *ui = pci->UM_FindUserFromIndex(m_si->pUsers, i);
+ USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si->pUsers, i);
if (ui) {
if (!wcsnicmp(ui->pszNick, m_wszSearch, mir_wstrlen(m_wszSearch))) {
m_nickList.SendMsg(LB_SETCURSEL, i, 0);
@@ -935,7 +935,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_CTLCOLORLISTBOX:
SetBkColor((HDC)wParam, g_Settings.crUserListBGColor);
- return (INT_PTR)pci->hListBkgBrush;
+ return (INT_PTR)g_chatApi.hListBkgBrush;
case WM_MEASUREITEM:
if (!MeasureMenuItem(wParam, lParam)) {
@@ -962,7 +962,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (dis->CtlID == IDC_SRMM_NICKLIST) {
int index = dis->itemID;
- USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
+ USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
if (ui) {
int x_offset = 2;
@@ -976,9 +976,9 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SetBkMode(dis->hDC, TRANSPARENT);
if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
- FillRect(dis->hDC, &dis->rcItem, pci->hListSelectedBkgBrush);
+ FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListSelectedBkgBrush);
else //if (dis->itemState & ODS_INACTIVE)
- FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush);
+ FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush);
if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
@@ -986,7 +986,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) IcoLib_ReleaseIcon(hIcon);
x_offset += 18;
}
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, g_chatApi.SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL);
x_offset += 12;
if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
@@ -1013,7 +1013,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg != WM_ACTIVATE)
SetFocus(m_message.GetHwnd());
- pci->SetActiveSession(m_si);
+ g_chatApi.SetActiveSession(m_si);
if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0)
db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
@@ -1041,13 +1041,13 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) GetCursorPos(&p);
ScreenToClient(m_nickList.GetHwnd(), &p);
int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y)));
- USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
+ USERINFO *ui = g_chatApi.SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
if (ui != nullptr) {
static wchar_t ptszBuf[1024];
mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
- TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
+ TranslateT("Status"), g_chatApi.TM_WordToString(parentdat->pStatuses, ui->Status));
lpttd->lpszText = ptszBuf;
}
}
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index f1db66c333..cb2632db08 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -153,7 +153,7 @@ static int ackevent(WPARAM, LPARAM lParam) dbei.pBlob = (PBYTE)item->sendBuffer;
MessageWindowEvent evt = { item->hSendId, hContact, &dbei };
- NotifyEventHooks(pci->hevPreCreate, 0, (LPARAM)&evt);
+ NotifyEventHooks(g_chatApi.hevPreCreate, 0, (LPARAM)&evt);
item->sendBuffer = (char *)dbei.pBlob;
db_event_add(hContact, &dbei);
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index 5e819d1322..61acf8f9be 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -70,14 +70,14 @@ void InputAreaContextMenu(HWND hwnd, WPARAM, LPARAM lParam, MCONTACT hContact) mwpd.hMenu = hSubMenu;
mwpd.selection = 0;
mwpd.pt = pt;
- NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd);
+ NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd);
int selection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), nullptr);
// Second notification
mwpd.selection = selection;
mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
- NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd);
+ NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd);
switch (selection) {
case IDM_UNDO:
|