diff options
Diffstat (limited to 'plugins/TabSRMM/src')
36 files changed, 1521 insertions, 1622 deletions
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index f0449c61d5..25e4d49fb5 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -37,7 +37,7 @@ static int sstSortButtons(const void * vmtbi1, const void * vmtbi2) static void li_ListDestruct(SortedList *pList, ItemDestuctor pItemDestructor)
{
- int i = 0;
+ int i=0;
if (!pList) return;
for (i=0; i < pList->realCount; i++) pItemDestructor(pList->items[i]);
List_Destroy(pList);
@@ -61,10 +61,9 @@ static void li_RemovePtrDestruct(SortedList *pList, void * ptr, ItemDestuctor pI static void li_SortList(SortedList *pList, FSortFunc pSortFunct)
{
FSortFunc pOldSort = pList->sortFunc;
- int i;
if (!pSortFunct) pSortFunct = pOldSort;
pList->sortFunc = NULL;
- for (i=0; i < pList->realCount - 1; i++)
+ for (int i=0; i < pList->realCount - 1; i++)
if (pOldSort(pList->items[i], pList->items[i+1]) < 0) {
void * temp = pList->items[i];
pList->items[i] = pList->items[i+1];
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index ff7d5577ea..070deef568 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -113,12 +113,12 @@ class CMUCHighlight; struct MODULEINFO
{
- char* pszModule;
- TCHAR* ptszModDispName;
- char* pszHeader;
+ char *pszModule;
+ TCHAR *ptszModDispName;
+ char *pszHeader;
bool bBold, bUnderline, bItalics, bColor, bBkgColor, bChanMgr, bAckMsg;
int nColorCount;
- COLORREF* crColors;
+ COLORREF *crColors;
int iMaxText;
DWORD idleTimeStamp;
@@ -142,35 +142,29 @@ struct FONTINFO struct LOGINFO
{
- TCHAR* ptszText;
- TCHAR* ptszNick;
- TCHAR* ptszUID;
- TCHAR* ptszStatus;
- TCHAR* ptszUserInfo;
+ TCHAR *ptszText, *ptszNick, *ptszUID, *ptszStatus, *ptszUserInfo;
bool bIsMe, bIsHighlighted;
time_t time;
int iType;
DWORD dwFlags;
- LOGINFO* next;
- LOGINFO* prev;
+ LOGINFO *next, *prev;
};
struct STATUSINFO
{
- TCHAR* pszGroup;
- HICON hIcon;
- WORD Status;
- STATUSINFO* next;
+ TCHAR *pszGroup;
+ HICON hIcon;
+ WORD Status;
+ STATUSINFO *next;
};
struct USERINFO
{
- TCHAR* pszNick;
- TCHAR* pszUID;
- WORD Status;
- WORD ContactStatus;
+ TCHAR *pszNick, *pszUID;
+ WORD Status;
+ WORD ContactStatus;
TChatStatusEx iStatusEx;
- USERINFO* next;
+ USERINFO *next;
};
struct SESSION_INFO
@@ -179,15 +173,15 @@ struct SESSION_INFO bool bFGSet, bBGSet, bFilterEnabled, bNicklistEnabled, bInitDone;
- char* pszModule;
- TCHAR* ptszID;
- TCHAR* ptszName;
- TCHAR* ptszStatusbarText;
- TCHAR* ptszTopic;
+ char *pszModule;
+ TCHAR *ptszID;
+ TCHAR *ptszName;
+ TCHAR *ptszStatusbarText;
+ TCHAR *ptszTopic;
TCHAR pszLogFileName[MAX_PATH + 50];
- char* pszID; // ugly fix for returning static ANSI strings in GC_INFO
- char* pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
+ char *pszID; // ugly fix for returning static ANSI strings in GC_INFO
+ char *pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
int iType;
int iFG;
@@ -212,30 +206,30 @@ struct SESSION_INFO time_t LastTime;
TCHAR szSearch[255];
int iSearchItem;
- CMUCHighlight* Highlight;
- COMMAND_INFO* lpCommands;
- COMMAND_INFO* lpCurrentCommand;
- LOGINFO* pLog;
- LOGINFO* pLogEnd;
- USERINFO* pUsers;
- USERINFO* pMe;
- STATUSINFO* pStatuses;
- TContainerData* pContainer;
- TWindowData* dat;
+ CMUCHighlight *Highlight;
+ COMMAND_INFO *lpCommands;
+ COMMAND_INFO *lpCurrentCommand;
+ LOGINFO *pLog;
+ LOGINFO *pLogEnd;
+ USERINFO *pUsers;
+ USERINFO *pMe;
+ STATUSINFO *pStatuses;
+ TContainerData *pContainer;
+ TWindowData *dat;
int wasTrimmed;
- SESSION_INFO* next;
+ SESSION_INFO *next;
};
struct LOGSTREAMDATA
{
- char* buffer;
+ char *buffer;
int bufferOffset, bufferLen;
HWND hwnd;
- LOGINFO* lin;
+ LOGINFO *lin;
bool bStripFormat, bRedraw;
SESSION_INFO *si;
int crCount;
- TWindowData* dat;
+ TWindowData *dat;
};
struct TMUCSettings
@@ -260,10 +254,10 @@ struct TMUCSettings int iPopupTimeout;
int iSplitterX;
int iSplitterY;
- TCHAR* pszTimeStamp;
- TCHAR* pszTimeStampLog;
- TCHAR* pszIncomingNick;
- TCHAR* pszOutgoingNick;
+ TCHAR *pszTimeStamp;
+ TCHAR *pszTimeStampLog;
+ TCHAR *pszIncomingNick;
+ TCHAR *pszOutgoingNick;
TCHAR pszLogDir[MAX_PATH + 20];
LONG iNickListFontHeight;
HFONT NameFont;
@@ -300,11 +294,10 @@ extern TMUCSettings g_Settings; struct COLORCHOOSER
{
- MODULEINFO* pModule;
- int xPosition;
- int yPosition;
- HWND hWndTarget;
- bool bForeground;
+ MODULEINFO *pModule;
+ int xPosition, yPosition;
+ HWND hWndTarget;
+ bool bForeground;
SESSION_INFO *si;
};
diff --git a/plugins/TabSRMM/src/chat/chatprototypes.h b/plugins/TabSRMM/src/chat/chatprototypes.h index e70361c10e..e709e40fc5 100644 --- a/plugins/TabSRMM/src/chat/chatprototypes.h +++ b/plugins/TabSRMM/src/chat/chatprototypes.h @@ -105,8 +105,8 @@ SESSION_INFO* SM_FindSessionByHCONTACT(HANDLE h); SESSION_INFO* SM_FindSessionByIndex(const char* pszModule, int iItem);
char* SM_GetUsers(SESSION_INFO *si);
USERINFO* SM_GetUserFromIndex(const TCHAR* pszID, const char* pszModule, int index);
-BOOL SM_ReconfigureFilters();
-BOOL SM_InvalidateLogDirectories();
+BOOL SM_ReconfigureFilters();
+BOOL SM_InvalidateLogDirectories();
MODULEINFO* MM_AddModule(const char* pszModule);
MODULEINFO* MM_FindModule(const char* pszModule);
void MM_FixColors();
@@ -165,7 +165,7 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, BOOL IsEventSupported(int eventType);
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
void Chat_SetFilters(SESSION_INFO *si);
-void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p);
+void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p);
// message.c
char* Chat_Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si);
TCHAR* Chat_DoRtfToTags( char* pszRtfText, SESSION_INFO *si);
diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp index 56ae11297d..78c5c5600c 100644 --- a/plugins/TabSRMM/src/chat/clist.cpp +++ b/plugins/TabSRMM/src/chat/clist.cpp @@ -38,7 +38,7 @@ char *szChatIconString = "chaticon"; static HANDLE Clist_GroupExists(TCHAR *tszGroup)
{
- unsigned int i = 0;
+ unsigned int i=0;
TCHAR* _t = 0;
char str[10];
INT_PTR result = 0;
@@ -56,7 +56,7 @@ static HANDLE Clist_GroupExists(TCHAR *tszGroup) }
i++;
}
- while(result == 0);
+ while(result == 0);
return 0;
}
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp index 2dec98fe54..dc4b8d118b 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat/manager.cpp @@ -1160,7 +1160,7 @@ USERINFO* UM_FindUser(USERINFO* pUserList, const TCHAR* pszUID) USERINFO* UM_FindUserFromIndex(USERINFO* pUserList, int index)
{
- int i = 0;
+ int i=0;
USERINFO *pTemp = pUserList;
if (!pUserList)
diff --git a/plugins/TabSRMM/src/chat/message.cpp b/plugins/TabSRMM/src/chat/message.cpp index 7195c26567..c681cf49a9 100644 --- a/plugins/TabSRMM/src/chat/message.cpp +++ b/plugins/TabSRMM/src/chat/message.cpp @@ -68,7 +68,7 @@ static void CreateColorMap(char* Text, int *pIndex, SESSION_INFO *si) static int ReadInteger(const char* p, int* result)
{
char temp[10];
- int i = 0;
+ int i=0;
while (isdigit(*p) && i < 9)
temp[i++] = *p++;
temp[i] = 0;
diff --git a/plugins/TabSRMM/src/chat/muchighlight.h b/plugins/TabSRMM/src/chat/muchighlight.h index e6e403a040..c552468577 100644 --- a/plugins/TabSRMM/src/chat/muchighlight.h +++ b/plugins/TabSRMM/src/chat/muchighlight.h @@ -74,8 +74,8 @@ private: TCHAR** m_TextPatterns;
UINT m_iNickPatterns;
UINT m_iTextPatterns;
- TCHAR* m_NickPatternString;
- TCHAR* m_TextPatternString;
+ TCHAR * m_NickPatternString;
+ TCHAR * m_TextPatternString;
bool m_Valid;
bool m_fHighlightMe;
};
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 6ab2614586..acc9b54222 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -522,8 +522,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
}
else {
- int i = 0;
-
+ int i=0;
while (_o1controls[i])
Utils::showDlgControl(hwndDlg, _o1controls[i++], SW_HIDE);
}
@@ -646,7 +645,7 @@ void RegisterFontServiceFonts() { strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
- for (int i = 0; i < SIZEOF(IM_fontOptionsList); i++) {
+ for (int i=0; i < SIZEOF(IM_fontOptionsList); i++) {
fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS;
LoadMsgDlgFont(FONTSECTION_IM, i , &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
@@ -711,7 +710,7 @@ void RegisterFontServiceFonts() { _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.group));
_tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, LPGENT("Fields background"), SIZEOF(fid.backgroundName));
- for (int i = 0; i < IPFONTCOUNT; i++) {
+ for (int i=0; i < IPFONTCOUNT; i++) {
LoadMsgDlgFont(FONTSECTION_IP, i + 100 , &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i + 100);
strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
@@ -737,7 +736,7 @@ void RegisterFontServiceFonts() { fid.flags&=~FIDF_SAVEPOINTSIZE;
_tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group Chats"), SIZEOF(fid.group));
strncpy(fid.dbSettingsGroup, CHAT_FONTMODULE, SIZEOF(fid.dbSettingsGroup));
- for (int i = 0; i < msgDlgFontCount; i++) {
+ for (int i=0; i < msgDlgFontCount; i++) {
LoadMsgDlgFont(FONTSECTION_CHAT, i , &lf, &fontOptionsList[i].colour, CHAT_FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
@@ -788,7 +787,7 @@ void RegisterFontServiceFonts() { strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
- for (int i = 0; i < SIZEOF(_clrs); i++) {
+ for (int i=0; i < SIZEOF(_clrs); i++) {
cid.order = _clrs[i].order;
_tcsncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name));
@@ -805,7 +804,7 @@ void RegisterFontServiceFonts() { /*
* text and background colors for tabs
*/
- for (int i = 0; i < SIZEOF(_tabclrs); i++) {
+ for (int i=0; i < SIZEOF(_tabclrs); i++) {
cid.order = _tabclrs[i].order;
_tcsncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name));
@@ -918,7 +917,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
}
else {
- int i = 0;
+ int i=0;
while (_o2chatcontrols[i])
Utils::enableDlgControl(hwndDlg, _o2chatcontrols[i++], FALSE);
}
@@ -1176,7 +1175,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM DWORD dwPopupFlags = M.GetDword("Chat", "PopupFlags", GC_EVENT_ALL);
DWORD dwLogFlags = M.GetDword("Chat", "DiskLogFlags", GC_EVENT_ALL);
- for (int i = 0; _eventorder[i]; i++) {
+ for (int i=0; _eventorder[i]; i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwFilterFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_L1 + i, dwLogFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
@@ -1208,7 +1207,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM DWORD dwFilterFlags = 0, dwTrayFlags = 0,
dwPopupFlags = 0, dwLogFlags = 0;
- for (int i = 0; _eventorder[i]; i++) {
+ for (int i=0; _eventorder[i]; i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
dwFilterFlags |= (IsDlgButtonChecked(hwndDlg, IDC_1 + i) ? _eventorder[i] : 0);
dwLogFlags |= (IsDlgButtonChecked(hwndDlg, IDC_L1 + i) ? _eventorder[i] : 0);
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index a29ad7e27a..398f0616c6 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -187,7 +187,7 @@ INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
{
- MODULEINFO* mi;
+ MODULEINFO *mi;
GCSESSION *gcw = (GCSESSION *)lParam;
if (gcw == NULL)
return GC_NEWSESSION_ERROR;
@@ -428,7 +428,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT newData.szInitialText = NULL;
memset(&newData.item, 0, sizeof(newData.item));
- TCHAR *contactName = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)newData.hContact, GCDNF_TCHAR);
+ TCHAR *contactName = pcli->pfnGetContactDisplayName(newData.hContact, 0);
/*
* cut nickname if larger than x chars...
@@ -446,8 +446,9 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT else lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname));
char *szProto = GetContactProto(newData.hContact);
- WORD wStatus = szProto == NULL ? ID_STATUS_OFFLINE : db_get_w((HANDLE) newData.hContact, szProto, "Status", ID_STATUS_OFFLINE);
- char *szStatus = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w((HANDLE)newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
+ WORD wStatus = (szProto == NULL) ? ID_STATUS_OFFLINE : db_get_w((HANDLE) newData.hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ char *szStatus = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,
+ (szProto == NULL) ? ID_STATUS_OFFLINE : db_get_w((HANDLE)newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
newData.item.pszText = newcontactname;
newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
@@ -459,27 +460,21 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT if (pContainer->hwndActive && bActivateTab)
ShowWindow(pContainer->hwndActive, SW_HIDE);
- {
- int iTabIndex_wanted = M.GetDword(hContact, "tabindex", pContainer->iChilds * 100);
- int iCount = TabCtrl_GetItemCount(hwndTab);
+ int iTabIndex_wanted = M.GetDword(hContact, "tabindex", pContainer->iChilds * 100);
+ int iCount = TabCtrl_GetItemCount(hwndTab);
+
+ pContainer->iTabIndex = iCount;
+ if (iCount > 0) {
TCITEM item = {0};
- HWND hwnd;
- struct TWindowData *dat;
- int relPos;
- int i;
-
- pContainer->iTabIndex = iCount;
- if (iCount > 0) {
- for (i = iCount - 1; i >= 0; i--) {
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, i, &item);
- hwnd = (HWND)item.lParam;
- dat = (struct TWindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (dat) {
- relPos = M.GetDword(dat->hContact, "tabindex", i * 100);
- if (iTabIndex_wanted <= relPos)
- pContainer->iTabIndex = i;
- }
+ for (int i = iCount - 1; i >= 0; i--) {
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, i, &item);
+ HWND hwnd = (HWND)item.lParam;
+ TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (dat) {
+ int relPos = M.GetDword(dat->hContact, "tabindex", i * 100);
+ if (iTabIndex_wanted <= relPos)
+ pContainer->iTabIndex = i;
}
}
}
@@ -575,25 +570,14 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground) INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
{
- GCEVENT *gce = (GCEVENT*)lParam;
- GCDEST *gcd = NULL;
- GCEVENT save_gce;
- GCDEST save_gcd;
- TCHAR* pWnd = NULL;
- char* pMod = NULL;
- BOOL bIsHighlighted = FALSE;
- BOOL bRemoveFlag = FALSE;
- int iRetVal = GC_EVENT_ERROR;
- SESSION_INFO *si = NULL;
- BOOL fFreeText = FALSE;
-
if (CMimAPI::m_shutDown)
return 0;
+ GCEVENT *gce = (GCEVENT*)lParam;
if (gce == NULL)
return GC_EVENT_ERROR;
- gcd = gce->pDest;
+ GCDEST *gcd = gce->pDest;
if (gcd == NULL)
return GC_EVENT_ERROR;
@@ -603,16 +587,24 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (!IsEventSupported(gcd->iType))
return GC_EVENT_ERROR;
+ int iRetVal = GC_EVENT_ERROR;
+ char *pMod = NULL;
+ TCHAR *pWnd = NULL;
+ GCDEST save_gcd;
+ GCEVENT save_gce;
+ SESSION_INFO *si = NULL;
+ bool bIsHighlighted = false, bRemoveFlag = false, bFreeText = false;
+
if (!(gce->dwFlags & GC_UNICODE)) {
save_gce = *gce;
save_gcd = *gce->pDest;
+ gce->ptszUID = a2tf(gce->ptszUID, gce->dwFlags);
+ gce->ptszNick = a2tf(gce->ptszNick, gce->dwFlags);
+ gce->ptszStatus = a2tf(gce->ptszStatus, gce->dwFlags);
gce->pDest->ptszID = a2tf(gce->pDest->ptszID, gce->dwFlags);
- gce->ptszUID = a2tf(gce->ptszUID, gce->dwFlags);
- gce->ptszNick = a2tf(gce->ptszNick, gce->dwFlags);
- gce->ptszStatus = a2tf(gce->ptszStatus, gce->dwFlags);
if (gcd->iType != GC_EVENT_MESSAGE && gcd->iType != GC_EVENT_ACTION) {
- gce->ptszText = a2tf(gce->ptszText, gce->dwFlags);
- fFreeText = TRUE;
+ gce->ptszText = a2tf(gce->ptszText, gce->dwFlags);
+ bFreeText = true;
}
gce->ptszUserInfo = a2tf(gce->ptszUserInfo, gce->dwFlags);
}
@@ -623,7 +615,7 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) switch (gcd->iType) {
case GC_EVENT_ADDGROUP:
{
- STATUSINFO* si = SM_AddStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszStatus);
+ STATUSINFO *si = SM_AddStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszStatus);
if (si && gce->dwItemData)
si->hIcon = CopyIcon((HICON)gce->dwItemData);
}
@@ -663,47 +655,47 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) case GC_EVENT_ADDSTATUS:
SM_GiveStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
if (!gce->bIsMe)
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME) != 0;
break;
case GC_EVENT_REMOVESTATUS:
SM_TakeStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
if (!gce->bIsMe)
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME) != 0;
break;
case GC_EVENT_MESSAGE:
case GC_EVENT_ACTION:
si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (!(gce->dwFlags & GC_UNICODE)) {
- fFreeText = TRUE;
+ bFreeText = TRUE;
if (si)
gce->ptszText = a2tf(gce->ptszText, gce->dwFlags, M.GetDword(si->hContact, "ANSIcodepage", 0));
else
gce->ptszText = a2tf(gce->ptszText, gce->dwFlags);
}
if (!gce->bIsMe && gce->pDest->pszID && gce->pszText && si)
- bIsHighlighted = si->Highlight->match(gce, si, CMUCHighlight::MATCH_TEXT | CMUCHighlight::MATCH_NICKNAME);
+ bIsHighlighted = si->Highlight->match(gce, si, CMUCHighlight::MATCH_TEXT | CMUCHighlight::MATCH_NICKNAME) != 0;
break;
case GC_EVENT_NICK:
SM_ChangeNick(gce->pDest->ptszID, gce->pDest->pszModule, gce);
if (!gce->bIsMe)
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME) != 0;
break;
case GC_EVENT_JOIN:
AddUser(gce);
if (!gce->bIsMe)
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME) != 0;
break;
case GC_EVENT_PART:
case GC_EVENT_QUIT:
case GC_EVENT_KICK:
- bRemoveFlag = TRUE;
+ bRemoveFlag = true;
if (!gce->bIsMe)
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME) != 0;
break;
}
@@ -729,7 +721,8 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (!bRemoveFlag) {
iRetVal = 0;
goto LBL_Exit;
- } }
+ }
+ }
// add to log
if (pWnd) {
@@ -763,7 +756,8 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (!bRemoveFlag) {
iRetVal = 0;
goto LBL_Exit;
- } }
+ }
+ }
if (bRemoveFlag)
iRetVal = (SM_RemoveUser(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID) == 0) ? 1 : 0;
@@ -772,7 +766,7 @@ LBL_Exit: LeaveCriticalSection(&cs);
if (!(gce->dwFlags & GC_UNICODE)) {
- if (fFreeText)
+ if (bFreeText)
mir_free((void*)gce->ptszText);
mir_free((void*)gce->ptszNick);
mir_free((void*)gce->ptszUID);
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index ce3988e1e2..65509b2190 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -208,8 +208,7 @@ static int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszP else
pd.lchIcon = LoadIconEx(IDI_CHANMGR, "window", 0, 0);
- mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME - 1, _T("%S - %s"),
- pszProtoName, CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
+ mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME - 1, _T("%S - %s"), pszProtoName, pcli->pfnGetContactDisplayName(hContact, 0));
lstrcpyn(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE - 1);
pd.iSeconds = g_Settings.iPopupTimeout;
@@ -605,7 +604,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight break;
case GC_EVENT_MESSAGE:
params->sound = "ChatMessage";
- if (params->bInactive && !(si->wState&STATE_TALK)) {
+ if (params->bInactive && !(si->wState & STATE_TALK)) {
si->wState |= STATE_TALK;
db_set_w(si->hContact, si->pszModule, "ApparentMode", (LPARAM)(WORD) 40071);
}
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 6c912da2d4..dd3fcbf6bd 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -97,7 +97,7 @@ static void Chat_SetMessageLog(TWindowData *dat) iee.hContact = dat->hContact;
iee.codepage = dat->codePage;
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ SESSION_INFO *si = (SESSION_INFO*)dat->si;
iee.pszProto = si->pszModule;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
@@ -244,7 +244,7 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) HWND hwndDlg = dat->hwnd;
HWND hwndTab = GetParent(hwndDlg);
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ SESSION_INFO *si = (SESSION_INFO*)dat->si;
if (msg == WM_ACTIVATE) {
if (dat->pContainer->dwFlags & CNT_TRANSPARENCY && CMimAPI::m_pSetLayeredWindowAttributes != NULL) {
@@ -351,13 +351,7 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
{
- BOOL isFlat = M.GetByte("tbflat", 1);
- BOOL isThemed = PluginConfig.m_bIsXP;
MODULEINFO *pInfo = si ? MM_FindModule(si->pszModule) : NULL;
- BOOL bFilterEnabled = si ? si->bFilterEnabled : FALSE;
-
- int i = 0;
-
if (pInfo) {
Utils::enableDlgControl(hwndDlg, IDC_CHAT_BOLD, pInfo->bBold);
Utils::enableDlgControl(hwndDlg, IDC_ITALICS, pInfo->bItalics);
@@ -371,18 +365,16 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO *si) static void Chat_ResizeIeView(const TWindowData *dat)
{
- RECT rcRichEdit;
- POINT pt;
- IEVIEWWINDOW ieWindow;
- int iMode = dat->hwndIEView ? 1 : 2;
- HWND hwndDlg = dat->hwnd;
+ int iMode = dat->hwndIEView ? 1 : 2;
+ HWND hwndDlg = dat->hwnd;
- ZeroMemory(&ieWindow, sizeof(ieWindow));
+ RECT rcRichEdit;
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcRichEdit);
- pt.x = rcRichEdit.left;
- pt.y = rcRichEdit.top;
+
+ POINT pt = { rcRichEdit.left, rcRichEdit.top };
ScreenToClient(hwndDlg, &pt);
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+
+ IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_SETPOS;
ieWindow.parent = hwndDlg;
ieWindow.hwnd = iMode == 1 ? dat->hwndIEView : dat->hwndHPP;
@@ -390,9 +382,8 @@ static void Chat_ResizeIeView(const TWindowData *dat) ieWindow.y = pt.y;
ieWindow.cx = rcRichEdit.right - rcRichEdit.left;
ieWindow.cy = rcRichEdit.bottom - rcRichEdit.top;
- if (ieWindow.cx != 0 && ieWindow.cy != 0) {
+ if (ieWindow.cx != 0 && ieWindow.cy != 0)
CallService(iMode == 1 ? MS_IEVIEW_WINDOW : MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
- }
}
/*
@@ -434,7 +425,8 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) if (tmp)
Utils::enableDlgControl(hwndDlg, IDC_CHANMGR, tmp->bChanMgr);
}
- } else {
+ }
+ else {
Utils::showDlgControl(hwndDlg, IDC_LIST, SW_HIDE);
Utils::showDlgControl(hwndDlg, IDC_SPLITTERX, SW_HIDE);
}
@@ -444,7 +436,6 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) Utils::enableDlgControl(hwndDlg, IDC_FILTER, FALSE);
Utils::enableDlgControl(hwndDlg, IDC_CHANMGR, FALSE);
}
- //ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_TOGGLESIDEBAR), dat->pContainer->dwFlags & CNT_SIDEBAR ? SW_SHOW : SW_HIDE);
switch (urc->wId) {
case IDC_PANELSPLITTER:
@@ -631,7 +622,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, {
HWND hwndParent = GetParent(hwnd);
TWindowData *mwdat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- SESSION_INFO *Parentsi = (SESSION_INFO *)mwdat->si;
+ SESSION_INFO *Parentsi = (SESSION_INFO*)mwdat->si;
MESSAGESUBDATA *dat = (MESSAGESUBDATA *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
@@ -656,14 +647,12 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_CONTEXTMENU:
{
- MODULEINFO* mi = MM_FindModule(Parentsi->pszModule);
+ MODULEINFO *mi = MM_FindModule(Parentsi->pszModule);
CHARRANGE sel, all = { 0, -1};
- int iSelection;
int iPrivateBG = M.GetByte(mwdat->hContact, "private_bg", 0);
- MessageWindowPopupData mwpd;
- POINT pt;
int idFrom = IDC_CHAT_MESSAGE;
+ POINT pt;
GetCursorPos(&pt);
HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
HMENU hSubMenu = GetSubMenu(hMenu, 2);
@@ -679,17 +668,17 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (idFrom == IDC_CHAT_MESSAGE)
EnableMenuItem(hSubMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
}
- mwpd.cbSize = sizeof(mwpd);
+
+ MessageWindowPopupData mwpd = { sizeof(mwpd) };
mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
mwpd.uFlags = (idFrom == IDC_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
mwpd.hContact = mwdat->hContact;
mwpd.hwnd = hwnd;
mwpd.hMenu = hSubMenu;
- mwpd.selection = 0;
mwpd.pt = pt;
NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
- iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), NULL);
+ int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), NULL);
mwpd.selection = iSelection;
mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
@@ -766,10 +755,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, BOOL isShift, isAlt, isCtrl;
KbdState(mwdat, isShift, isCtrl, isAlt);
- //MAD: sound on typing..
if (PluginConfig.g_bSoundOnTyping && !isAlt &&!isCtrl&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND)&&wParam!=VK_ESCAPE&&!(wParam==VK_TAB&&PluginConfig.m_AllowTab))
SkinPlaySound("SoundOnTyping");
- //MAD
if (wParam == 0x0d && isCtrl && PluginConfig.m_MathModAvail) {
TCHAR toInsert[100];
@@ -785,8 +772,9 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, WM_KEYDOWN, mwdat->dwFlags & MWF_LOG_RTL ? VK_RIGHT : VK_LEFT, 0);
return 0;
}
+
if (isCtrl && !isAlt && !isShift) {
- MODULEINFO* mi = MM_FindModule(Parentsi->pszModule);
+ MODULEINFO *mi = MM_FindModule(Parentsi->pszModule);
switch(wParam) {
case 0x09: // ctrl-i (italics)
@@ -879,7 +867,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, else if (wParam == VK_END) {
DM_ScrollToBottom(mwdat, 0, 0);
return 0;
- } else if (wParam == VK_DOWN)
+ }
+ else if (wParam == VK_DOWN)
wp = MAKEWPARAM(SB_LINEDOWN, 0);
SendMessage(GetDlgItem(hwndParent, IDC_CHAT_LOG), WM_VSCROLL, wp, 0);
@@ -892,35 +881,33 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (PluginConfig.m_SendOnShiftEnter) {
PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
return 0;
- } else
- break;
+ }
+ break;
}
if ((isCtrl && !isShift) ^(0 != PluginConfig.m_SendOnEnter)) {
PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
return 0;
}
- if (PluginConfig.m_SendOnEnter || PluginConfig.m_SendOnDblEnter) {
- if (isCtrl)
+ if (!PluginConfig.m_SendOnEnter && !PluginConfig.m_SendOnDblEnter)
+ break;
+ if (isCtrl)
+ break;
+
+ if (PluginConfig.m_SendOnDblEnter) {
+ if (dat->lastEnterTime + 2 < time(NULL)) {
+ dat->lastEnterTime = time(NULL);
break;
- else {
- if (PluginConfig.m_SendOnDblEnter) {
- if (dat->lastEnterTime + 2 < time(NULL)) {
- dat->lastEnterTime = time(NULL);
- break;
- } else {
- SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
- SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
- PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
- return 0;
- }
- }
- PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
- return 0;
}
- } else
- break;
- } else
- dat->lastEnterTime = 0;
+
+ SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
+ SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
+ PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ else dat->lastEnterTime = 0;
if ((wParam == VK_NEXT && isCtrl && !isShift) || (wParam == VK_TAB && isCtrl && !isShift)) { // CTRL-TAB (switch tab/window)
SendMessage(mwdat->pContainer->hwnd, DM_SELECTTAB, DM_SELECT_NEXT, 0);
@@ -964,7 +951,6 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
if (wParam == VK_UP && isCtrl && !isAlt) {
- int iLen;
GETTEXTLENGTHEX gtl = {0};
SETTEXTEX ste;
LOGFONTA lf;
@@ -982,7 +968,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, gtl.flags = GTL_PRECISE;
gtl.codepage = CP_ACP;
- iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)& gtl, 0);
+ int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)& gtl, 0);
SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
@@ -992,7 +978,6 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
if (wParam == VK_DOWN && isCtrl && !isAlt) {
- int iLen;
GETTEXTLENGTHEX gtl = {0};
SETTEXTEX ste;
@@ -1008,7 +993,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, gtl.flags = GTL_PRECISE;
gtl.codepage = CP_ACP;
- iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)& gtl, 0);
+ int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)& gtl, 0);
SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
@@ -1032,14 +1017,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_RBUTTONUP:
case WM_MBUTTONUP:
{
- CHARFORMAT2 cf;
UINT u = 0;
UINT u2 = 0;
COLORREF cr;
- MODULEINFO* mi = MM_FindModule(Parentsi->pszModule);
+ MODULEINFO *mi = MM_FindModule(Parentsi->pszModule);
LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE);
+ CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR | CFM_UNDERLINETYPE;
cf.dwEffects = 0;
@@ -1151,11 +1136,11 @@ static UINT _eventorder[] = { GC_EVENT_ACTION, static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- SESSION_INFO * si = (SESSION_INFO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) {
case WM_INITDIALOG:
{
- si = (SESSION_INFO *)lParam;
+ si = (SESSION_INFO*)lParam;
DWORD dwMask = db_get_dw(si->hContact, "Chat", "FilterMask", 0);
DWORD dwFlags = db_get_dw(si->hContact, "Chat", "FilterFlags", 0);
@@ -1167,7 +1152,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si);
- for (int i = 0; _eventorder[i]; i++) {
+ for (int i=0; _eventorder[i]; i++) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwMask & _eventorder[i] ? (dwFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
CheckDlgButton(hwndDlg, IDC_P1 + i, dwPopupMask & _eventorder[i] ? (dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
CheckDlgButton(hwndDlg, IDC_T1 + i, dwTrayMask & _eventorder[i] ? (dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
@@ -1200,7 +1185,8 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (dwMask == 0) {
db_unset(si->hContact, "Chat", "FilterFlags");
db_unset(si->hContact, "Chat", "FilterMask");
- } else {
+ }
+ else {
db_set_dw(si->hContact, "Chat", "FilterFlags", iFlags);
db_set_dw(si->hContact, "Chat", "FilterMask", dwMask);
}
@@ -1214,14 +1200,15 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
}
- if (iFlags&GC_EVENT_ADDSTATUS)
+ if (iFlags & GC_EVENT_ADDSTATUS)
iFlags |= GC_EVENT_REMOVESTATUS;
if (si) {
if (dwMask == 0) {
db_unset(si->hContact, "Chat", "PopupFlags");
db_unset(si->hContact, "Chat", "PopupMask");
- } else {
+ }
+ else {
db_set_dw(si->hContact, "Chat", "PopupFlags", iFlags);
db_set_dw(si->hContact, "Chat", "PopupMask", dwMask);
}
@@ -1241,7 +1228,8 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (dwMask == 0) {
db_unset(si->hContact, "Chat", "TrayIconFlags");
db_unset(si->hContact, "Chat", "TrayIconMask");
- } else {
+ }
+ else {
db_set_dw(si->hContact, "Chat", "TrayIconFlags", iFlags);
db_set_dw(si->hContact, "Chat", "TrayIconMask", dwMask);
}
@@ -1400,7 +1388,6 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR return mir_callNextSubclass(hwnd, LogSubclassProc, msg, wParam, lParam);
}
-
/*
* process mouse - hovering for the nickname list. fires events so the protocol can
* show the userinfo - tooltip.
@@ -1428,13 +1415,13 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS return;
}
- BOOL bNewTip = FALSE;
+ bool bNewTip = false;
if (!hwndToolTip) {
hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hwnd, NULL, g_hInst, NULL);
- bNewTip = TRUE;
+ bNewTip = true;
}
RECT clientRect;
@@ -1485,16 +1472,11 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, static int currentHovered = -1;
switch (msg) {
- //MAD: attemp to fix weird bug, when combobox with hidden vscroll
- //can't be scrolled with mouse-wheel.
-
case WM_NCCALCSIZE:
if (CSkin::m_DisableScrollbars) {
RECT lpRect;
- LONG itemHeight;
-
- GetClientRect (hwnd, &lpRect);
- itemHeight = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
+ GetClientRect(hwnd, &lpRect);
+ LONG itemHeight = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
g_cLinesPerPage = (lpRect.bottom - lpRect.top) /itemHeight ;
}
return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, NicklistSubclassProc);
@@ -1506,16 +1488,14 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, {
HDC dc = (HDC)wParam;
struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- SESSION_INFO *parentdat = (SESSION_INFO *)dat->si;
+ SESSION_INFO *parentdat = (SESSION_INFO*)dat->si;
if (dc) {
- int height, index, items = 0;
-
- index = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
+ int index = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
if (index == LB_ERR || parentdat->nUsersInNicklist <= 0)
return 0;
- items = parentdat->nUsersInNicklist - index;
- height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
+ int items = parentdat->nUsersInNicklist - index;
+ int height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
if (height != LB_ERR) {
RECT rc = {0};
@@ -1533,7 +1513,6 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_MOUSEWHEEL:
if (CSkin::m_DisableScrollbars) {
UINT uScroll;
- int dLines;
short zDelta=(short)HIWORD(wParam);
if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uScroll, 0))
uScroll = 3; /* default value */
@@ -1545,19 +1524,18 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, zDelta += g_iWheelCarryover; /* Accumulate wheel motion */
- dLines = zDelta * (int)uScroll / WHEEL_DELTA;
-
+ int dLines = zDelta * (int)uScroll / WHEEL_DELTA;
//Record the unused portion as the next carryover.
g_iWheelCarryover = zDelta - dLines * WHEEL_DELTA / (int)uScroll;
-
// scrolling.
while (abs(dLines)) {
if (dLines > 0) {
SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0);
dLines--;
- } else {
+ }
+ else {
SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0);
dLines++;
}
@@ -1574,7 +1552,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT ||
wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
if (mwdat && mwdat->si) {
- SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
+ SESSION_INFO *si = (SESSION_INFO*)mwdat->si;
si->szSearch[0] = 0;
si->iSearchItem = -1;
}
@@ -1583,8 +1561,8 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_SETFOCUS:
case WM_KILLFOCUS:
- if (mwdat && mwdat->si) { // set/kill focus invalidates incremental search status
- SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
+ if (mwdat && mwdat->si) { // set/kill focus invalidates incremental search status
+ SESSION_INFO *si = (SESSION_INFO*)mwdat->si;
si->szSearch[0] = 0;
si->iSearchItem = -1;
}
@@ -1597,7 +1575,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, * typing esc or movement keys will clear the current search string
*/
if (mwdat && mwdat->si) {
- SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
+ SESSION_INFO *si = (SESSION_INFO*)mwdat->si;
if (wParam == 27 && si->szSearch[0]) { // escape - reset everything
si->szSearch[0] = 0;
si->iSearchItem = -1;
@@ -1683,7 +1661,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, int height;
USERINFO *ui;
struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- SESSION_INFO *parentdat = (SESSION_INFO *)dat->si;
+ SESSION_INFO *parentdat = (SESSION_INFO*)dat->si;
hti.pt.x = (short) LOWORD(lParam);
hti.pt.y = (short) HIWORD(lParam);
@@ -1779,7 +1757,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (PtInRect(&clientRect, pt)) {
//hit test item under mouse
struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- SESSION_INFO *parentdat = (SESSION_INFO *)dat->si;
+ SESSION_INFO *parentdat = (SESSION_INFO*)dat->si;
DWORD nItemUnderMouse = (DWORD)SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
if (HIWORD(nItemUnderMouse) == 1)
@@ -1904,24 +1882,25 @@ static void __cdecl phase2(void * lParam) INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- SESSION_INFO * si = NULL;
+ SESSION_INFO *si = NULL;
HWND hwndTab = GetParent(hwndDlg);
struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat)
- si = (SESSION_INFO *)dat->si;
+ si = (SESSION_INFO*)dat->si;
if (dat == NULL && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS))
return 0;
+ CHARFORMAT2 cf;
+
switch (uMsg) {
- case WM_INITDIALOG: {
- int mask;
- struct TNewWindowData *newData = (struct TNewWindowData *) lParam;
- struct TWindowData *dat;
+ case WM_INITDIALOG:
+ {
+ TNewWindowData *newData = (TNewWindowData*)lParam;
SESSION_INFO *psi = (SESSION_INFO*)newData->hdbEvent;
RECT rc;
- dat = (TWindowData*)calloc( sizeof(TWindowData), 1);
+ TWindowData *dat = (TWindowData*)calloc( sizeof(TWindowData), 1);
si = psi;
dat->si = psi;
dat->hContact = psi->hContact;
@@ -1988,7 +1967,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING, 0);
- mask = (int)SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETEVENTMASK, 0, 0);
+ int mask = (int)SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETEVENTMASK, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS);
#if defined(__FEAT_EXP_AUTOSPLITTER)
@@ -2010,7 +1989,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_HIDESELECTION, TRUE, 0);
CreateWindowEx(0, _T("TSButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
- hwndDlg, (HMENU)IDC_CHAT_TOGGLESIDEBAR, g_hInst, NULL);
+ hwndDlg, (HMENU)IDC_CHAT_TOGGLESIDEBAR, g_hInst, NULL);
GetMYUIN(dat);
GetMyNick(dat);
@@ -2022,8 +2001,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar dat->hwndIEView = dat->hwndHPP = 0;
- //Chat_SetMessageLog(dat);
-
SendMessage(hwndDlg, GC_SETWNDPROPS, 0, 0);
SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(hwndDlg, GC_UPDATETITLE, 0, 1);
@@ -2037,25 +2014,24 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar }
break;
- case WM_SETFOCUS:
- if (CMimAPI::m_shutDown)
- break;
+ case WM_SETFOCUS:
+ if (CMimAPI::m_shutDown)
+ break;
- Chat_UpdateWindowState(dat, WM_SETFOCUS);
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- return 1;
+ Chat_UpdateWindowState(dat, WM_SETFOCUS);
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ return 1;
- case WM_TIMECHANGE:
- PostMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- break;
+ case WM_TIMECHANGE:
+ PostMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
+ break;
- case DM_LOADBUTTONBARICONS: {
- BB_UpdateIcons(hwndDlg, dat);
- return 0;
- }
+ case DM_LOADBUTTONBARICONS:
+ BB_UpdateIcons(hwndDlg, dat);
+ return 0;
- case GC_SETWNDPROPS: {
- //HICON hIcon;
+ case GC_SETWNDPROPS:
+ {
COLORREF colour = M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
InitButtons(hwndDlg, si);
ConfigureSmileyButton(dat);
@@ -2068,26 +2044,20 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar InvalidateRect(GetDlgItem(hwndDlg, IDC_LIST), NULL, TRUE);
}
SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETOVERLAYICON,
- (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
+ (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
}
break;
- case DM_UPDATETITLE:
- return(SendMessage(hwndDlg, GC_UPDATETITLE, wParam, lParam));
-
- case GC_UPDATETITLE: {
- TCHAR szTemp [100];
- HICON hIcon;
- BOOL fNoCopy = TRUE;
- const TCHAR* szNick = dat->cache->getNick();
-
- if (dat->bWasDeleted)
- return 0;
+ case DM_UPDATETITLE:
+ return(SendMessage(hwndDlg, GC_UPDATETITLE, wParam, lParam));
+ case GC_UPDATETITLE:
+ if (!dat->bWasDeleted) {
dat->wStatus = si->wStatus;
+ const TCHAR *szNick = dat->cache->getNick();
if (lstrlen(szNick) > 0) {
if (M.GetByte("cuttitle", 0))
CutContactName(szNick, dat->newtitle, SIZEOF(dat->newtitle));
@@ -2097,24 +2067,26 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar }
}
+ TCHAR szTemp[100];
+ HICON hIcon;
+
switch (si->iType) {
- case GCW_CHATROOM:
- hIcon = dat->wStatus <= ID_STATUS_OFFLINE ? LoadSkinnedProtoIcon(si->pszModule, ID_STATUS_OFFLINE) : LoadSkinnedProtoIcon(si->pszModule, dat->wStatus);
- fNoCopy = FALSE;
- mir_sntprintf(szTemp, SIZEOF(szTemp),
- (si->nUsersInNicklist == 1) ? TranslateT("%s: Chat Room (%u user%s)") :
- TranslateT("%s: Chat Room (%u users%s)"),
- si->ptszName, si->nUsersInNicklist, si->bFilterEnabled ? TranslateT(", event filter active") : _T(""));
- break;
- case GCW_PRIVMESS:
- mir_sntprintf(szTemp, SIZEOF(szTemp),
- (si->nUsersInNicklist == 1) ? TranslateT("%s: Message Session") :
- TranslateT("%s: Message Session (%u users)"), si->ptszName, si->nUsersInNicklist);
- break;
- case GCW_SERVER:
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s: Server"), si->ptszName);
- hIcon = LoadIconEx(IDI_CHANMGR, "window", 16, 16);
- break;
+ case GCW_CHATROOM:
+ hIcon = (dat->wStatus <= ID_STATUS_OFFLINE) ? LoadSkinnedProtoIcon(si->pszModule, ID_STATUS_OFFLINE) : LoadSkinnedProtoIcon(si->pszModule, dat->wStatus);
+ mir_sntprintf(szTemp, SIZEOF(szTemp),
+ (si->nUsersInNicklist == 1) ? TranslateT("%s: Chat Room (%u user%s)") :
+ TranslateT("%s: Chat Room (%u users%s)"),
+ si->ptszName, si->nUsersInNicklist, si->bFilterEnabled ? TranslateT(", event filter active") : _T(""));
+ break;
+ case GCW_PRIVMESS:
+ mir_sntprintf(szTemp, SIZEOF(szTemp),
+ (si->nUsersInNicklist == 1) ? TranslateT("%s: Message Session") :
+ TranslateT("%s: Message Session (%u users)"), si->ptszName, si->nUsersInNicklist);
+ break;
+ case GCW_SERVER:
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s: Server"), si->ptszName);
+ hIcon = LoadIconEx(IDI_CHANMGR, "window", 16, 16);
+ break;
}
if (dat->pWnd) {
@@ -2146,179 +2118,179 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar }
break;
- case GC_UPDATESTATUSBAR:
- if (dat->bWasDeleted)
- return 0;
+ case GC_UPDATESTATUSBAR:
+ if (dat->bWasDeleted)
+ return 0;
- if (dat->pContainer->hwndActive != hwndDlg || dat->pContainer->hwndStatus == 0 || CMimAPI::m_shutDown || dat->szStatusBar[0])
- break;
+ if (dat->pContainer->hwndActive != hwndDlg || dat->pContainer->hwndStatus == 0 || CMimAPI::m_shutDown || dat->szStatusBar[0])
+ break;
- if (si->pszModule != NULL) {
- TCHAR szFinalStatusBarText[512];
+ if (si->pszModule != NULL) {
+ TCHAR szFinalStatusBarText[512];
- //Mad: strange rare crash here...
- MODULEINFO *mi = MM_FindModule(si->pszModule);
- if (!mi)
- break;
+ //Mad: strange rare crash here...
+ MODULEINFO *mi = MM_FindModule(si->pszModule);
+ if (!mi)
+ break;
- if (!mi->ptszModDispName)
- break;
+ if (!mi->ptszModDispName)
+ break;
- int x = 12;
- x += GetTextPixelSize(mi->ptszModDispName, (HFONT)SendMessage(dat->pContainer->hwndStatus, WM_GETFONT, 0, 0), TRUE);
- x += GetSystemMetrics(SM_CXSMICON);
-
- if (dat->Panel->isActive()) {
- time_t now = time(0);
- DWORD diff = (now - mi->idleTimeStamp) / 60;
-
- if ((diff >= 1 && diff != mi->lastIdleCheck) || lParam) {
- mi->lastIdleCheck = diff;
- if (diff == 0)
- mi->tszIdleMsg[0] = 0;
- else if (diff > 59) {
- DWORD hours = diff / 60;
- DWORD minutes = diff % 60;
- mir_sntprintf(mi->tszIdleMsg, 60, TranslateT(", %d %s, %d %s idle"), hours, hours > 1 ?
- TranslateT("hours") : TranslateT("hour"),
- minutes, minutes > 1 ? TranslateT("minutes") : TranslateT("minute"));
- }
- else
- mir_sntprintf(mi->tszIdleMsg, 60, TranslateT(", %d %s idle"),
- diff, diff > 1 ? TranslateT("minutes") : TranslateT("minute"));
+ int x = 12;
+ x += GetTextPixelSize(mi->ptszModDispName, (HFONT)SendMessage(dat->pContainer->hwndStatus, WM_GETFONT, 0, 0), TRUE);
+ x += GetSystemMetrics(SM_CXSMICON);
+
+ if (dat->Panel->isActive()) {
+ time_t now = time(0);
+ DWORD diff = (now - mi->idleTimeStamp) / 60;
+
+ if ((diff >= 1 && diff != mi->lastIdleCheck) || lParam) {
+ mi->lastIdleCheck = diff;
+ if (diff == 0)
+ mi->tszIdleMsg[0] = 0;
+ else if (diff > 59) {
+ DWORD hours = diff / 60;
+ DWORD minutes = diff % 60;
+ mir_sntprintf(mi->tszIdleMsg, 60, TranslateT(", %d %s, %d %s idle"), hours, hours > 1 ?
+ TranslateT("hours") : TranslateT("hour"),
+ minutes, minutes > 1 ? TranslateT("minutes") : TranslateT("minute"));
}
- mir_sntprintf(szFinalStatusBarText, SIZEOF(szFinalStatusBarText), TranslateT("%s on %s%s"), dat->szMyNickname, mi->ptszModDispName, mi->tszIdleMsg);
+ else
+ mir_sntprintf(mi->tszIdleMsg, 60, TranslateT(", %d %s idle"),
+ diff, diff > 1 ? TranslateT("minutes") : TranslateT("minute"));
}
+ mir_sntprintf(szFinalStatusBarText, SIZEOF(szFinalStatusBarText), TranslateT("%s on %s%s"), dat->szMyNickname, mi->ptszModDispName, mi->tszIdleMsg);
+ }
+ else {
+ if (si->ptszStatusbarText)
+ mir_sntprintf(szFinalStatusBarText, SIZEOF(szFinalStatusBarText), _T("%s %s"), mi->ptszModDispName, si->ptszStatusbarText);
else {
- if (si->ptszStatusbarText)
- mir_sntprintf(szFinalStatusBarText, SIZEOF(szFinalStatusBarText), _T("%s %s"), mi->ptszModDispName, si->ptszStatusbarText);
- else {
- lstrcpyn(szFinalStatusBarText, mi->ptszModDispName, SIZEOF(szFinalStatusBarText));
- szFinalStatusBarText[511] = 0;
- }
+ lstrcpyn(szFinalStatusBarText, mi->ptszModDispName, SIZEOF(szFinalStatusBarText));
+ szFinalStatusBarText[511] = 0;
}
- SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)szFinalStatusBarText);
- UpdateStatusBar(dat);
- dat->Panel->Invalidate();
- if (dat->pWnd)
- dat->pWnd->Invalidate();
- return TRUE;
}
- break;
+ SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)szFinalStatusBarText);
+ UpdateStatusBar(dat);
+ dat->Panel->Invalidate();
+ if (dat->pWnd)
+ dat->pWnd->Invalidate();
+ return TRUE;
+ }
+ break;
- case WM_SIZE:
- if (dat->ipFieldHeight == 0)
- dat->ipFieldHeight = CInfoPanel::m_ipConfig.height1;
+ case WM_SIZE:
+ if (dat->ipFieldHeight == 0)
+ dat->ipFieldHeight = CInfoPanel::m_ipConfig.height1;
- if (wParam == SIZE_MAXIMIZED)
- PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
+ if (wParam == SIZE_MAXIMIZED)
+ PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
- if ( !IsIconic(hwndDlg)) {
- int panelHeight = dat->Panel->getHeight() + 1;
+ if ( !IsIconic(hwndDlg)) {
+ int panelHeight = dat->Panel->getHeight() + 1;
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = g_hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = (LPARAM)si;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_CHANNEL);
- urd.pfnResizer = RoomWndResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ UTILRESIZEDIALOG urd = { sizeof(urd) };
+ urd.hInstance = g_hInst;
+ urd.hwndDlg = hwndDlg;
+ urd.lParam = (LPARAM)si;
+ urd.lpTemplate = MAKEINTRESOURCEA(IDD_CHANNEL);
+ urd.pfnResizer = RoomWndResize;
+ CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
- BB_SetButtonsPos(dat);
+ BB_SetButtonsPos(dat);
- RECT rc;
- GetClientRect(hwndDlg, &rc);
- int cx = rc.right;
+ RECT rc;
+ GetClientRect(hwndDlg, &rc);
+ int cx = rc.right;
- rc.left = panelHeight <= CInfoPanel::LEFT_OFFSET_LOGO ? panelHeight : CInfoPanel::LEFT_OFFSET_LOGO;
- rc.right = cx;
- rc.top = 1;
- rc.bottom = (panelHeight > CInfoPanel::DEGRADE_THRESHOLD ? rc.top + dat->ipFieldHeight - 2 : panelHeight - 1);
- dat->rcNick = rc;
+ rc.left = panelHeight <= CInfoPanel::LEFT_OFFSET_LOGO ? panelHeight : CInfoPanel::LEFT_OFFSET_LOGO;
+ rc.right = cx;
+ rc.top = 1;
+ rc.bottom = (panelHeight > CInfoPanel::DEGRADE_THRESHOLD ? rc.top + dat->ipFieldHeight - 2 : panelHeight - 1);
+ dat->rcNick = rc;
- rc.left = panelHeight <= CInfoPanel::LEFT_OFFSET_LOGO ? panelHeight : CInfoPanel::LEFT_OFFSET_LOGO;
- rc.right = cx;
- rc.bottom = panelHeight - 2;
- rc.top = dat->rcNick.bottom + 1;
- dat->rcUIN = rc;
+ rc.left = panelHeight <= CInfoPanel::LEFT_OFFSET_LOGO ? panelHeight : CInfoPanel::LEFT_OFFSET_LOGO;
+ rc.right = cx;
+ rc.bottom = panelHeight - 2;
+ rc.top = dat->rcNick.bottom + 1;
+ dat->rcUIN = rc;
- if (dat->hwndIEView || dat->hwndHPP)
- Chat_ResizeIeView(dat);
- DetermineMinHeight(dat);
- }
- break;
+ if (dat->hwndIEView || dat->hwndHPP)
+ Chat_ResizeIeView(dat);
+ DetermineMinHeight(dat);
+ }
+ break;
- case GC_REDRAWWINDOW:
- InvalidateRect(hwndDlg, NULL, TRUE);
- break;
+ case GC_REDRAWWINDOW:
+ InvalidateRect(hwndDlg, NULL, TRUE);
+ break;
- case GC_REDRAWLOG:
- si->LastTime = 0;
- if (si->pLog) {
- LOGINFO * pLog = si->pLog;
- if (si->iEventCount > 60) {
- int index = 0;
- while (index < 59) {
- if (pLog->next == NULL)
- break;
- pLog = pLog->next;
- if (si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0)
- index++;
- }
- Log_StreamInEvent(hwndDlg, pLog, si, TRUE, FALSE);
- mir_forkthread(phase2, si);
+ case GC_REDRAWLOG:
+ si->LastTime = 0;
+ if (si->pLog) {
+ LOGINFO * pLog = si->pLog;
+ if (si->iEventCount > 60) {
+ int index = 0;
+ while (index < 59) {
+ if (pLog->next == NULL)
+ break;
+ pLog = pLog->next;
+ if (si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0)
+ index++;
}
- else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
+ Log_StreamInEvent(hwndDlg, pLog, si, TRUE, FALSE);
+ mir_forkthread(phase2, si);
}
- else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
- break;
-
- case GC_REDRAWLOG2:
- si->LastTime = 0;
- if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
- break;
+ else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
+ }
+ else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ break;
- case GC_REDRAWLOG3:
- si->LastTime = 0;
- if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, TRUE);
- break;
+ case GC_REDRAWLOG2:
+ si->LastTime = 0;
+ if (si->pLog)
+ Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
+ break;
- case GC_ADDLOG:
- {
- bool fInactive = (GetForegroundWindow() != dat->pContainer->hwnd || GetActiveWindow() != dat->pContainer->hwnd);
+ case GC_REDRAWLOG3:
+ si->LastTime = 0;
+ if (si->pLog)
+ Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, TRUE);
+ break;
- if (g_Settings.bUseDividers && g_Settings.bDividersUsePopupConfig) {
- if (!MessageWindowOpened(0, (LPARAM)hwndDlg))
- SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
- }
- else if (g_Settings.bUseDividers) {
- if (fInactive)
- SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
- else if (dat->pContainer->hwndActive != hwndDlg)
- SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
- }
+ case GC_ADDLOG:
+ {
+ bool fInactive = (GetForegroundWindow() != dat->pContainer->hwnd || GetActiveWindow() != dat->pContainer->hwnd);
- if (si->pLogEnd)
- Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE, FALSE);
- else
- SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ if (g_Settings.bUseDividers && g_Settings.bDividersUsePopupConfig) {
+ if (!MessageWindowOpened(0, (LPARAM)hwndDlg))
+ SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
+ }
+ else if (g_Settings.bUseDividers) {
+ if (fInactive)
+ SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
+ else if (dat->pContainer->hwndActive != hwndDlg)
+ SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
}
- break;
- case GC_ACKMESSAGE:
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, FALSE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETTEXT, 0, (LPARAM)_T(""));
- return TRUE;
+ if (si->pLogEnd)
+ Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE, FALSE);
+ else
+ SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ }
+ break;
- case WM_CTLCOLORLISTBOX:
- SetBkColor((HDC) wParam, g_Settings.crUserListBGColor);
- return (INT_PTR) hListBkgBrush;
+ case GC_ACKMESSAGE:
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, FALSE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETTEXT, 0, (LPARAM)_T(""));
+ return TRUE;
- case WM_MEASUREITEM: {
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
+ case WM_CTLCOLORLISTBOX:
+ SetBkColor((HDC) wParam, g_Settings.crUserListBGColor);
+ return (INT_PTR) hListBkgBrush;
+ case WM_MEASUREITEM:
+ {
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
if (mis->CtlType == ODT_MENU) {
if (dat->Panel->isHovered()) {
mis->itemHeight = 0;
@@ -2327,14 +2299,13 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar }
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
}
- else
- mis->itemHeight = g_Settings.iNickListFontHeight;
- return TRUE;
+ mis->itemHeight = g_Settings.iNickListFontHeight;
}
+ return TRUE;
- case WM_DRAWITEM: {
+ case WM_DRAWITEM:
+ {
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
-
if (dis->CtlType == ODT_MENU) {
if (dat->Panel->isHovered()) {
DrawMenuItem(dis, (HICON)dis->itemData, 0);
@@ -2342,120 +2313,122 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
}
- else {
- if (dis->CtlID == IDC_LIST) {
- int offset, x_offset = 0;
- int height;
- int index = dis->itemID;
- USERINFO *ui = UM_FindUserFromIndex(si->pUsers, index);
- char szIndicator = 0;
- if (ui) {
- height = dis->rcItem.bottom - dis->rcItem.top;
+ if (dis->CtlID == IDC_LIST) {
+ int offset, x_offset = 0;
+ int height;
+ int index = dis->itemID;
+ USERINFO *ui = UM_FindUserFromIndex(si->pUsers, index);
+ char szIndicator = 0;
- if (height&1)
- height++;
- if (height == 10)
- offset = 0;
- else
- offset = height / 2;
- HICON hIcon = SM_GetStatusIcon(si, ui, &szIndicator);
- HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx];
- HFONT hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
- SetBkMode(dis->hDC, TRANSPARENT);
-
- if (dis->itemState & ODS_SELECTED) {
- FillRect(dis->hDC, &dis->rcItem, g_Settings.SelectionBGBrush);
- SetTextColor(dis->hDC, g_Settings.nickColors[6]);
- }
- else {
- FillRect(dis->hDC, &dis->rcItem, hListBkgBrush);
- if (g_Settings.bColorizeNicks && szIndicator != 0) {
- COLORREF clr;
- switch (szIndicator) {
- case '@':
- clr = g_Settings.nickColors[0];
- break;
- case '%':
- clr = g_Settings.nickColors[1];
- break;
- case '+':
- clr = g_Settings.nickColors[2];
- break;
- case '!':
- clr = g_Settings.nickColors[3];
- break;
- case '*':
- clr = g_Settings.nickColors[4];
- break;
- }
- SetTextColor(dis->hDC, clr);
+ if (ui) {
+ height = dis->rcItem.bottom - dis->rcItem.top;
+
+ if (height&1)
+ height++;
+ if (height == 10)
+ offset = 0;
+ else
+ offset = height / 2;
+ HICON hIcon = SM_GetStatusIcon(si, ui, &szIndicator);
+ HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx];
+ HFONT hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
+ SetBkMode(dis->hDC, TRANSPARENT);
+
+ if (dis->itemState & ODS_SELECTED) {
+ FillRect(dis->hDC, &dis->rcItem, g_Settings.SelectionBGBrush);
+ SetTextColor(dis->hDC, g_Settings.nickColors[6]);
+ }
+ else {
+ FillRect(dis->hDC, &dis->rcItem, hListBkgBrush);
+ if (g_Settings.bColorizeNicks && szIndicator != 0) {
+ COLORREF clr;
+ switch (szIndicator) {
+ case '@':
+ clr = g_Settings.nickColors[0];
+ break;
+ case '%':
+ clr = g_Settings.nickColors[1];
+ break;
+ case '+':
+ clr = g_Settings.nickColors[2];
+ break;
+ case '!':
+ clr = g_Settings.nickColors[3];
+ break;
+ case '*':
+ clr = g_Settings.nickColors[4];
+ break;
}
- else SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]);
+ SetTextColor(dis->hDC, clr);
}
- x_offset = 2;
+ else SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]);
+ }
+ x_offset = 2;
- if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
- x_offset += 18;
- }
+ if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ Skin_ReleaseIcon(hIcon);
+ x_offset += 18;
+ }
- if (g_Settings.bClassicIndicators) {
- char szTemp[3];
- SIZE szUmode;
-
- szTemp[1] = 0;
- szTemp[0] = szIndicator;
- if (szTemp[0]) {
- GetTextExtentPoint32A(dis->hDC, szTemp, 1, &szUmode);
- TextOutA(dis->hDC, x_offset, dis->rcItem.top, szTemp, 1);
- x_offset += szUmode.cx + 2;
- } else x_offset += 8;
- } else {
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 5, hIcon, 10, 10, 0, NULL, DI_NORMAL);
- x_offset += 12;
- }
+ if (g_Settings.bClassicIndicators) {
+ char szTemp[3];
+ SIZE szUmode;
+
+ szTemp[1] = 0;
+ szTemp[0] = szIndicator;
+ if (szTemp[0]) {
+ GetTextExtentPoint32A(dis->hDC, szTemp, 1, &szUmode);
+ TextOutA(dis->hDC, x_offset, dis->rcItem.top, szTemp, 1);
+ x_offset += szUmode.cx + 2;
+ } else x_offset += 8;
+ } else {
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 5, hIcon, 10, 10, 0, NULL, DI_NORMAL);
+ x_offset += 12;
+ }
- if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
- x_offset += 18;
- }
+ if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ Skin_ReleaseIcon(hIcon);
+ x_offset += 18;
+ }
- {
- SIZE sz;
-
- if (si->iSearchItem != -1 && si->iSearchItem == index && si->szSearch[0]) {
- COLORREF clr_orig = GetTextColor(dis->hDC);
- GetTextExtentPoint32(dis->hDC, ui->pszNick, lstrlen(si->szSearch), &sz);
- SetTextColor(dis->hDC, RGB(250, 250, 0));
- TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, lstrlen(si->szSearch));
- SetTextColor(dis->hDC, clr_orig);
- x_offset += sz.cx;
- TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + lstrlen(si->szSearch), lstrlen(ui->pszNick) - lstrlen(si->szSearch));
- } else {
- GetTextExtentPoint32(dis->hDC, ui->pszNick, lstrlen(ui->pszNick), &sz);
- TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, lstrlen(ui->pszNick));
- SelectObject(dis->hDC, hOldFont);
- }
+ {
+ SIZE sz;
+
+ if (si->iSearchItem != -1 && si->iSearchItem == index && si->szSearch[0]) {
+ COLORREF clr_orig = GetTextColor(dis->hDC);
+ GetTextExtentPoint32(dis->hDC, ui->pszNick, lstrlen(si->szSearch), &sz);
+ SetTextColor(dis->hDC, RGB(250, 250, 0));
+ TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, lstrlen(si->szSearch));
+ SetTextColor(dis->hDC, clr_orig);
+ x_offset += sz.cx;
+ TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + lstrlen(si->szSearch), lstrlen(ui->pszNick) - lstrlen(si->szSearch));
+ } else {
+ GetTextExtentPoint32(dis->hDC, ui->pszNick, lstrlen(ui->pszNick), &sz);
+ TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, lstrlen(ui->pszNick));
+ SelectObject(dis->hDC, hOldFont);
}
}
- return TRUE;
}
+ return TRUE;
}
}
break;
- case WM_CONTEXTMENU:{
- //mad
- DWORD idFrom=GetDlgCtrlID((HWND)wParam);
- if (idFrom>=MIN_CBUTTONID&&idFrom<=MAX_CBUTTONID)
- BB_CustomButtonClick(dat,idFrom,(HWND) wParam,1);
- }break;
- //
- case GC_UPDATENICKLIST: {
+
+ case WM_CONTEXTMENU:
+ {
+ DWORD idFrom = GetDlgCtrlID((HWND)wParam);
+ if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID)
+ BB_CustomButtonClick(dat, idFrom, (HWND)wParam, 1);
+ }
+ break;
+
+ case GC_UPDATENICKLIST:
+ {
int i = SendMessage(GetDlgItem(hwndDlg, IDC_LIST), LB_GETTOPINDEX, 0, 0);
SendMessage(GetDlgItem(hwndDlg, IDC_LIST), LB_SETCOUNT, si->nUsersInNicklist, 0);
SendMessage(GetDlgItem(hwndDlg, IDC_LIST), LB_SETTOPINDEX, i, 0);
@@ -2463,77 +2436,70 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar }
break;
- case GC_EVENT_CONTROL + WM_USER + 500: {
- switch (wParam) {
- case SESSION_OFFLINE:
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
- return TRUE;
+ case GC_EVENT_CONTROL + WM_USER + 500:
+ switch (wParam) {
+ case SESSION_OFFLINE:
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
+ SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
+ return TRUE;
- case SESSION_ONLINE:
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- return TRUE;
+ case SESSION_ONLINE:
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
+ return TRUE;
- case WINDOW_HIDDEN:
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 1);
- return TRUE;
+ case WINDOW_HIDDEN:
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 1);
+ return TRUE;
- case WINDOW_CLEARLOG:
- SetDlgItemText(hwndDlg, IDC_CHAT_LOG, _T(""));
- return TRUE;
+ case WINDOW_CLEARLOG:
+ SetDlgItemText(hwndDlg, IDC_CHAT_LOG, _T(""));
+ return TRUE;
- case SESSION_TERMINATE:
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString);
+ case SESSION_TERMINATE:
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString);
- si->wState &= ~STATE_TALK;
- dat->bWasDeleted = 1;
- db_set_w(si->hContact, si->pszModule , "ApparentMode", (LPARAM)0);
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, lParam == 2 ? lParam : 1);
- return TRUE;
+ si->wState &= ~STATE_TALK;
+ dat->bWasDeleted = 1;
+ db_set_w(si->hContact, si->pszModule , "ApparentMode", (LPARAM)0);
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, lParam == 2 ? lParam : 1);
+ return TRUE;
- case WINDOW_MINIMIZE:
- ShowWindow(hwndDlg, SW_MINIMIZE);
- goto LABEL_SHOWWINDOW;
+ case WINDOW_MINIMIZE:
+ ShowWindow(hwndDlg, SW_MINIMIZE);
+ goto LABEL_SHOWWINDOW;
- case WINDOW_MAXIMIZE:
- ShowWindow(hwndDlg, SW_MAXIMIZE);
- goto LABEL_SHOWWINDOW;
+ case WINDOW_MAXIMIZE:
+ ShowWindow(hwndDlg, SW_MAXIMIZE);
+ goto LABEL_SHOWWINDOW;
- case SESSION_INITDONE:
- if (M.GetByte("Chat", "PopupOnJoin", 0) != 0)
- return TRUE;
- // fall through
- case WINDOW_VISIBLE:
- if (IsIconic(hwndDlg))
- ShowWindow(hwndDlg, SW_NORMAL);
+ case SESSION_INITDONE:
+ if (M.GetByte("Chat", "PopupOnJoin", 0) != 0)
+ return TRUE;
+ // fall through
+ case WINDOW_VISIBLE:
+ if (IsIconic(hwndDlg))
+ ShowWindow(hwndDlg, SW_NORMAL);
LABEL_SHOWWINDOW:
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- ShowWindow(hwndDlg, SW_SHOW);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SetForegroundWindow(hwndDlg);
- return TRUE;
- }
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
+ ShowWindow(hwndDlg, SW_SHOW);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SetForegroundWindow(hwndDlg);
+ return TRUE;
}
break;
- case DM_SPLITTERMOVED: {
- POINT pt;
- RECT rc;
- RECT rcLog;
- BOOL bFormat = TRUE; //IsWindowVisible(GetDlgItem(hwndDlg,IDC_SMILEY));
-
- static int x = 0;
-
+ case DM_SPLITTERMOVED:
+ {
+ RECT rc, rcLog;
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog);
if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERX)) {
int oldSplitterX;
GetClientRect(hwndDlg, &rc);
- pt.x = wParam;
- pt.y = 0;
+ POINT pt = { wParam, 0 };
ScreenToClient(hwndDlg, &pt);
oldSplitterX = si->iSplitterX;
@@ -2544,15 +2510,15 @@ LABEL_SHOWWINDOW: si->iSplitterX = rc.right - rc.left - 35;
g_Settings.iSplitterX = si->iSplitterX;
SendMessage(dat->hwnd, WM_SIZE, 0, 0);
- } else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY) || lParam == -1) {
- int oldSplitterY;
+ }
+ else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY) || lParam == -1) {
GetClientRect(hwndDlg, &rc);
rc.top += (dat->Panel->isActive() ? dat->Panel->getHeight() + 40 : 30);
- pt.x = 0;
- pt.y = wParam;
+ POINT pt = { 0, wParam };
ScreenToClient(hwndDlg, &pt);
- oldSplitterY = si->iSplitterY;
+ BOOL bFormat = TRUE; //IsWindowVisible(GetDlgItem(hwndDlg,IDC_SMILEY));
+ int oldSplitterY = si->iSplitterY;
si->iSplitterY = bFormat ? rc.bottom - pt.y + DPISCALEY_S(1) : rc.bottom - pt.y + DPISCALEY_S(20);
if (si->iSplitterY < DPISCALEY_S(23))
si->iSplitterY = DPISCALEY_S(23);
@@ -2561,11 +2527,9 @@ LABEL_SHOWWINDOW: g_Settings.iSplitterY = si->iSplitterY;
CSkin::UpdateToolbarBG(dat, RDW_ALLCHILDREN);
SendMessage(dat->hwnd, WM_SIZE, 0, 0);
- } else if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) {
- RECT rc;
- POINT pt;
- pt.x = 0;
- pt.y = wParam;
+ }
+ else if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) {
+ POINT pt = { 0, wParam };
ScreenToClient(hwndDlg, &pt);
GetClientRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rc);
if ((pt.y + 2 >= MIN_PANELHEIGHT + 2) && (pt.y + 2 < 100) && (pt.y + 2 < rc.bottom - 30))
@@ -2580,49 +2544,46 @@ LABEL_SHOWWINDOW: }
break;
- case GC_FIREHOOK:
- if (lParam) {
- GCHOOK* gch = (GCHOOK *) lParam;
- NotifyEventHooks(hSendEvent, 0, (WPARAM)gch);
- if (gch->pDest) {
- mir_free(gch->pDest->pszID);
- mir_free(gch->pDest->pszModule);
- mir_free(gch->pDest);
- }
- mir_free(gch->ptszText);
- mir_free(gch->ptszUID);
- mir_free(gch);
+ case GC_FIREHOOK:
+ if (lParam) {
+ GCHOOK* gch = (GCHOOK *) lParam;
+ NotifyEventHooks(hSendEvent, 0, (WPARAM)gch);
+ if (gch->pDest) {
+ mir_free(gch->pDest->pszID);
+ mir_free(gch->pDest->pszModule);
+ mir_free(gch->pDest);
}
- break;
+ mir_free(gch->ptszText);
+ mir_free(gch->ptszUID);
+ mir_free(gch);
+ }
+ break;
- case GC_CHANGEFILTERFLAG:
- if (si->iLogFilterFlags == 0 && si->bFilterEnabled)
- SendMessage(hwndDlg, WM_COMMAND, IDC_FILTER, 0);
- break;
+ case GC_CHANGEFILTERFLAG:
+ if (si->iLogFilterFlags == 0 && si->bFilterEnabled)
+ SendMessage(hwndDlg, WM_COMMAND, IDC_FILTER, 0);
+ break;
- case GC_SHOWFILTERMENU: {
+ case GC_SHOWFILTERMENU:
+ si->hwndFilter = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), dat->pContainer->hwnd, FilterWndProc, (LPARAM)si);
+ TranslateDialogDefault(si->hwndFilter);
+ {
RECT rcFilter, rcLog;
- POINT pt;
-
- si->hwndFilter = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), dat->pContainer->hwnd, FilterWndProc, (LPARAM)si);
- TranslateDialogDefault(si->hwndFilter);
-
GetClientRect(si->hwndFilter, &rcFilter);
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog);
- pt.x = rcLog.right;
- pt.y = rcLog.bottom;
+ POINT pt = { rcLog.right, rcLog.bottom };
ScreenToClient(dat->pContainer->hwnd, &pt);
SetWindowPos(si->hwndFilter, HWND_TOP, pt.x - rcFilter.right, pt.y - rcFilter.bottom, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
}
break;
- case DM_SPLITTERGLOBALEVENT: {
- DM_SplitterGlobalEvent(dat, wParam, lParam);
- return 0;
- }
+ case DM_SPLITTERGLOBALEVENT:
+ DM_SplitterGlobalEvent(dat, wParam, lParam);
+ return 0;
- case GC_SHOWCOLORCHOOSER: {
+ case GC_SHOWCOLORCHOOSER:
+ {
HWND ColorWindow;
RECT rc;
bool bFG = (lParam == IDC_COLOR);
@@ -2640,389 +2601,389 @@ LABEL_SHOWWINDOW: }
break;
- case GC_SCROLLTOBOTTOM:
- DM_ScrollToBottom(dat, wParam, lParam);
- return 0;
+ case GC_SCROLLTOBOTTOM:
+ DM_ScrollToBottom(dat, wParam, lParam);
+ return 0;
- case WM_TIMER:
- if (wParam == TIMERID_FLASHWND)
- if (dat->mayFlashTab)
- FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, TRUE, dat->hTabIcon);
- break;
+ case WM_TIMER:
+ if (wParam == TIMERID_FLASHWND)
+ if (dat->mayFlashTab)
+ FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, TRUE, dat->hTabIcon);
+ break;
- case WM_ACTIVATE:
- if (LOWORD(wParam) != WA_ACTIVE) {
- dat->pContainer->hwndSaved = 0;
- break;
- }
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) != WA_ACTIVE) {
+ dat->pContainer->hwndSaved = 0;
+ break;
+ }
- //fall through
- case WM_MOUSEACTIVATE:
- Chat_UpdateWindowState(dat, WM_ACTIVATE);
- return 1;
+ //fall through
+ case WM_MOUSEACTIVATE:
+ Chat_UpdateWindowState(dat, WM_ACTIVATE);
+ return 1;
- case WM_NOTIFY: {
- LPNMHDR pNmhdr = (LPNMHDR)lParam;
- switch (pNmhdr->code) {
- case EN_MSGFILTER: {
- UINT msg = ((MSGFILTER *) lParam)->msg;
- WPARAM wp = ((MSGFILTER *) lParam)->wParam;
- LPARAM lp = ((MSGFILTER *) lParam)->lParam;
-
- BOOL isShift, isCtrl, isMenu;
- KbdState(dat, isShift, isCtrl, isMenu);
-
- MSG message;
- message.hwnd = hwndDlg;
- message.message = msg;
- message.lParam = lp;
- message.wParam = wp;
-
- if (msg == WM_SYSKEYUP) {
- if (wp == VK_MENU) {
- if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
- dat->pContainer->MenuBar->autoShow();
- }
- return(_dlgReturn(hwndDlg, 0));
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case EN_MSGFILTER:
+ {
+ UINT msg = ((MSGFILTER *) lParam)->msg;
+ WPARAM wp = ((MSGFILTER *) lParam)->wParam;
+ LPARAM lp = ((MSGFILTER *) lParam)->lParam;
+
+ BOOL isShift, isCtrl, isMenu;
+ KbdState(dat, isShift, isCtrl, isMenu);
+
+ MSG message;
+ message.hwnd = hwndDlg;
+ message.message = msg;
+ message.lParam = lp;
+ message.wParam = wp;
+
+ if (msg == WM_SYSKEYUP) {
+ if (wp == VK_MENU) {
+ if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
+ dat->pContainer->MenuBar->autoShow();
}
+ return(_dlgReturn(hwndDlg, 0));
+ }
- if (msg == WM_MOUSEMOVE) {
- POINT pt;
- GetCursorPos(&pt);
- DM_DismissTip(dat, pt);
- dat->Panel->trackMouse(pt);
- break;
- }
- if (msg == WM_KEYDOWN) {
- if ((wp == VK_INSERT && isShift && !isCtrl && !isMenu) || (wp == 'V' && !isShift && !isMenu && isCtrl)) {
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_PASTESPECIAL, CF_UNICODETEXT, 0);
- ((MSGFILTER *) lParam)->msg = WM_NULL;
- ((MSGFILTER *) lParam)->wParam = 0;
- ((MSGFILTER *) lParam)->lParam = 0;
- return(_dlgReturn(hwndDlg, 1));
- }
+ if (msg == WM_MOUSEMOVE) {
+ POINT pt;
+ GetCursorPos(&pt);
+ DM_DismissTip(dat, pt);
+ dat->Panel->trackMouse(pt);
+ break;
+ }
+ if (msg == WM_KEYDOWN) {
+ if ((wp == VK_INSERT && isShift && !isCtrl && !isMenu) || (wp == 'V' && !isShift && !isMenu && isCtrl)) {
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_PASTESPECIAL, CF_UNICODETEXT, 0);
+ ((MSGFILTER *) lParam)->msg = WM_NULL;
+ ((MSGFILTER *) lParam)->wParam = 0;
+ ((MSGFILTER *) lParam)->lParam = 0;
+ return(_dlgReturn(hwndDlg, 1));
}
+ }
- if (msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN)
- dat->pContainer->MenuBar->Cancel();
-
- if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
+ if (msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN)
+ dat->pContainer->MenuBar->Cancel();
- if (DM_GenericHotkeysCheck(&message, dat)) {
- dat->fkeyProcessed = true;
- return(_dlgReturn(hwndDlg, 1));
- }
+ if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
+ if (DM_GenericHotkeysCheck(&message, dat)) {
+ dat->fkeyProcessed = true;
+ return(_dlgReturn(hwndDlg, 1));
+ }
- LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC));
- if (mim_hotkey_check)
- dat->fkeyProcessed = true;
- switch(mim_hotkey_check) { // nothing (yet) FIXME
- case TABSRMM_HK_CHANNELMGR:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
- case TABSRMM_HK_FILTERTOGGLE:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FILTER), NULL, TRUE);
- return(_dlgReturn(hwndDlg, 1));
- case TABSRMM_HK_LISTTOGGLE:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
- return(_dlgReturn(hwndDlg, 1));
- case TABSRMM_HK_MUC_SHOWSERVER:
- if (si->iType != GCW_SERVER)
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0);
- return(_dlgReturn(hwndDlg, 1));
- }
+ LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC));
+ if (mim_hotkey_check)
+ dat->fkeyProcessed = true;
+ switch(mim_hotkey_check) { // nothing (yet) FIXME
+ case TABSRMM_HK_CHANNELMGR:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0);
+ return(_dlgReturn(hwndDlg, 1));
+ case TABSRMM_HK_FILTERTOGGLE:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FILTER), NULL, TRUE);
+ return(_dlgReturn(hwndDlg, 1));
+ case TABSRMM_HK_LISTTOGGLE:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
+ return(_dlgReturn(hwndDlg, 1));
+ case TABSRMM_HK_MUC_SHOWSERVER:
+ if (si->iType != GCW_SERVER)
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0);
+ return(_dlgReturn(hwndDlg, 1));
}
+ }
- if (msg == WM_KEYDOWN && wp == VK_TAB) {
- if (((NMHDR *)lParam)->idFrom == IDC_CHAT_LOG) {
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- return(_dlgReturn(hwndDlg, 1));
- }
+ if (msg == WM_KEYDOWN && wp == VK_TAB) {
+ if (((NMHDR *)lParam)->idFrom == IDC_CHAT_LOG) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ return(_dlgReturn(hwndDlg, 1));
}
+ }
- if (pNmhdr->idFrom == IDC_CHAT_LOG && ((MSGFILTER *) lParam)->msg == WM_RBUTTONUP) {
- CHARRANGE sel, all = { 0, -1 };
- POINT pt;
- UINT uID = 0;
- HMENU hMenu = 0;
- TCHAR pszWord[4096];
- int pos;
-
- pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
- pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
- ClientToScreen(pNmhdr->hwndFrom, &pt);
-
- { // fixing stuff for searches
- long iCharIndex, iLineIndex, iChars, start, end, iRes;
- POINTL ptl;
-
- pszWord[0] = '\0';
- ptl.x = (LONG)pt.x;
- ptl.y = (LONG)pt.y;
- ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LOG), (LPPOINT)&ptl);
- iCharIndex = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_CHARFROMPOS, 0, (LPARAM)& ptl);
- if (iCharIndex < 0)
- break;
- iLineIndex = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXLINEFROMCHAR, 0, (LPARAM)iCharIndex);
- iChars = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_LINEINDEX, (WPARAM)iLineIndex, 0);
- start = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_FINDWORDBREAK, WB_LEFT, iCharIndex);//-iChars;
- end = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);//-iChars;
-
- if (end - start > 0) {
- TEXTRANGE tr;
- CHARRANGE cr;
- static char szTrimString[] = ":;,.!?\'\"><()[]- \r\n";
- ZeroMemory(&tr, sizeof(TEXTRANGE));
-
- cr.cpMin = start;
- cr.cpMax = end;
- tr.chrg = cr;
- tr.lpstrText = (TCHAR *)pszWord;
- iRes = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_GETTEXTRANGE, 0, (LPARAM)& tr);
-
- if (iRes > 0) {
- int iLen = lstrlen(pszWord) - 1;
- while (iLen >= 0 && strchr(szTrimString, pszWord[iLen])) {
- pszWord[iLen] = '\0';
- iLen--;
- }
+ if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_LOG && ((MSGFILTER *) lParam)->msg == WM_RBUTTONUP) {
+ CHARRANGE sel, all = { 0, -1 };
+ POINT pt;
+ UINT uID = 0;
+ HMENU hMenu = 0;
+ TCHAR pszWord[4096];
+ int pos;
+
+ pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
+ pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
+ ClientToScreen(((LPNMHDR)lParam)->hwndFrom, &pt);
+
+ { // fixing stuff for searches
+ long iCharIndex, iLineIndex, iChars, start, end, iRes;
+ POINTL ptl;
+
+ pszWord[0] = '\0';
+ ptl.x = (LONG)pt.x;
+ ptl.y = (LONG)pt.y;
+ ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LOG), (LPPOINT)&ptl);
+ iCharIndex = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_CHARFROMPOS, 0, (LPARAM)& ptl);
+ if (iCharIndex < 0)
+ break;
+ iLineIndex = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXLINEFROMCHAR, 0, (LPARAM)iCharIndex);
+ iChars = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_LINEINDEX, (WPARAM)iLineIndex, 0);
+ start = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_FINDWORDBREAK, WB_LEFT, iCharIndex);//-iChars;
+ end = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);//-iChars;
+
+ if (end - start > 0) {
+ TEXTRANGE tr;
+ CHARRANGE cr;
+ static char szTrimString[] = ":;,.!?\'\"><()[]- \r\n";
+ ZeroMemory(&tr, sizeof(TEXTRANGE));
+
+ cr.cpMin = start;
+ cr.cpMax = end;
+ tr.chrg = cr;
+ tr.lpstrText = (TCHAR *)pszWord;
+ iRes = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_GETTEXTRANGE, 0, (LPARAM)& tr);
+
+ if (iRes > 0) {
+ int iLen = lstrlen(pszWord) - 1;
+ while (iLen >= 0 && strchr(szTrimString, pszWord[iLen])) {
+ pszWord[iLen] = '\0';
+ iLen--;
}
}
}
+ }
- uID = CreateGCMenu(hwndDlg, &hMenu, 1, pt, si, NULL, pszWord);
-
- if ((uID > 800 && uID < 1400) || uID == CP_UTF8 || uID == 20866) {
- dat->codePage = uID;
- db_set_dw(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage);
- }
- else if (uID == 500) {
- dat->codePage = CP_ACP;
- db_unset(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
- }
- else switch (uID) {
- case 0:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_COPYALL:
- SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM)& sel);
- SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM)& all);
- SendMessage(pNmhdr->hwndFrom, WM_COPY, 0, 0);
- SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM)& sel);
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
+ uID = CreateGCMenu(hwndDlg, &hMenu, 1, pt, si, NULL, pszWord);
- case ID_CLEARLOG:
- ClearLog(dat);
- break;
+ if ((uID > 800 && uID < 1400) || uID == CP_UTF8 || uID == 20866) {
+ dat->codePage = uID;
+ db_set_dw(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage);
+ }
+ else if (uID == 500) {
+ dat->codePage = CP_ACP;
+ db_unset(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
+ }
+ else switch (uID) {
+ case 0:
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- case ID_SEARCH_GOOGLE:
- if (pszWord[0]) {
- TCHAR szURL[4096];
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)szURL);
- }
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
+ case ID_COPYALL:
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)& sel);
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)& all);
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, WM_COPY, 0, 0);
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)& sel);
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- case ID_SEARCH_WIKIPEDIA:
- if (pszWord[0]) {
- TCHAR szURL[4096];
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)szURL);
- }
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
+ case ID_CLEARLOG:
+ ClearLog(dat);
+ break;
- default:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
- break;
+ case ID_SEARCH_GOOGLE:
+ if (pszWord[0]) {
+ TCHAR szURL[4096];
+ mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)szURL);
}
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- if (si->iType != GCW_SERVER && !(si->dwFlags & GC_UNICODE)) {
- pos = GetMenuItemCount(hMenu);
- RemoveMenu(hMenu, pos - 1, MF_BYPOSITION);
- RemoveMenu(PluginConfig.g_hMenuEncoding, 1, MF_BYPOSITION);
+ case ID_SEARCH_WIKIPEDIA:
+ if (pszWord[0]) {
+ TCHAR szURL[4096];
+ mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)szURL);
}
- DestroyGCMenu(&hMenu, 5);
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
+
+ default:
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
+ break;
}
- break;
- }
- case EN_REQUESTRESIZE: {
- if (pNmhdr->idFrom == IDC_CHAT_MESSAGE) {
- REQRESIZE *rr = (REQRESIZE *)lParam;
- DM_HandleAutoSizeRequest(dat, rr);
+ if (si->iType != GCW_SERVER && !(si->dwFlags & GC_UNICODE)) {
+ pos = GetMenuItemCount(hMenu);
+ RemoveMenu(hMenu, pos - 1, MF_BYPOSITION);
+ RemoveMenu(PluginConfig.g_hMenuEncoding, 1, MF_BYPOSITION);
}
- break;
+ DestroyGCMenu(&hMenu, 5);
}
+ }
+ break;
- case EN_LINK:
- if (pNmhdr->idFrom == IDC_CHAT_LOG) {
- switch (((ENLINK *) lParam)->msg) {
- case WM_SETCURSOR:
-
- if (g_Settings.bClickableNicks) {
- if (!hCurHyperlinkHand)
- hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
- if (hCurHyperlinkHand != GetCursor())
- SetCursor(hCurHyperlinkHand);
- return TRUE;
- }
- break;
+ case EN_REQUESTRESIZE:
+ if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_MESSAGE) {
+ REQRESIZE *rr = (REQRESIZE *)lParam;
+ DM_HandleAutoSizeRequest(dat, rr);
+ }
+ break;
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_LBUTTONDBLCLK: {
- TEXTRANGE tr;
- CHARRANGE sel;
- BOOL isLink = FALSE;
- UINT msg = ((ENLINK *) lParam)->msg;
+ case EN_LINK:
+ if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_LOG) {
+ switch (((ENLINK *) lParam)->msg) {
+ case WM_SETCURSOR:
- dat->pContainer->MenuBar->Cancel();
+ if (g_Settings.bClickableNicks) {
+ if (!hCurHyperlinkHand)
+ hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
+ if (hCurHyperlinkHand != GetCursor())
+ SetCursor(hCurHyperlinkHand);
+ return TRUE;
+ }
+ break;
- tr.lpstrText = NULL;
- SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM)& sel);
- if (sel.cpMin != sel.cpMax)
- break;
- tr.chrg = ((ENLINK *) lParam)->chrg;
- tr.lpstrText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (tr.chrg.cpMax - tr.chrg.cpMin + 2));
- SendMessage(pNmhdr->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)& tr);
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_LBUTTONDBLCLK:
+ {
+ TEXTRANGE tr;
+ CHARRANGE sel;
+ UINT msg = ((ENLINK *) lParam)->msg;
- isLink = IsStringValidLink(tr.lpstrText);
+ dat->pContainer->MenuBar->Cancel();
- if (isLink) {
- if (((ENLINK *) lParam)->msg == WM_RBUTTONDOWN) {
- HMENU hSubMenu;
+ tr.lpstrText = NULL;
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)& sel);
+ if (sel.cpMin != sel.cpMax)
+ break;
+ tr.chrg = ((ENLINK *) lParam)->chrg;
+ tr.lpstrText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (tr.chrg.cpMax - tr.chrg.cpMin + 2));
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)& tr);
+
+ BOOL isLink = IsStringValidLink(tr.lpstrText);
+ if (isLink) {
+ if (((ENLINK *) lParam)->msg == WM_RBUTTONDOWN) {
+ HMENU hSubMenu;
+ POINT pt;
+
+ hSubMenu = GetSubMenu(g_hMenu, 2);
+ TranslateMenu(hSubMenu);
+ pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
+ pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
+ ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt);
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
+ case ID_NEW:
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tr.lpstrText);
+ break;
+ case ID_CURR:
+ CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)tr.lpstrText);
+ break;
+ case ID_COPY:
+ if (!OpenClipboard(hwndDlg))
+ break;
+ EmptyClipboard();
+ {
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (lstrlen(tr.lpstrText) + 1));
+ lstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText);
+ GlobalUnlock(hData);
+ SetClipboardData(CF_UNICODETEXT, hData);
+ }
+ CloseClipboard();
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ break;
+ }
+ mir_free(tr.lpstrText);
+ return TRUE;
+ }
+ if (((ENLINK *) lParam)->msg == WM_LBUTTONUP) {
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tr.lpstrText);
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ mir_free(tr.lpstrText);
+ return TRUE;
+ }
+ }
+ else if (g_Settings.bClickableNicks) { // clicked a nick name
+ CHARRANGE chr;
+ TEXTRANGE tr2;
+ TCHAR tszAplTmpl[] = _T("%s:"),
+ *tszAppeal, *tszTmp;
+ size_t st;
+
+ if (msg == WM_RBUTTONDOWN) {
+ USERINFO *ui = si->pUsers;
+ HMENU hMenu = 0;
+ USERINFO uiNew;
+ while (ui) {
+ if (!lstrcmp(ui->pszNick, tr.lpstrText)) {
POINT pt;
+ UINT uID;
- hSubMenu = GetSubMenu(g_hMenu, 2);
- TranslateMenu(hSubMenu);
pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
- case ID_NEW:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tr.lpstrText);
- break;
- case ID_CURR:
- CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)tr.lpstrText);
- break;
- case ID_COPY: {
- if (!OpenClipboard(hwndDlg))
- break;
- EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (lstrlen(tr.lpstrText) + 1));
- lstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText);
- GlobalUnlock(hData);
- SetClipboardData(CF_UNICODETEXT, hData);
- }
- CloseClipboard();
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ CopyMemory(&uiNew, ui, sizeof(USERINFO));
+ uID = CreateGCMenu(hwndDlg, &hMenu, 0, pt, si, uiNew.pszUID, NULL);
+ switch (uID) {
+ case 0:
+ break;
+
+ case ID_MESS:
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ break;
+
+ default:
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
break;
}
- mir_free(tr.lpstrText);
- return TRUE;
- } else if (((ENLINK *) lParam)->msg == WM_LBUTTONUP) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tr.lpstrText);
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- mir_free(tr.lpstrText);
- return TRUE;
- }
- } else if (g_Settings.bClickableNicks) { // clicked a nick name
- CHARRANGE chr;
- TEXTRANGE tr2;
- TCHAR tszAplTmpl[] = _T("%s:"),
- *tszAppeal, *tszTmp;
- size_t st;
-
- if (msg == WM_RBUTTONDOWN) {
- USERINFO *ui = si->pUsers;
- HMENU hMenu = 0;
- USERINFO uiNew;
- while (ui) {
- if (!lstrcmp(ui->pszNick, tr.lpstrText)) {
- POINT pt;
- UINT uID;
-
- pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
- pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
- ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt);
- CopyMemory(&uiNew, ui, sizeof(USERINFO));
- uID = CreateGCMenu(hwndDlg, &hMenu, 0, pt, si, uiNew.pszUID, NULL);
- switch (uID) {
- case 0:
- break;
-
- case ID_MESS:
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- break;
-
- default:
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
- break;
- }
- DestroyGCMenu(&hMenu, 1);
- return TRUE;
- }
- ui = ui->next;
- }
+ DestroyGCMenu(&hMenu, 1);
return TRUE;
}
- else if (msg == WM_LBUTTONUP) {
- USERINFO *ui = si->pUsers;
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr);
- size_t bufSize = lstrlen(tr.lpstrText) + lstrlen(tszAplTmpl) + 3;
- tszTmp = tszAppeal = (TCHAR*)malloc(bufSize * sizeof(TCHAR));
- tr2.lpstrText = (LPTSTR) malloc(sizeof(TCHAR) * 2);
- if (chr.cpMin) {
- /* prepend nick with space if needed */
- tr2.chrg.cpMin = chr.cpMin - 1;
- tr2.chrg.cpMax = chr.cpMin;
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2);
- if (! _istspace(*tr2.lpstrText))
- *tszTmp++ = _T(' ');
- _tcscpy(tszTmp, tr.lpstrText);
- }
- else
- /* in the beginning of the message window */
- mir_sntprintf(tszAppeal, bufSize, tszAplTmpl, tr.lpstrText);
- st = lstrlen(tszAppeal);
- if (chr.cpMax != -1) {
- tr2.chrg.cpMin = chr.cpMax;
- tr2.chrg.cpMax = chr.cpMax + 1;
- /* if there is no space after selection,
- or there is nothing after selection at all... */
- if (! SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || ! _istspace(*tr2.lpstrText)) {
- tszAppeal[st++] = _T(' ');
- tszAppeal[st++] = _T('\0');
- }
- }
- else {
- tszAppeal[st++] = _T(' ');
- tszAppeal[st++] = _T('\0');
- }
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszAppeal);
- free((void*) tr2.lpstrText);
- free((void*) tszAppeal);
- }
+ ui = ui->next;
}
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- mir_free(tr.lpstrText);
return TRUE;
}
+ else if (msg == WM_LBUTTONUP) {
+ USERINFO *ui = si->pUsers;
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr);
+ size_t bufSize = lstrlen(tr.lpstrText) + lstrlen(tszAplTmpl) + 3;
+ tszTmp = tszAppeal = (TCHAR*)malloc(bufSize * sizeof(TCHAR));
+ tr2.lpstrText = (LPTSTR) malloc(sizeof(TCHAR) * 2);
+ if (chr.cpMin) {
+ /* prepend nick with space if needed */
+ tr2.chrg.cpMin = chr.cpMin - 1;
+ tr2.chrg.cpMax = chr.cpMin;
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2);
+ if (! _istspace(*tr2.lpstrText))
+ *tszTmp++ = _T(' ');
+ _tcscpy(tszTmp, tr.lpstrText);
+ }
+ else
+ /* in the beginning of the message window */
+ mir_sntprintf(tszAppeal, bufSize, tszAplTmpl, tr.lpstrText);
+ st = lstrlen(tszAppeal);
+ if (chr.cpMax != -1) {
+ tr2.chrg.cpMin = chr.cpMax;
+ tr2.chrg.cpMax = chr.cpMax + 1;
+ /* if there is no space after selection,
+ or there is nothing after selection at all... */
+ if (! SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || ! _istspace(*tr2.lpstrText)) {
+ tszAppeal[st++] = _T(' ');
+ tszAppeal[st++] = _T('\0');
+ }
+ }
+ else {
+ tszAppeal[st++] = _T(' ');
+ tszAppeal[st++] = _T('\0');
+ }
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszAppeal);
+ free((void*) tr2.lpstrText);
+ free((void*) tszAppeal);
+ }
}
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ mir_free(tr.lpstrText);
return TRUE;
}
- return TRUE;
+ }
+ return TRUE;
}
+ return TRUE;
}
break;
- case WM_LBUTTONDOWN: {
+ case WM_LBUTTONDOWN:
+ {
POINT tmp; //+ Protogenes
POINTS cur; //+ Protogenes
GetCursorPos(&tmp); //+ Protogenes
@@ -3031,10 +2992,11 @@ LABEL_SHOWWINDOW: cur.y = (SHORT)tmp.y; //+ Protogenes
SendMessage(dat->pContainer->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, *((LPARAM*)(&cur))); //+ Protogenes
}
- break;
}
+ break;
- case WM_LBUTTONUP: {
+ case WM_LBUTTONUP:
+ {
POINT tmp; //+ Protogenes
POINTS cur; //+ Protogenes
GetCursorPos(&tmp); //+ Protogenes
@@ -3045,17 +3007,20 @@ LABEL_SHOWWINDOW: cur.y = (SHORT)tmp.y; //+ Protogenes
SendMessage(dat->pContainer->hwnd, WM_NCLBUTTONUP, HTCAPTION, *((LPARAM*)(&cur))); //+ Protogenes
}
- break;
}
+ break;
- case WM_MOUSEMOVE: {
+ case WM_MOUSEMOVE:
+ {
POINT pt;
GetCursorPos(&pt);
DM_DismissTip(dat, pt);
dat->Panel->trackMouse(pt);
- break;
}
- case WM_APPCOMMAND: {
+ break;
+
+ case WM_APPCOMMAND:
+ {
DWORD cmd = GET_APPCOMMAND_LPARAM(lParam);
if (cmd == APPCOMMAND_BROWSER_BACKWARD || cmd == APPCOMMAND_BROWSER_FORWARD) {
SendMessage(dat->pContainer->hwnd, DM_SELECTTAB, cmd == APPCOMMAND_BROWSER_BACKWARD ? DM_SELECT_PREV : DM_SELECT_NEXT, 0);
@@ -3064,279 +3029,270 @@ LABEL_SHOWWINDOW: }
break;
- case WM_COMMAND:
- //mad
- if (LOWORD(wParam)>=MIN_CBUTTONID&&LOWORD(wParam)<=MAX_CBUTTONID){
- BB_CustomButtonClick(dat,LOWORD(wParam) ,GetDlgItem(hwndDlg,LOWORD(wParam)),0);
- break;
- }
- //
- switch (LOWORD(wParam)) {
- case IDC_LIST:
- if (HIWORD(wParam) == LBN_DBLCLK) {
- TVHITTESTINFO hti;
- int item;
- USERINFO *ui;
-
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(GetDlgItem(hwndDlg, IDC_LIST), &hti.pt);
-
- item = LOWORD(SendMessage(GetDlgItem(hwndDlg, IDC_LIST), LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- ui = UM_FindUserFromIndex(si->pUsers, item);
- //ui = SM_GetUserFromIndex(si->pszID, si->pszModule, item);
- if (ui) {
- if (g_Settings.bDoubleClick4Privat ? GetKeyState(VK_SHIFT) & 0x8000 : !(GetKeyState(VK_SHIFT) & 0x8000)) {
- LRESULT lResult = (LRESULT)SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_GETSEL, 0, 0);
- int start = LOWORD(lResult);
- TCHAR* pszName = (TCHAR*)alloca(sizeof(TCHAR) * (lstrlen(ui->pszUID) + 3));
- if (start == 0)
- mir_sntprintf(pszName, lstrlen(ui->pszUID) + 3, _T("%s: "), ui->pszUID);
- else
- mir_sntprintf(pszName, lstrlen(ui->pszUID) + 2, _T("%s "), ui->pszUID);
-
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM)pszName);
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- } else DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- }
-
- return TRUE;
- } else if (HIWORD(wParam) == LBN_KILLFOCUS)
- RedrawWindow(GetDlgItem(hwndDlg, IDC_LIST), NULL, NULL, RDW_INVALIDATE);
- break;
-
- case IDC_CHAT_TOGGLESIDEBAR:
- SendMessage(dat->pContainer->hwnd, WM_COMMAND, IDC_TOGGLESIDEBAR, 0);
- break;
+ case WM_COMMAND:
+ if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID){
+ BB_CustomButtonClick(dat, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0);
+ break;
+ }
- case IDCANCEL:
- ShowWindow(dat->pContainer->hwnd, SW_MINIMIZE);
- return FALSE;
+ switch (LOWORD(wParam)) {
+ case IDC_LIST:
+ if (HIWORD(wParam) == LBN_DBLCLK) {
+ TVHITTESTINFO hti;
+ int item;
+ USERINFO *ui;
- case IDOK:
- if (GetSendButtonState(hwndDlg) != PBS_DISABLED) {
- MODULEINFO *mi = MM_FindModule(si->pszModule);
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(GetDlgItem(hwndDlg, IDC_LIST), &hti.pt);
+
+ item = LOWORD(SendMessage(GetDlgItem(hwndDlg, IDC_LIST), LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
+ ui = UM_FindUserFromIndex(si->pUsers, item);
+ //ui = SM_GetUserFromIndex(si->pszID, si->pszModule, item);
+ if (ui) {
+ if (g_Settings.bDoubleClick4Privat ? GetKeyState(VK_SHIFT) & 0x8000 : !(GetKeyState(VK_SHIFT) & 0x8000)) {
+ LRESULT lResult = (LRESULT)SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_GETSEL, 0, 0);
+ int start = LOWORD(lResult);
+ TCHAR* pszName = (TCHAR*)alloca(sizeof(TCHAR) * (lstrlen(ui->pszUID) + 3));
+ if (start == 0)
+ mir_sntprintf(pszName, lstrlen(ui->pszUID) + 3, _T("%s: "), ui->pszUID);
+ else
+ mir_sntprintf(pszName, lstrlen(ui->pszUID) + 2, _T("%s "), ui->pszUID);
- ptrA pszRtf( Chat_Message_GetFromStream(hwndDlg, si));
- SM_AddCommand(si->ptszID, si->pszModule, pszRtf);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM)pszName);
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ } else DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ }
- ptrT ptszText( Chat_DoRtfToTags(pszRtf, si));
- if ((TCHAR*)ptszText == NULL)
- break;
+ return TRUE;
+ } else if (HIWORD(wParam) == LBN_KILLFOCUS)
+ RedrawWindow(GetDlgItem(hwndDlg, IDC_LIST), NULL, NULL, RDW_INVALIDATE);
+ break;
- DoTrimMessage(ptszText);
+ case IDC_CHAT_TOGGLESIDEBAR:
+ SendMessage(dat->pContainer->hwnd, WM_COMMAND, IDC_TOGGLESIDEBAR, 0);
+ break;
- if (mi && mi->bAckMsg) {
- Utils::enableDlgControl(hwndDlg, IDC_CHAT_MESSAGE, FALSE);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, TRUE, 0);
- }
- else SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETTEXT, 0, (LPARAM)_T(""));
+ case IDCANCEL:
+ ShowWindow(dat->pContainer->hwnd, SW_MINIMIZE);
+ return FALSE;
- Utils::enableDlgControl(hwndDlg, IDOK, FALSE);
+ case IDOK:
+ if (GetSendButtonState(hwndDlg) != PBS_DISABLED) {
+ MODULEINFO *mi = MM_FindModule(si->pszModule);
- bool fSound = true;
- if (ptszText[0] == '/' || si->iType == GCW_SERVER)
- fSound = false;
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
- mi->idleTimeStamp = time(0);
- mi->lastIdleCheck = 0;
- SM_BroadcastMessage(si->pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE);
- if (dat && dat->pContainer)
- if (fSound && !nen_options.iNoSounds && !(dat->pContainer->dwFlags & CNT_NOSOUND))
- SkinPlaySound("ChatSent");
+ ptrA pszRtf( Chat_Message_GetFromStream(hwndDlg, si));
+ SM_AddCommand(si->ptszID, si->pszModule, pszRtf);
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- }
+ ptrT ptszText( Chat_DoRtfToTags(pszRtf, si));
+ if ((TCHAR*)ptszText == NULL)
break;
- case IDC_SHOWNICKLIST:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST)))
- break;
- if (si->iType == GCW_SERVER)
- break;
+ DoTrimMessage(ptszText);
- si->bNicklistEnabled = !si->bNicklistEnabled;
+ if (mi && mi->bAckMsg) {
+ Utils::enableDlgControl(hwndDlg, IDC_CHAT_MESSAGE, FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, TRUE, 0);
+ }
+ else SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETTEXT, 0, (LPARAM)_T(""));
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- if (CSkin::m_skinEnabled)
- InvalidateRect(hwndDlg, NULL, TRUE);
- PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
- break;
+ Utils::enableDlgControl(hwndDlg, IDOK, FALSE);
- case IDC_CHAT_MESSAGE:
- if (g_Settings.bMathMod)
- MTH_updateMathWindow(dat);
-
- if (HIWORD(wParam) == EN_CHANGE) {
- if (dat->pContainer->hwndActive == hwndDlg)
- UpdateReadChars(dat);
- dat->dwLastActivity = GetTickCount();
- dat->pContainer->dwLastActivity = dat->dwLastActivity;
- SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASNORMAL, GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)) != 0, 0);
- Utils::enableDlgControl(hwndDlg, IDOK, GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)) != 0);
- }
- break;
+ bool fSound = true;
+ if (ptszText[0] == '/' || si->iType == GCW_SERVER)
+ fSound = false;
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
+ mi->idleTimeStamp = time(0);
+ mi->lastIdleCheck = 0;
+ SM_BroadcastMessage(si->pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE);
+ if (dat && dat->pContainer)
+ if (fSound && !nen_options.iNoSounds && !(dat->pContainer->dwFlags & CNT_NOSOUND))
+ SkinPlaySound("ChatSent");
- case IDC_SMILEY:
- case IDC_SMILEYBTN: {
- SMADD_SHOWSEL3 smaddInfo = {0};
- RECT rc;
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ }
+ break;
- if (lParam == 0)
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc);
- else
- GetWindowRect((HWND)lParam, &rc);
- smaddInfo.cbSize = sizeof(SMADD_SHOWSEL3);
- smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
- smaddInfo.targetMessage = EM_REPLACESEL;
- smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = si->pszModule;
- smaddInfo.Direction = 0;
- smaddInfo.xPosition = rc.left;
- smaddInfo.yPosition = rc.top + 24;
- smaddInfo.hContact = si->hContact;
- smaddInfo.hwndParent = dat->pContainer->hwnd;
- if (PluginConfig.g_SmileyAddAvail)
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
- }
+ case IDC_SHOWNICKLIST:
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST)))
+ break;
+ if (si->iType == GCW_SERVER)
break;
- case IDC_CHAT_HISTORY: {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ si->bNicklistEnabled = !si->bNicklistEnabled;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_HISTORY)))
- break;
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ if (CSkin::m_skinEnabled)
+ InvalidateRect(hwndDlg, NULL, TRUE);
+ PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
+ break;
- if (ServiceExists("MSP/HTMLlog/ViewLog") && strstr(si->pszModule, "IRC")) {
- char szName[MAX_PATH];
+ case IDC_CHAT_MESSAGE:
+ if (g_Settings.bMathMod)
+ MTH_updateMathWindow(dat);
- WideCharToMultiByte(CP_ACP, 0, si->ptszName, -1, szName, MAX_PATH, 0, 0);
- szName[MAX_PATH - 1] = 0;
- CallService("MSP/HTMLlog/ViewLog", (WPARAM)si->pszModule, (LPARAM)szName);
- } else if (pInfo)
- ShellExecute(hwndDlg, NULL, GetChatLogsFilename(si, 0), NULL, NULL, SW_SHOW);
- }
- break;
+ if (HIWORD(wParam) == EN_CHANGE) {
+ if (dat->pContainer->hwndActive == hwndDlg)
+ UpdateReadChars(dat);
+ dat->dwLastActivity = GetTickCount();
+ dat->pContainer->dwLastActivity = dat->dwLastActivity;
+ SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASNORMAL, GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)) != 0, 0);
+ Utils::enableDlgControl(hwndDlg, IDOK, GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)) != 0);
+ }
+ break;
- case IDC_CHAT_CLOSE:
- SendMessage(hwndDlg, WM_CLOSE, 0, 1);
- break;
+ case IDC_SMILEY:
+ case IDC_SMILEYBTN:
+ {
+ RECT rc;
+ if (lParam == 0)
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc);
+ else
+ GetWindowRect((HWND)lParam, &rc);
+
+ SMADD_SHOWSEL3 smaddInfo = { sizeof(smaddInfo) };
+ smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
+ smaddInfo.targetMessage = EM_REPLACESEL;
+ smaddInfo.targetWParam = TRUE;
+ smaddInfo.Protocolname = si->pszModule;
+ smaddInfo.Direction = 0;
+ smaddInfo.xPosition = rc.left;
+ smaddInfo.yPosition = rc.top + 24;
+ smaddInfo.hContact = si->hContact;
+ smaddInfo.hwndParent = dat->pContainer->hwnd;
+ if (PluginConfig.g_SmileyAddAvail)
+ CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
+ }
+ break;
- case IDC_CHANMGR:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHANMGR)))
- break;
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
- break;
+ case IDC_CHAT_HISTORY:
+ if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_HISTORY))) {
+ MODULEINFO *pInfo = MM_FindModule(si->pszModule);
+ if (ServiceExists("MSP/HTMLlog/ViewLog") && strstr(si->pszModule, "IRC")) {
+ char szName[MAX_PATH];
+ WideCharToMultiByte(CP_ACP, 0, si->ptszName, -1, szName, MAX_PATH, 0, 0);
+ szName[MAX_PATH - 1] = 0;
+ CallService("MSP/HTMLlog/ViewLog", (WPARAM)si->pszModule, (LPARAM)szName);
+ }
+ else if (pInfo)
+ ShellExecute(hwndDlg, NULL, GetChatLogsFilename(si, 0), NULL, NULL, SW_SHOW);
+ }
+ break;
- case IDC_FILTER:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FILTER)))
- break;
+ case IDC_CHAT_CLOSE:
+ SendMessage(hwndDlg, WM_CLOSE, 0, 1);
+ break;
- if (si->iLogFilterFlags == 0 && !si->bFilterEnabled) {
- MessageBox(0, TranslateT("The filter canoot be enabled, because there are no event types selected either global or for this chat room"), TranslateT("Event filter error"), MB_OK);
- si->bFilterEnabled = 0;
- } else
- si->bFilterEnabled = !si->bFilterEnabled;
+ case IDC_CHANMGR:
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHANMGR)))
+ break;
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
+ break;
- SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETOVERLAYICON,
- (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
+ case IDC_FILTER:
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FILTER)))
+ break;
- if (si->bFilterEnabled && M.GetByte("Chat", "RightClickFilter", 0) == 0) {
- SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
- break;
- }
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- SendMessage(hwndDlg, GC_UPDATETITLE, 0, 0);
- db_set_b(si->hContact, "Chat", "FilterEnabled", (BYTE)si->bFilterEnabled);
- break;
+ if (si->iLogFilterFlags == 0 && !si->bFilterEnabled) {
+ MessageBox(0, TranslateT("The filter canoot be enabled, because there are no event types selected either global or for this chat room"), TranslateT("Event filter error"), MB_OK);
+ si->bFilterEnabled = 0;
+ } else
+ si->bFilterEnabled = !si->bFilterEnabled;
- case IDC_BKGCOLOR: {
- CHARFORMAT2 cf;
+ SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETOVERLAYICON,
+ (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
+ if (si->bFilterEnabled && M.GetByte("Chat", "RightClickFilter", 0) == 0) {
+ SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
+ break;
+ }
+ SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATETITLE, 0, 0);
+ db_set_b(si->hContact, "Chat", "FilterEnabled", (BYTE)si->bFilterEnabled);
+ break;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BKGCOLOR)))
- break;
+ case IDC_BKGCOLOR:
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
- if (IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR)) {
- if (M.GetByte("Chat", "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR);
- else if (si->bBGSet) {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = MM_FindModule(si->pszModule)->crColors[si->iBG];
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- } else {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BKGCOLOR)))
break;
- case IDC_COLOR: {
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
-
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_COLOR)))
- break;
+ if (IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR)) {
+ if (M.GetByte("Chat", "RightClickFilter", 0) == 0)
+ SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR);
+ else if (si->bBGSet) {
+ cf.dwMask = CFM_BACKCOLOR;
+ cf.crBackColor = MM_FindModule(si->pszModule)->crColors[si->iBG];
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ }
+ else {
+ cf.dwMask = CFM_BACKCOLOR;
+ cf.crBackColor = (COLORREF)M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ break;
- if (IsDlgButtonChecked(hwndDlg, IDC_COLOR)) {
- if (M.GetByte("Chat", "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR);
- else if (si->bFGSet) {
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = MM_FindModule(si->pszModule)->crColors[si->iFG];
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- } else {
- COLORREF cr;
+ case IDC_COLOR:
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
- LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE);
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = cr;
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_COLOR)))
break;
- case IDC_CHAT_BOLD:
- case IDC_ITALICS:
- case IDC_CHAT_UNDERLINE: {
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE;
- cf.dwEffects = 0;
-
- if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_BOLD)))
- break;
- if (LOWORD(wParam) == IDC_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ITALICS)))
- break;
- if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_UNDERLINE)))
- break;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BOLD))
- cf.dwEffects |= CFE_BOLD;
- if (IsDlgButtonChecked(hwndDlg, IDC_ITALICS))
- cf.dwEffects |= CFE_ITALIC;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_UNDERLINE))
- cf.dwEffects |= CFE_UNDERLINE;
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLOR)) {
+ if (M.GetByte("Chat", "RightClickFilter", 0) == 0)
+ SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR);
+ else if (si->bFGSet) {
+ cf.dwMask = CFM_COLOR;
+ cf.crTextColor = MM_FindModule(si->pszModule)->crColors[si->iFG];
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ } else {
+ COLORREF cr;
+ LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE);
+ cf.dwMask = CFM_COLOR;
+ cf.crTextColor = cr;
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
+ break;
+
+ case IDC_CHAT_BOLD:
+ case IDC_ITALICS:
+ case IDC_CHAT_UNDERLINE:
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE;
+ cf.dwEffects = 0;
+
+ if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_BOLD)))
+ break;
+ if (LOWORD(wParam) == IDC_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ITALICS)))
+ break;
+ if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_UNDERLINE)))
+ break;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BOLD))
+ cf.dwEffects |= CFE_BOLD;
+ if (IsDlgButtonChecked(hwndDlg, IDC_ITALICS))
+ cf.dwEffects |= CFE_ITALIC;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_UNDERLINE))
+ cf.dwEffects |= CFE_UNDERLINE;
+
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
break;
- case WM_KEYDOWN:
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- break;
+ case WM_KEYDOWN:
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ break;
- case WM_MOVE:
- break;
+ case WM_MOVE:
+ break;
- case WM_ERASEBKGND: {
+ case WM_ERASEBKGND:
+ {
HDC hdc = (HDC)wParam;
RECT rcClient, rcWindow, rc;
CSkinItem *item;
@@ -3410,46 +3366,43 @@ LABEL_SHOWWINDOW: }
if (!dat->fLimitedUpdate)
SetAeroMargins(dat->pContainer);
- return 1;
}
+ return 1;
- case WM_NCPAINT:
- if (CSkin::m_skinEnabled)
- return 0;
- break;
- case WM_PAINT: {
+ case WM_NCPAINT:
+ if (CSkin::m_skinEnabled)
+ return 0;
+ break;
+
+ case WM_PAINT:
+ {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwndDlg, &ps);
EndPaint(hwndDlg, &ps);
- return 0;
}
+ return 0;
- case DM_SETINFOPANEL:
- CInfoPanel::setPanelHandler(dat, wParam, lParam);
- return 0;
+ case DM_SETINFOPANEL:
+ CInfoPanel::setPanelHandler(dat, wParam, lParam);
+ return 0;
- case DM_INVALIDATEPANEL:
- if (dat->Panel)
- dat->Panel->Invalidate(true);
- return 0;
+ case DM_INVALIDATEPANEL:
+ if (dat->Panel)
+ dat->Panel->Invalidate(true);
+ return 0;
- case WM_RBUTTONUP: {
+ case WM_RBUTTONUP:
+ {
POINT pt;
- int iSelection;
- HMENU subMenu;
- int isHandled;
- int menuID = 0;
-
GetCursorPos(&pt);
-
if (dat->Panel->invokeConfigDialog(pt))
break;
- subMenu = GetSubMenu(dat->pContainer->hMenuContext, 0);
+ HMENU subMenu = GetSubMenu(dat->pContainer->hMenuContext, 0);
MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
- iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (iSelection >= IDM_CONTAINERMENU) {
DBVARIANT dbv = {0};
char szIndex[10];
@@ -3461,34 +3414,34 @@ LABEL_SHOWWINDOW: db_free(&dbv);
}
}
-
break;
}
- isHandled = MsgWindowMenuHandler(dat, iSelection, MENU_TABCONTEXT);
- break;
+ MsgWindowMenuHandler(dat, iSelection, MENU_TABCONTEXT);
}
+ break;
- case WM_LBUTTONDBLCLK: {
- if (LOWORD(lParam) < 30)
- PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
- break;
- }
+ case WM_LBUTTONDBLCLK:
+ if (LOWORD(lParam) < 30)
+ PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
+ break;
- case WM_CLOSE:
- if (wParam == 0 && lParam == 0) {
- if (PluginConfig.m_EscapeCloses == 1) {
- SendMessage(dat->pContainer->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- return TRUE;
- } else if (PluginConfig.m_HideOnClose && PluginConfig.m_EscapeCloses == 2) {
- ShowWindow(dat->pContainer->hwnd, SW_HIDE);
- return TRUE;
- }
- _dlgReturn(hwndDlg, TRUE);
+ case WM_CLOSE:
+ if (wParam == 0 && lParam == 0) {
+ if (PluginConfig.m_EscapeCloses == 1) {
+ SendMessage(dat->pContainer->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ return TRUE;
}
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 1);
- break;
+ if (PluginConfig.m_HideOnClose && PluginConfig.m_EscapeCloses == 2) {
+ ShowWindow(dat->pContainer->hwnd, SW_HIDE);
+ return TRUE;
+ }
+ _dlgReturn(hwndDlg, TRUE);
+ }
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 1);
+ break;
- case DM_CONTAINERSELECTED: {
+ case DM_CONTAINERSELECTED:
+ {
TContainerData *pNewContainer = 0;
TCHAR *szNewName = (TCHAR *)lParam;
if (!_tcscmp(szNewName, TranslateT("Default container")))
@@ -3507,30 +3460,26 @@ LABEL_SHOWWINDOW: SetActiveWindow(pNewContainer->hwnd);
}
break;
- // container API support functions
- case DM_QUERYCONTAINER: {
- TContainerData **pc = (TContainerData **) lParam;
- if (pc)
- *pc = dat->pContainer;
- return 0;
- }
+ // container API support functions
+ case DM_QUERYCONTAINER:
+ if (lParam)
+ *(TContainerData**)lParam = dat->pContainer;
+ return 0;
- case DM_QUERYHCONTACT: {
- HANDLE *phContact = (HANDLE *) lParam;
- if (phContact)
- *phContact = dat->hContact;
- return 0;
- }
+ case DM_QUERYHCONTACT:
+ if (lParam)
+ *(HANDLE*)lParam = dat->hContact;
+ return 0;
- case GC_CLOSEWINDOW: {
- int iTabs, i;
+ case GC_CLOSEWINDOW:
+ {
TCITEM item = {0};
RECT rc;
TContainerData *pContainer = dat->pContainer;
BOOL bForced = (lParam == 2);
- iTabs = TabCtrl_GetItemCount(hwndTab);
+ int iTabs = TabCtrl_GetItemCount(hwndTab);
if (iTabs == 1) {
if (/*!bForced && */CMimAPI::m_shutDown == 0) {
//DestroyWindow(GetParent(GetParent(hwndDlg)));
@@ -3541,7 +3490,7 @@ LABEL_SHOWWINDOW: }
dat->pContainer->iChilds--;
- i = GetTabIndexFromHWND(hwndTab, hwndDlg);
+ int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
/*
* after closing a tab, we need to activate the tab to the left side of
@@ -3566,65 +3515,63 @@ LABEL_SHOWWINDOW: SetFocus(dat->pContainer->hwndActive);
SendMessage(dat->pContainer->hwnd, WM_SIZE, 0, 0);
}
- //SM_SetTabbedWindowHwnd(0, 0);
- //DestroyWindow(hwndDlg);
+
if (iTabs == 1)
SendMessage(GetParent(GetParent(hwndDlg)), WM_CLOSE, 0, 1);
else {
PostMessage(pContainer->hwnd, WM_SIZE, 0, 0);
DestroyWindow(hwndDlg);
}
- return 0;
}
+ return 0;
- case DM_SETLOCALE:
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
- break;
- if (dat->pContainer->hwndActive == hwndDlg && PluginConfig.m_AutoLocaleSupport && dat->hContact != 0 && dat->pContainer->hwnd == GetForegroundWindow() && dat->pContainer->hwnd == GetActiveWindow()) {
- if (lParam)
- dat->hkl = (HKL)lParam;
-
- if (dat->hkl)
- ActivateKeyboardLayout(dat->hkl, 0);
- }
- return 0;
-
- case DM_SAVESIZE: {
- RECT rcClient;
+ case DM_SETLOCALE:
+ if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
+ break;
+ if (dat->pContainer->hwndActive == hwndDlg && PluginConfig.m_AutoLocaleSupport && dat->hContact != 0 && dat->pContainer->hwnd == GetForegroundWindow() && dat->pContainer->hwnd == GetActiveWindow()) {
+ if (lParam)
+ dat->hkl = (HKL)lParam;
- if (dat->dwFlags & MWF_NEEDCHECKSIZE)
- lParam = 0;
+ if (dat->hkl)
+ ActivateKeyboardLayout(dat->hkl, 0);
+ }
+ return 0;
- dat->dwFlags &= ~MWF_NEEDCHECKSIZE;
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
- dat->dwFlags &= ~MWF_INITMODE;
+ case DM_SAVESIZE:
+ if (dat->dwFlags & MWF_NEEDCHECKSIZE)
+ lParam = 0;
+ dat->dwFlags &= ~MWF_NEEDCHECKSIZE;
+ if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
+ dat->dwFlags &= ~MWF_INITMODE;
+ {
+ RECT rcClient;
SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient);
MoveWindow(hwndDlg, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), TRUE);
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) {
- POINT pt = {0};;
-
- dat->dwFlags &= ~MWF_WASBACKGROUNDCREATE;
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETSCROLLPOS, 0, (LPARAM)&pt);
- if (PluginConfig.m_AutoLocaleSupport) {
- if (dat->hkl == 0)
- DM_LoadLocale(dat);
- else
- PostMessage(hwndDlg, DM_SETLOCALE, 0, 0);
- }
- } else {
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- if (lParam == 0)
- PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 1, 1);
- }
- return 0;
}
+ if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) {
+ POINT pt = {0};;
- case DM_GETWINDOWSTATE: {
- UINT state = 0;
+ dat->dwFlags &= ~MWF_WASBACKGROUNDCREATE;
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETSCROLLPOS, 0, (LPARAM)&pt);
+ if (PluginConfig.m_AutoLocaleSupport) {
+ if (dat->hkl == 0)
+ DM_LoadLocale(dat);
+ else
+ PostMessage(hwndDlg, DM_SETLOCALE, 0, 0);
+ }
+ }
+ else {
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ if (lParam == 0)
+ PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 1, 1);
+ }
+ return 0;
- state |= MSG_WINDOW_STATE_EXISTS;
+ case DM_GETWINDOWSTATE:
+ {
+ UINT state = MSG_WINDOW_STATE_EXISTS;
if (IsWindowVisible(hwndDlg))
state |= MSG_WINDOW_STATE_VISIBLE;
if (GetForegroundWindow() == dat->pContainer->hwnd)
@@ -3632,151 +3579,147 @@ LABEL_SHOWWINDOW: if (IsIconic(dat->pContainer->hwnd))
state |= MSG_WINDOW_STATE_ICONIC;
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state);
- return TRUE;
}
+ return TRUE;
- case DM_ADDDIVIDER:
- if (!(dat->dwFlags & MWF_DIVIDERSET) && g_Settings.bUseDividers) {
- if (GetWindowTextLengthA(GetDlgItem(hwndDlg, IDC_CHAT_LOG)) > 0) {
- dat->dwFlags |= MWF_DIVIDERWANTED;
- dat->dwFlags |= MWF_DIVIDERSET;
- }
+ case DM_ADDDIVIDER:
+ if (!(dat->dwFlags & MWF_DIVIDERSET) && g_Settings.bUseDividers) {
+ if (GetWindowTextLengthA(GetDlgItem(hwndDlg, IDC_CHAT_LOG)) > 0) {
+ dat->dwFlags |= MWF_DIVIDERWANTED;
+ dat->dwFlags |= MWF_DIVIDERSET;
}
- return 0;
+ }
+ return 0;
- case DM_CHECKSIZE:
- dat->dwFlags |= MWF_NEEDCHECKSIZE;
- return 0;
+ case DM_CHECKSIZE:
+ dat->dwFlags |= MWF_NEEDCHECKSIZE;
+ return 0;
- case DM_REFRESHTABINDEX:
- dat->iTabID = GetTabIndexFromHWND(GetParent(hwndDlg), hwndDlg);
- return 0;
+ case DM_REFRESHTABINDEX:
+ dat->iTabID = GetTabIndexFromHWND(GetParent(hwndDlg), hwndDlg);
+ return 0;
- case DM_STATUSBARCHANGED:
- UpdateStatusBar(dat);
- break;
+ case DM_STATUSBARCHANGED:
+ UpdateStatusBar(dat);
+ break;
- //mad: bb-api
- case DM_BBNEEDUPDATE:{
- if (lParam)
- CB_ChangeButton(hwndDlg,dat,(CustomButtonData*)lParam);
- else
- BB_InitDlgButtons(dat);
+ //mad: bb-api
+ case DM_BBNEEDUPDATE:{
+ if (lParam)
+ CB_ChangeButton(hwndDlg,dat,(CustomButtonData*)lParam);
+ else
+ BB_InitDlgButtons(dat);
- BB_SetButtonsPos(dat);
- }break;
+ BB_SetButtonsPos(dat);
+ }break;
- case DM_CBDESTROY:{
- if (lParam)
- CB_DestroyButton(hwndDlg,dat,(DWORD)wParam,(DWORD)lParam);
- else
- CB_DestroyAllButtons(hwndDlg,dat);
- }break;
+ case DM_CBDESTROY:{
+ if (lParam)
+ CB_DestroyButton(hwndDlg,dat,(DWORD)wParam,(DWORD)lParam);
+ else
+ CB_DestroyAllButtons(hwndDlg,dat);
+ }break;
//
- case DM_CONFIGURETOOLBAR:
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- break;
-
- case DM_SMILEYOPTIONSCHANGED:
- ConfigureSmileyButton(dat);
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 1);
- break;
+ case DM_CONFIGURETOOLBAR:
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ break;
- case EM_THEMECHANGED:
- DM_FreeTheme(dat);
- return DM_ThemeChanged(dat);
+ case DM_SMILEYOPTIONSCHANGED:
+ ConfigureSmileyButton(dat);
+ SendMessage(hwndDlg, GC_REDRAWLOG, 0, 1);
+ break;
- case WM_DWMCOMPOSITIONCHANGED:
- BB_RefreshTheme(dat);
- memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
- CProxyWindow::verify(dat);
- break;
+ case EM_THEMECHANGED:
+ DM_FreeTheme(dat);
+ return DM_ThemeChanged(dat);
- case DM_ACTIVATEME:
- ActivateExistingTab(dat->pContainer, hwndDlg);
- return 0;
+ case WM_DWMCOMPOSITIONCHANGED:
+ BB_RefreshTheme(dat);
+ memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
+ CProxyWindow::verify(dat);
+ break;
- case DM_ACTIVATETOOLTIP: {
- if (IsIconic(dat->pContainer->hwnd) || dat->pContainer->hwndActive != hwndDlg)
- break;
+ case DM_ACTIVATEME:
+ ActivateExistingTab(dat->pContainer, hwndDlg);
+ return 0;
- dat->Panel->showTip(wParam, lParam);
+ case DM_ACTIVATETOOLTIP:
+ if (IsIconic(dat->pContainer->hwnd) || dat->pContainer->hwndActive != hwndDlg)
break;
- }
-
- case DM_SAVEMESSAGELOG:
- DM_SaveLogAsRTF(dat);
- return 0;
- case DM_CHECKAUTOHIDE:
- DM_CheckAutoHide(dat, wParam, lParam);
- return 0;
+ dat->Panel->showTip(wParam, lParam);
+ break;
- case WM_NCDESTROY:
- if (dat) {
- memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
- PostMessage(dat->pContainer->hwnd, WM_SIZE, 0, 1);
- delete dat->Panel;
- if (dat->pContainer->dwFlags & CNT_SIDEBAR)
- dat->pContainer->SideBar->removeSession(dat);
- free(dat);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- }
- break;
+ case DM_SAVEMESSAGELOG:
+ DM_SaveLogAsRTF(dat);
+ return 0;
- case WM_DESTROY: {
- int i;
+ case DM_CHECKAUTOHIDE:
+ DM_CheckAutoHide(dat, wParam, lParam);
+ return 0;
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString);
- si->wState &= ~STATE_TALK;
- si->hWnd = NULL;
- si->dat = 0;
- si->pContainer = 0;
+ case WM_NCDESTROY:
+ if (dat) {
+ memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
+ PostMessage(dat->pContainer->hwnd, WM_SIZE, 0, 1);
+ delete dat->Panel;
+ if (dat->pContainer->dwFlags & CNT_SIDEBAR)
+ dat->pContainer->SideBar->removeSession(dat);
+ free(dat);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ }
+ break;
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0);
+ case WM_DESTROY:
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString);
+ si->wState &= ~STATE_TALK;
+ si->hWnd = NULL;
+ si->dat = 0;
+ si->pContainer = 0;
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0);
- if (!dat->fIsAutosizingInput)
- db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
+ TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
- if (dat->pContainer->settings->fPrivate && !IsAutoSplitEnabled(dat))
- db_set_w(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY);
+ if (!dat->fIsAutosizingInput)
+ db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
- DM_FreeTheme(dat);
+ if (dat->pContainer->settings->fPrivate && !IsAutoSplitEnabled(dat))
+ db_set_w(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY);
- UpdateTrayMenuState(dat, FALSE); // remove me from the tray menu (if still there)
- if (PluginConfig.g_hMenuTrayUnread)
- DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, MF_BYCOMMAND);
+ DM_FreeTheme(dat);
- if (dat->hSmileyIcon)
- DestroyIcon(dat->hSmileyIcon);
+ UpdateTrayMenuState(dat, FALSE); // remove me from the tray menu (if still there)
+ if (PluginConfig.g_hMenuTrayUnread)
+ DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, MF_BYCOMMAND);
- if (dat->hwndTip)
- DestroyWindow(dat->hwndTip);
+ if (dat->hSmileyIcon)
+ DestroyIcon(dat->hSmileyIcon);
- if (hCurHyperlinkHand)
- DestroyCursor(hCurHyperlinkHand);
+ if (dat->hwndTip)
+ DestroyWindow(dat->hwndTip);
- i = GetTabIndexFromHWND(hwndTab, hwndDlg);
- if (i >= 0) {
- SendMessage(hwndTab, WM_USER + 100, 0, 0); // clean up tooltip
- TabCtrl_DeleteItem(hwndTab, i);
- BroadCastContainer(dat->pContainer, DM_REFRESHTABINDEX, 0, 0);
- dat->iTabID = -1;
- }
- if (dat->pWnd) {
- delete dat->pWnd;
- dat->pWnd = 0;
- }
- //MAD
- M.RemoveWindow(hwndDlg);
+ if (hCurHyperlinkHand)
+ DestroyCursor(hCurHyperlinkHand);
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0);
- break;
+ int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
+ if (i >= 0) {
+ SendMessage(hwndTab, WM_USER + 100, 0, 0); // clean up tooltip
+ TabCtrl_DeleteItem(hwndTab, i);
+ BroadCastContainer(dat->pContainer, DM_REFRESHTABINDEX, 0, 0);
+ dat->iTabID = -1;
}
+ if (dat->pWnd) {
+ delete dat->pWnd;
+ dat->pWnd = 0;
+ }
+ //MAD
+ M.RemoveWindow(hwndDlg);
+
+ TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0);
+ break;
}
return(FALSE);
}
diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h index 2d55f0c8d5..31c1faba6d 100644 --- a/plugins/TabSRMM/src/commonheaders.h +++ b/plugins/TabSRMM/src/commonheaders.h @@ -72,6 +72,7 @@ #include <m_icolib.h>
#include <m_clc.h>
#include <m_clui.h>
+#include <m_clistint.h>
#include <m_userinfo.h>
#include <m_history.h>
#include <m_addcontact.h>
@@ -197,8 +198,8 @@ enum DWMWINDOWATTRIBUTE {
DWORD cbSize;
DWORD dwFlags; // BPPF_ flags
- const RECT * prcExclude;
- const BLENDFUNCTION * pBlendFunction;
+ const RECT * prcExclude;
+ const BLENDFUNCTION * pBlendFunction;
} BP_PAINTPARAMS, *PBP_PAINTPARAMS;
#define BPPF_ERASE 1
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 3dc6d73fe4..aa61df56c0 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -134,7 +134,7 @@ bool CContactCache::updateNick() bool fChanged = false;
if (m_Valid) {
- TCHAR *tszNick = reinterpret_cast<TCHAR *>(::CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)m_hContact, GCDNF_TCHAR));
+ TCHAR *tszNick = pcli->pfnGetContactDisplayName(m_hContact, 0);
if (tszNick)
fChanged = (_tcscmp(m_szNick, tszNick) ? true : false);
mir_sntprintf(m_szNick, 80, _T("%s"), tszNick ? tszNick : _T("<undef>"));
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index a5709b5b1c..0e597c52c6 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -151,7 +151,7 @@ TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hCont /*
* save container name to the db
*/
- int i = 0;
+ int i=0;
if (!M.GetByte("singlewinmode", 0)) {
do {
char szCounter[10];
@@ -569,7 +569,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, HMENU hSysmenu;
DWORD dwCreateFlags;
int iMenuItems;
- int i = 0;
+ int i=0;
ButtonItem *pbItem;
HWND hwndButton = 0;
bool fAero = M.isAero();
@@ -750,7 +750,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->dwFlags |= CNT_DEFERREDSIZEREQUEST;
else {
RECT rcClient, rcUnadjusted;
- int i = 0;
+ int i=0;
TCITEM item = {0};
POINT pt = {0};
LONG sbarWidth, sbarWidth_left;
@@ -1017,7 +1017,7 @@ panel_found: break;
case ID_TABMENU_LEAVECHATROOM:
if (dat && dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ SESSION_INFO *si = (SESSION_INFO*)dat->si;
if (si && dat->hContact) {
char *szProto = GetContactProto(dat->hContact);
if (szProto)
@@ -1056,7 +1056,7 @@ panel_found: HANDLE hContact;
TWindowData *dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DWORD dwOldFlags = pContainer->dwFlags;
- int i = 0;
+ int i=0;
ButtonItem *pItem = pContainer->buttonItems;
if (dat) {
@@ -1628,7 +1628,7 @@ panel_found: DWORD ws, wsold, ex = 0, exold = 0;
HMENU hSysmenu = GetSystemMenu(hwndDlg, FALSE);
HANDLE hContact = 0;
- int i = 0;
+ int i=0;
UINT sBarHeight;
bool fAero = M.isAero();
@@ -2071,7 +2071,7 @@ panel_found: int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd)
{
TCITEM item;
- int i = 0;
+ int i=0;
int iItems;
iItems = TabCtrl_GetItemCount(hwndTab);
@@ -2105,7 +2105,7 @@ int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd) HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx)
{
TCITEM item;
- int i = 0;
+ int i=0;
int iItems;
iItems = TabCtrl_GetItemCount(hwndTab);
@@ -2441,7 +2441,7 @@ HMENU TSAPI BuildContainerMenu() {
char *szKey = "TAB_ContainersW";
char szCounter[10];
- int i = 0;
+ int i=0;
DBVARIANT dbv = { 0 };
HMENU hMenu;
MENUITEMINFO mii = {0};
@@ -2480,68 +2480,62 @@ HMENU TSAPI BuildContainerMenu() HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg)
{
- HMENU hMCContextMenu = 0, hMCSubForce = 0, hMCSubDefault = 0, hMenu = 0;
- DBVARIANT dbv;
- int iNumProtos = 0, i = 0, iDefaultProtoByNum = 0;
- char szTemp[50], *szProtoMostOnline = NULL;
- TCHAR szMenuLine[128], *nick = NULL, *szStatusText = NULL;
- char *tzProtoName = NULL;
- HANDLE hContactMostOnline, handle;
- int iChecked, isForced;
- WORD wStatus;
-
- struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat == NULL)
- return (HMENU) 0;
+ return NULL;
if (!dat->cache->isMeta())
- return (HMENU) 0;
+ return NULL;
- hMenu = CreatePopupMenu();
- hMCContextMenu = GetSubMenu(hMenu, 0);
- hMCSubForce = CreatePopupMenu();
- hMCSubDefault = CreatePopupMenu();
+ HMENU hMenu = CreatePopupMenu();
+ HMENU hMCContextMenu = GetSubMenu(hMenu, 0);
+ HMENU hMCSubForce = CreatePopupMenu();
+ HMENU hMCSubDefault = CreatePopupMenu();
AppendMenu(hMenu, MF_STRING | MF_DISABLED | MF_GRAYED | MF_CHECKED, 1, TranslateT("Meta Contact"));
AppendMenu(hMenu, MF_SEPARATOR, 1, _T(""));
- iNumProtos = (int)CallService(MS_MC_GETNUMCONTACTS, (WPARAM)dat->hContact, 0);
- iDefaultProtoByNum = (int)CallService(MS_MC_GETDEFAULTCONTACTNUM, (WPARAM)dat->hContact, 0);
- hContactMostOnline = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->hContact, 0);
- szProtoMostOnline = GetContactProto(hContactMostOnline);
- isForced = M.GetDword(dat->hContact, "tabSRMM_forced", -1);
+ int iNumProtos = (int)CallService(MS_MC_GETNUMCONTACTS, (WPARAM)dat->hContact, 0);
+ int iDefaultProtoByNum = (int)CallService(MS_MC_GETDEFAULTCONTACTNUM, (WPARAM)dat->hContact, 0);
+ HANDLE hContactMostOnline = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->hContact, 0);
+ char *szProtoMostOnline = GetContactProto(hContactMostOnline);
+ int isForced = M.GetDword(dat->hContact, "tabSRMM_forced", -1);
- for (i=0; i < iNumProtos; i++) {
+ for (int i=0; i < iNumProtos; i++) {
+ char szTemp[50];
mir_snprintf(szTemp, sizeof(szTemp), "Protocol%d", i);
- if (db_get_s(dat->hContact, PluginConfig.szMetaName, szTemp, &dbv))
- continue;
- tzProtoName = dbv.pszVal;
- PROTOACCOUNT *acc = (PROTOACCOUNT *)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)tzProtoName);
+ ptrA szProtoName( db_get_sa(dat->hContact, PluginConfig.szMetaName, szTemp));
+ if (szProtoName == NULL)
+ continue;
+ PROTOACCOUNT *acc = (PROTOACCOUNT *)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)szProtoName);
if (acc && acc->tszAccountName) {
mir_snprintf(szTemp, sizeof(szTemp), "Handle%d", i);
- if ((handle = (HANDLE)db_get_dw(dat->hContact, PluginConfig.szMetaName, szTemp, 0)) != 0) {
- nick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)handle, GCDNF_TCHAR);
+
+ TCHAR *nick = NULL, *szStatusText = NULL;
+ HANDLE hContact;
+ if ((hContact = (HANDLE)db_get_dw(dat->hContact, PluginConfig.szMetaName, szTemp, 0)) != 0) {
+ nick = pcli->pfnGetContactDisplayName(hContact, 0);
mir_snprintf(szTemp, sizeof(szTemp), "Status%d", i);
- wStatus = (WORD)db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0);
+ WORD wStatus = (WORD)db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0);
szStatusText = (TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR);
}
+
+ TCHAR szMenuLine[128];
mir_sntprintf(szMenuLine, SIZEOF(szMenuLine), _T("%s: %s [%s] %s"), acc->tszAccountName, nick, szStatusText,
i == isForced ? TranslateT("(Forced)") : _T(""));
- iChecked = MF_UNCHECKED;
- if (hContactMostOnline != 0 && hContactMostOnline == handle)
+ int iChecked = MF_UNCHECKED;
+ if (hContactMostOnline != 0 && hContactMostOnline == hContact)
iChecked = MF_CHECKED;
AppendMenu(hMCSubForce, MF_STRING | iChecked, 100 + i, szMenuLine);
AppendMenu(hMCSubDefault, MF_STRING | (i == iDefaultProtoByNum ? MF_CHECKED : MF_UNCHECKED), 1000 + i, szMenuLine);
}
- db_free(&dbv);
}
AppendMenu(hMCSubForce, MF_SEPARATOR, 900, _T(""));
AppendMenu(hMCSubForce, MF_STRING | ((isForced == -1) ? MF_CHECKED : MF_UNCHECKED), 999, TranslateT("Autoselect"));
InsertMenu(hMenu, 2, MF_BYPOSITION | MF_POPUP, (UINT_PTR) hMCSubForce, TranslateT("Use Protocol"));
InsertMenu(hMenu, 2, MF_BYPOSITION | MF_POPUP, (UINT_PTR) hMCSubDefault, TranslateT("Set Default Protocol"));
-
return hMenu;
}
@@ -2551,15 +2545,15 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) * iMode == 0: turn off flashing
*/
-void TSAPI FlashContainer(TContainerData *pContainer, int iMode, int iCount) {
- FLASHWINFO fwi;
-
+void TSAPI FlashContainer(TContainerData *pContainer, int iMode, int iCount)
+{
if (CMimAPI::m_MyFlashWindowEx == NULL)
return;
if (pContainer->dwFlags & CNT_NOFLASH) // container should never flash
return;
+ FLASHWINFO fwi;
fwi.cbSize = sizeof(fwi);
fwi.uCount = 0;
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 0f4048bf92..7aaa6cb651 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -123,7 +123,7 @@ static struct _tagPages { static void ShowPage(HWND hwndDlg, int iPage, BOOL fShow)
{
if (iPage >= 0 && iPage < NR_O_PAGES) {
- for (int i = 0; i < NR_O_OPTIONSPERPAGE && o_pages[iPage].uIds[i] != 0; i++)
+ for (int i=0; i < NR_O_OPTIONSPERPAGE && o_pages[iPage].uIds[i] != 0; i++)
Utils::showDlgControl(hwndDlg, o_pages[iPage].uIds[i], fShow ? SW_SHOW : SW_HIDE);
}
if (fShow) {
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 9f32e0fc4b..470519ac0e 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -147,7 +147,7 @@ LONG CMenuBar::getHeight() const * @param lParam
*
* @return LRESULT: message processing result. Win32 conform.
- * -1 means: nothing processed, caller should continue as usual.
+ * -1 means: nothing processed, caller should continue as usual.
*/
LONG_PTR CMenuBar::processMsg(const UINT msg, const WPARAM wParam, const LPARAM lParam)
{
@@ -219,10 +219,10 @@ LRESULT CALLBACK CMenuBar::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP * @param nm NMCUSTOMDRAW *: sent via NM_CUSTOMDRAW message
*
* @return LONG_PTR: see Win32 NM_CUSTOMDRAW message. The function must return a valid
- * message return value to indicate how Windows should continue with the drawing process.
+ * message return value to indicate how Windows should continue with the drawing process.
*
- * It may return zero in which case, the caller should allow default processing for
- * the NM_CUSTOMDRAW message.
+ * It may return zero in which case, the caller should allow default processing for
+ * the NM_CUSTOMDRAW message.
*/
LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm)
{
diff --git a/plugins/TabSRMM/src/controls.h b/plugins/TabSRMM/src/controls.h index d04f589021..b2ead85824 100644 --- a/plugins/TabSRMM/src/controls.h +++ b/plugins/TabSRMM/src/controls.h @@ -84,7 +84,7 @@ public: const int idToIndex(const int id) const
{
- for (int i = 0; i < NR_BUTTONS; i++) {
+ for (int i=0; i < NR_BUTTONS; i++) {
if (m_TbButtons[i].idCommand == id )
return(i);
}
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 4b8f8dff85..7388fba199 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -707,7 +707,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent pud.PluginData = pdata;
if (hContact)
- mir_sntprintf(pud.lptzContactName, MAX_CONTACTNAME, _T("%s"), (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
+ mir_sntprintf(pud.lptzContactName, MAX_CONTACTNAME, _T("%s"), pcli->pfnGetContactDisplayName(hContact, 0));
else {
TCHAR *szModule = mir_a2t(dbe.szModule);
mir_sntprintf(pud.lptzContactName, MAX_CONTACTNAME, _T("%s"), szModule);
@@ -828,7 +828,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro SetEvent(g_hEvent);
SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
} else {
- szNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
+ szNick = pcli->pfnGetContactDisplayName(hContact, 0);
if (CheckMenuItem(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, MF_BYCOMMAND | MF_UNCHECKED) == -1) {
mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, fromEvent ? 1 : 0);
AppendMenu(PluginConfig.g_hMenuTrayUnread, MF_BYCOMMAND | MF_STRING, (UINT_PTR)hContact, szMenuEntry);
@@ -923,7 +923,7 @@ passed: void TSAPI DeletePopupsForContact(HANDLE hContact, DWORD dwMask)
{
- int i = 0;
+ int i=0;
PLUGIN_DATAT* _T = 0;
if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable || !PluginConfig.g_PopupAvail)
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index d4f15ba995..025f5212c2 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -31,7 +31,6 @@ * also contains various callback functions for custom buttons
*/
-
#include "commonheaders.h"
/**
@@ -117,11 +116,10 @@ void TSAPI DM_CheckAutoHide(const TWindowData* dat, WPARAM wParam, LPARAM lParam void TSAPI DM_DismissTip(TWindowData *dat, const POINT& pt)
{
- RECT rc;
-
if (!IsWindowVisible(dat->hwndTip))
return;
+ RECT rc;
GetWindowRect(dat->hwndTip, &rc);
if (PtInRect(&rc, pt))
return;
@@ -301,9 +299,8 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, case IDC_NAME:
if (GetKeyState(VK_SHIFT) & 0x8000) // copy UIN
SendMessage(hwndDlg, DM_UINTOCLIPBOARD, 0, 0);
- else {
+ else
CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)(dat->cache->getActiveContact()), 0);
- }
break;
case IDC_HISTORY:
@@ -1790,16 +1787,14 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) ZeroMemory((void*)&item, sizeof(item));
if (dat->hContact) {
- int iHasName;
TCHAR fulluin[256];
const TCHAR* szNick = dat->cache->getNick();
if (dat->szProto) {
-
szActProto = dat->cache->getActiveProto();
hActContact = dat->hContact;
- iHasName = (dat->cache->getUIN()[0] != 0);
+ bool bHasName = (dat->cache->getUIN()[0] != 0);
dat->idle = dat->cache->getIdleTS();
dat->dwFlagsEx = dat->idle ? dat->dwFlagsEx | MWF_SHOW_ISIDLE : dat->dwFlagsEx & ~MWF_SHOW_ISIDLE;
@@ -1819,8 +1814,8 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) mir_sntprintf(newtitle, 127, _T("%s (%s)"), newcontactname, dat->szStatus);
else
mir_sntprintf(newtitle, 127, _T("%s"), newcontactname);
- } else
- mir_sntprintf(newtitle, 127, _T("%s"), _T("Forward"));
+ }
+ else mir_sntprintf(newtitle, 127, _T("%s"), _T("Forward"));
item.mask |= TCIF_TEXT;
}
@@ -1828,19 +1823,18 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) if (dat->bIsMeta)
mir_sntprintf(fulluin, SIZEOF(fulluin),
TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nRight click for MetaContact control\nClick dropdown to add or remove user from your favorites."),
- iHasName ? dat->cache->getUIN() : TranslateT("No UID"));
+ bHasName ? dat->cache->getUIN() : TranslateT("No UID"));
else
mir_sntprintf(fulluin, SIZEOF(fulluin),
TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nClick dropdown to change this contact's favorite status."),
- iHasName ? dat->cache->getUIN() : TranslateT("No UID"));
+ bHasName ? dat->cache->getUIN() : TranslateT("No UID"));
- SendMessage(GetDlgItem(hwndDlg, IDC_NAME), BUTTONADDTOOLTIP, /*iHasName ?*/ (WPARAM)fulluin /*: (WPARAM)_T("")*/, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_NAME), BUTTONADDTOOLTIP, /*bHasName ?*/ (WPARAM)fulluin /*: (WPARAM)_T("")*/, 0);
}
- } else
- lstrcpyn(newtitle, pszNewTitleEnd, SIZEOF(newtitle));
+ }
+ else lstrcpyn(newtitle, pszNewTitleEnd, SIZEOF(newtitle));
if (dat->idle != dwOldIdle || lParam != 0) {
-
if (item.mask & TCIF_TEXT) {
item.pszText = newtitle;
_tcsncpy(dat->newtitle, newtitle, SIZEOF(dat->newtitle));
@@ -1861,10 +1855,9 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) if (dat->cache->isFavorite())
AddContactToFavorites(dat->hContact, dat->cache->getNick(), szActProto, dat->szStatus, dat->wStatus,
LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 0, PluginConfig.g_hMenuFavorites);
- if (dat->cache->isRecent()) {
+ if (dat->cache->isRecent())
AddContactToFavorites(dat->hContact, dat->cache->getNick(), szActProto, dat->szStatus, dat->wStatus,
LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 0, PluginConfig.g_hMenuRecent);
- }
dat->Panel->Invalidate();
if (dat->pWnd)
@@ -1880,10 +1873,8 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) CallService(MS_FAVATAR_GETINFO, (WPARAM)&fa, 0);
dat->hwndFlash = fa.hWindow;
- if (dat->hwndFlash) {
- bool isInfoPanel = dat->Panel->isActive();
- SetParent(dat->hwndFlash, isInfoPanel ? dat->hwndPanelPicParent : GetDlgItem(hwndDlg, IDC_CONTACTPIC));
- }
+ if (dat->hwndFlash)
+ SetParent(dat->hwndFlash, dat->Panel->isActive() ? dat->hwndPanelPicParent : GetDlgItem(hwndDlg, IDC_CONTACTPIC));
}
}
// care about MetaContacts and update the statusbar icon with the currently "most online" contact...
@@ -1969,7 +1960,6 @@ void SI_CheckStatusIconClick(struct TWindowData *dat, HWND hwndFrom, POINT pt, R {
if (dat && (code == NM_CLICK || code == NM_RCLICK)) {
POINT ptScreen;
-
GetCursorPos(&ptScreen);
if (!PtInRect(&rcLastStatusBarClick, ptScreen))
return;
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index aefc6f1bef..b3dafc94ef 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -657,8 +657,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void) cle.hDbEvent = hDbEvent;
TCHAR toolTip[256];
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"),
- (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
+ mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = toolTip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)& cle);
}
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 6d59a61164..21fa97a159 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -142,7 +142,7 @@ void CInfoPanel::saveHeight(bool fFlush) *
* @param newHeight LONG: the new height.
* @param fBroadcast bool: broadcast the new height to all open sessions, respect
- * container's private setting flag.
+ *container's private setting flag.
*/
void CInfoPanel::setHeight(LONG newHeight, bool fBroadcast)
{
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 177eae7ba1..2fc4b861ea 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -82,7 +82,7 @@ void CMimAPI::timerMsg(const char *szMsg) *
* @param szString TCHAR *: String to be searched
* @param szSearchFor
- * TCHAR *: String that should be found in szString
+ *TCHAR *: String that should be found in szString
*
* @return TCHAR *: found position of szSearchFor in szString. 0 if szSearchFor was not found
*/
@@ -154,7 +154,7 @@ size_t CMimAPI::pathToRelative(const TCHAR *pSrc, TCHAR *pOut, const TCHAR *szBa * @param pSrc TCHAR *: input path + filename (relative)
* @param pOut TCHAR *: the result
* @param szBase TCHAR *: (OPTIONAL) base path for the translation. Can be 0 in which case
- * the function will use m_szProfilePath (usually \tabSRMM below %miranda_userdata%
+ * the function will use m_szProfilePath (usually \tabSRMM below %miranda_userdata%
*
* @return
*/
@@ -411,8 +411,9 @@ int CMimAPI::TypingMessage(WPARAM wParam, LPARAM lParam) int issplit = 1, foundWin = 0, preTyping = 0;
BOOL fShowOnClist = TRUE;
- if (wParam) {
- if ((hwnd = M.FindWindow((HANDLE)wParam)) && M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact) {
+ if ((hwnd = M.FindWindow(hContact)) && M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
preTyping = SendMessage(hwnd, DM_TYPING, 0, lParam);
if (hwnd && IsWindowVisible(hwnd))
@@ -464,13 +465,12 @@ int CMimAPI::TypingMessage(WPARAM wParam, LPARAM lParam) break;
}
if (fShow)
- TN_TypingMessage((HANDLE)wParam, lParam);
+ TN_TypingMessage(hContact, lParam);
}
if (lParam) {
TCHAR szTip[256];
-
- mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message."), (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR));
+ mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message."), pcli->pfnGetContactDisplayName(hContact, 0));
if (fShowOnClist && ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && M.GetByte(SRMSGMOD, "ShowTypingBalloon", 0)) {
MIRANDASYSTRAYNOTIFY tn;
tn.szProto = NULL;
@@ -512,7 +512,7 @@ int CMimAPI::ProtoAck(WPARAM wParam, LPARAM lParam) return 0;
HWND hwndDlg = 0;
- int i = 0, j, iFound = SendQueue::NR_SENDJOBS;
+ int i=0, j, iFound = SendQueue::NR_SENDJOBS;
SendJob *jobs = sendQueue->getJobByIndex(0);
if (pAck->type == ACKTYPE_MESSAGE) {
@@ -694,14 +694,12 @@ int CMimAPI::MessageEventAdded(WPARAM wParam, LPARAM lParam) bAllowAutoCreate = TRUE;
else {
char *szProto = GetContactProto((HANDLE)wParam);
- DWORD dwStatus = 0;
-
if (PluginConfig.g_MetaContactsAvail && szProto && !strcmp(szProto, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) {
HANDLE hSubconttact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, wParam, 0);
szProto = GetContactProto(hSubconttact);
}
if (szProto) {
- dwStatus = (DWORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ DWORD dwStatus = (DWORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if (dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE || ((1 << (dwStatus - ID_STATUS_ONLINE)) & dwStatusMask)) // should never happen, but...
bAllowAutoCreate = TRUE;
}
@@ -759,12 +757,12 @@ nowindowcreate: TCHAR toolTip[256], *contactName;
CLISTEVENT cle = { sizeof(cle) };
- cle.hContact = (HANDLE) wParam;
- cle.hDbEvent = (HANDLE) lParam;
+ cle.hContact = (HANDLE)wParam;
+ cle.hDbEvent = (HANDLE)lParam;
cle.flags = CLEF_TCHAR;
cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
cle.pszService = "SRMsg/ReadMessage";
- contactName = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR);
+ contactName = pcli->pfnGetContactDisplayName((HANDLE)wParam, 0);
mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), contactName);
cle.ptszTooltip = toolTip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)& cle);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 76163893b6..ecb45b6d12 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -920,7 +920,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (dat->bType == SESSIONTYPE_IM)
dat->savedSplitY = dat->splitterY;
else {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ SESSION_INFO *si = (SESSION_INFO*)dat->si;
dat->savedSplitY = si->iSplitterY;
}
dat->savedDynaSplit = dat->dynaSplitter;
@@ -1044,7 +1044,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM dat->dynaSplitter = dat->savedDynaSplit;
DM_RecalcPictureSize(dat);
if (dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ SESSION_INFO *si = (SESSION_INFO*)dat->si;
si->iSplitterY = dat->savedSplitY;
dat->splitterY =si->iSplitterY + DPISCALEY_S(22);
}
@@ -3497,7 +3497,7 @@ quote_from_last: CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM)dat->hContact, (LPARAM)ppFiles);
else {
if (ServiceExists(MS_HTTPSERVER_ADDFILENAME)) {
- for (int i = 0; i < totalCount; i++) {
+ for (int i=0; i < totalCount; i++) {
char* szFileName = mir_t2a( ppFiles[i] );
char *szTemp = (char*)CallService(MS_HTTPSERVER_ADDFILENAME, (WPARAM)szFileName, 0);
mir_free( szFileName );
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 11901b9fa6..ff51a3d08c 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -303,7 +303,7 @@ int TSAPI MsgWindowUpdateMenu(TWindowData *dat, HMENU submenu, int menuID) bool fInfoPanel = dat->Panel->isActive();
if (menuID == MENU_TABCONTEXT) {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ SESSION_INFO *si = (SESSION_INFO*)dat->si;
int iTabs = TabCtrl_GetItemCount(GetParent(hwndDlg));
EnableMenuItem(submenu, ID_TABMENU_ATTACHTOCONTAINER, M.GetByte("useclistgroups", 0) || M.GetByte("singlewinmode", 0) ? MF_GRAYED : MF_ENABLED);
@@ -380,7 +380,7 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId) break;
case ID_TABMENU_LEAVECHATROOM: {
if (dat && dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ SESSION_INFO *si = (SESSION_INFO*)dat->si;
if ( (si != NULL) && (dat->hContact != NULL)) {
char *szProto = GetContactProto(dat->hContact);
if (szProto)
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index ae84126625..ee81ad13c1 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1166,7 +1166,7 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM SendDlgItemMessage(hwndDlg, IDC_FLASHINTERVALSPIN, UDM_SETACCEL, 0, (int)M.GetDword("flashinterval", 1000));
CheckDlgButton(hwndDlg, IDC_USEAERO, M.GetByte("useAero", 1));
CheckDlgButton(hwndDlg, IDC_USEAEROPEEK, M.GetByte("useAeroPeek", 1));
- for (int i = 0; i < CSkin::AERO_EFFECT_LAST; i++)
+ for (int i=0; i < CSkin::AERO_EFFECT_LAST; i++)
SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(CSkin::m_aeroEffects[i].tszName));
SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_SETCURSEL, (WPARAM)CSkin::m_aeroEffect, 0);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index d3c1613a3e..52697325d4 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -715,7 +715,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HANDLE hContact, i ZeroMemory((void*)&newData.item, sizeof(newData.item));
// obtain various status information about the contact
- TCHAR *contactName = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)newData.hContact, GCDNF_TCHAR);
+ TCHAR *contactName = pcli->pfnGetContactDisplayName(newData.hContact, 0);
/*
* cut nickname if larger than x chars...
@@ -1034,7 +1034,7 @@ static int GetIconPackVersion(HMODULE hDLL) static int TSAPI SetupIconLibConfig()
{
- int i = 0, j = 2, version = 0, n = 0;
+ int i=0, j = 2, version = 0, n = 0;
TCHAR szFilename[MAX_PATH];
_tcsncpy(szFilename, _T("icons\\tabsrmm_icons.dll"), MAX_PATH);
@@ -1096,7 +1096,7 @@ static int TSAPI SetupIconLibConfig() static int TSAPI LoadFromIconLib()
{
for (int n = 0;ICONBLOCKS[n].szSection;n++) {
- for (int i = 0;ICONBLOCKS[n].idesc[i].szDesc;i++) {
+ for (int i=0;ICONBLOCKS[n].idesc[i].szDesc;i++) {
*(ICONBLOCKS[n].idesc[i].phIcon) = Skin_GetIcon(ICONBLOCKS[n].idesc[i].szName);
}
}
@@ -1140,7 +1140,7 @@ void TSAPI LoadIconTheme() static void UnloadIcons()
{
for (int n = 0;ICONBLOCKS[n].szSection;n++) {
- for (int i = 0;ICONBLOCKS[n].idesc[i].szDesc;i++) {
+ for (int i=0;ICONBLOCKS[n].idesc[i].szDesc;i++) {
if (*(ICONBLOCKS[n].idesc[i].phIcon) != 0) {
DestroyIcon(*(ICONBLOCKS[n].idesc[i].phIcon));
*(ICONBLOCKS[n].idesc[i].phIcon) = 0;
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index b2de192a5a..cbecb785da 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -135,7 +135,7 @@ CSendLaterJob::~CSendLaterJob() * show a popup notification, unless they are disabled
*/
if (PluginConfig.g_PopupAvail && fShowPopup) {
- TCHAR *tszName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
+ TCHAR *tszName = pcli->pfnGetContactDisplayName(hContact, 0);
POPUPDATAT ppd = {0};
ppd.lchContact = hContact;
@@ -418,10 +418,8 @@ int CSendLater::sendIt(CSendLaterJob *job) return 0;
}
- if (job->iSendCount > 0 && (now - job->lastSent < SENDLATER_RESEND_THRESHOLD)) {
- //_DebugTraceA("Send it: message %s for %s RESEND but not old enough", job->szId, (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0));
+ if (job->iSendCount > 0 && (now - job->lastSent < SENDLATER_RESEND_THRESHOLD))
return 0; // this one was sent, but probably failed. Resend it after a while
- }
CContactCache *c = CContactCache::getContactCache(hContact);
if (!c)
diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h index fa23a189d9..dff4ce43f0 100644 --- a/plugins/TabSRMM/src/sendqueue.h +++ b/plugins/TabSRMM/src/sendqueue.h @@ -75,7 +75,7 @@ public: ~SendQueue()
{
- for (int i = 0; i < NR_SENDJOBS; i++)
+ for (int i=0; i < NR_SENDJOBS; i++)
mir_free(m_jobs[i].szSendBuffer);
}
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 76d0bc4ea5..cf65c48b20 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -136,7 +136,7 @@ void CSideBarButton::Show(const int showCmd) const * m_elementWidth and m_elementHeight will be used.
*
* @return SIZE&: reference to the item's size member. The caller may use cx and cy values
- * to determine further layouting actions.
+ * to determine further layouting actions.
*/
const SIZE& CSideBarButton::measureItem()
{
@@ -520,7 +520,7 @@ void CSideBar::populateAll() m_iTopButtons = 0;
- for (int i = 0; i < iItems; i++) {
+ for (int i=0; i < iItems; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
if (item.lParam && ::IsWindow((HWND)item.lParam)) {
TWindowData *dat = (TWindowData *)::GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
@@ -545,8 +545,8 @@ void CSideBar::populateAll() * Add a new session to the switchbar.
*
* @param dat _MessageWindowData *: session data for a client session. Must be fully initialized
- * (that is, it can only be used after WM_INITIALOG completed).
- * position: -1 = append, otherwise insert it at the given position
+ * (that is, it can only be used after WM_INITIALOG completed).
+ *position: -1 = append, otherwise insert it at the given position
*/
void CSideBar::addSession(const TWindowData *dat, int position)
{
@@ -719,9 +719,9 @@ const CSideBarButton* CSideBar::setActiveItem(const TWindowData *dat) * @param rc RECT*:the window rectangle
*
* @param fOnlyCalc bool: if false (default), window positions will be updated, otherwise,
- * the method will only calculate the layout parameters. A final call to
- * Layout() with the parameter set to false is required to perform the
- * position update.
+ * the method will only calculate the layout parameters. A final call to
+ * Layout() with the parameter set to false is required to perform the
+ * position update.
*/
void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
{
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index b1b87cce68..888c21dc6c 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -39,8 +39,9 @@ LOGFONT lfDefault = {0}; * miranda interfaces
*/
-int hLangpack;
+int hLangpack;
TIME_API tmi = {0};
+CLIST_INTERFACE *pcli;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -76,6 +77,7 @@ extern "C" int __declspec(dllexport) Load(void) return 1;
}
+ mir_getCLI();
mir_getTMI(&tmi);
mir_getLP(&pluginInfo);
@@ -200,10 +202,11 @@ int _DebugPopup(HANDLE hContact, const TCHAR *fmt, ...) if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
MIRANDASYSTRAYNOTIFY tn;
TCHAR szTitle[128];
+ mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("tabSRMM Message (%s)"),
+ (hContact != 0) ? pcli->pfnGetContactDisplayName(hContact, 0) : TranslateT("Global"));
tn.szProto = NULL;
tn.cbSize = sizeof(tn);
- mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("tabSRMM Message (%s)"), (hContact != 0) ? (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR) : TranslateT("Global"));
tn.tszInfoTitle = szTitle;
tn.tszInfo = debug;
tn.dwInfoFlags = NIIF_INFO;
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index a21eb9f49c..4d8bd97029 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -1373,7 +1373,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara void TSAPI ReloadTabConfig()
{
NONCLIENTMETRICS nclim;
- int i = 0;
+ int i=0;
PluginConfig.tabConfig.m_hPenLight = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
PluginConfig.tabConfig.m_hPenShadow = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW));
@@ -1412,7 +1412,7 @@ void TSAPI FreeTabConfig() if (PluginConfig.tabConfig.m_hMenuFont)
DeleteObject(PluginConfig.tabConfig.m_hMenuFont);
- for (int i = 0; i < 4; i++) {
+ for (int i=0; i < 4; i++) {
if (PluginConfig.tabConfig.m_brushes[i]) {
DeleteObject(PluginConfig.tabConfig.m_brushes[i]);
PluginConfig.tabConfig.m_brushes[i] = 0;
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 8cef2ee767..ad31a69a00 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -812,7 +812,7 @@ void CImageItem::Create(const TCHAR *szImageFile) * @param szFilename char*: full path and filename to the .TSK file
*
* @return char*: full path and filename to the .png image which represents this image item.
- * caller MUST delete it.
+ * caller MUST delete it.
*/
TCHAR* CImageItem::Read(const TCHAR *szFilename)
{
@@ -1254,7 +1254,7 @@ void CSkin::LoadIcon(const TCHAR *szSection, const TCHAR *name, HICON *hIcon) *
* @param id int: zero-based index into the table of predefined skin items
* @param szItem char *: the section name in the ini file which holds the definition for this
- * item.
+ * item.
*/
void CSkin::ReadItem(const int id, const TCHAR *szItem)
{
@@ -1351,7 +1351,7 @@ void CSkin::ReadImageItem(const TCHAR *itemname) GetPrivateProfileString(itemname, szItemNr, _T("None"), buffer, 500, m_tszFileName);
if (!_tcscmp(buffer, _T("None")))
break;
- for (int i = 0; i <= ID_EXTBK_LAST; i++) {
+ for (int i=0; i <= ID_EXTBK_LAST; i++) {
if (!_tcsicmp(SkinItems[i].szName[0] == '{' ? &SkinItems[i].szName[3] : SkinItems[i].szName, buffer)) {
if (!(tmpItem.getFlags() & IMAGE_GLYPH)) {
if (szImageFileName)
@@ -2185,8 +2185,8 @@ int CSkin::RenderText(HDC hdc, HANDLE hTheme, const TCHAR *szText, RECT *rc, DWO * @param width LONG: width of the destination bitmap
* @param height LONG: height of the new bitmap
* @param mustFree bool: indicates that the new bitmap had been
- * resized and either the source or destination
- * bitmap should be freed.
+ *resized and either the source or destination
+ *bitmap should be freed.
*
* @return HBTIAMP: handle to a bitmap with the desired size.
*/
@@ -2268,7 +2268,7 @@ HBITMAP CSkin::CreateAeroCompatibleBitmap(const RECT &rc, HDC dc) * @param hwndParent HWND: The window to which the coordinates should be mapped
* @param rc RECT &: Rectangular area within the client area of hwndClient.
*
- * It will receive the transformed coordinates, relative to the client area of hwndParent
+ *It will receive the transformed coordinates, relative to the client area of hwndParent
*/
void CSkin::MapClientToParent(HWND hwndClient, HWND hwndParent, RECT &rc)
{
@@ -2554,7 +2554,7 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const m_fAeroSkinsValid = true;
try {
- for (int i = 0; i < SIZEOF(my_default_skin); i++)
+ for (int i=0; i < SIZEOF(my_default_skin); i++)
Utils::extractResource(g_hInst, my_default_skin[i].ulID, _T("SKIN_GLYPH"), tszBasePath, my_default_skin[i].tszName, fForceOverwrite);
}
catch(CRTException& ex) {
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index d3b8006543..66e5e8dd92 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -237,9 +237,8 @@ void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const TCHAR szMenuEntry[80];
TCHAR szFinalNick[100];
- if (szNickname == NULL) {
- mir_sntprintf(szFinalNick, SIZEOF(szFinalNick), _T("%s"), (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
- }
+ if (szNickname == NULL)
+ mir_sntprintf(szFinalNick, SIZEOF(szFinalNick), _T("%s"), pcli->pfnGetContactDisplayName(hContact, 0));
else {
_tcsncpy(szFinalNick, szNickname, 100);
szFinalNick[99] = 0;
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index c673ae2689..ca7aea8bcd 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -98,7 +98,7 @@ void TN_TypingMessage(HANDLE hContact, int iMode) if (!PluginConfig.g_PopupAvail || Disabled)
return;
- TCHAR *szContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GSMDF_TCHAR);
+ TCHAR *szContactName = pcli->pfnGetContactDisplayName(hContact, 0);
if (OnePopup) {
HWND hPopupWnd = WindowList_Find(hPopupsList, hContact);
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 8916de6c3d..d176ed4dd9 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -400,7 +400,7 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA break;
}
case WM_USER + 100: {
- int i = 0;
+ int i=0;
LRESULT state;
HWND hwnd = M.FindWindow(hContact);
struct TWindowData *dat = NULL;
@@ -459,29 +459,28 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA * @return LRESULT (ignored for dialog procs, use
* DWLP_MSGRESULT)
*/
-INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
+ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+ {
HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ TCITEM tci;
switch(msg) {
- case WM_INITDIALOG: {
- TCITEM tci = {0};
- RECT rcClient;
- TCHAR szBuffer[180];
-
- hContact = (HANDLE)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact);
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
- WindowList_Add(PluginConfig.hUserPrefsWindowList, hwndDlg, hContact);
- TranslateDialogDefault(hwndDlg);
+ hContact = (HANDLE)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact);
+ WindowList_Add(PluginConfig.hUserPrefsWindowList, hwndDlg, hContact);
+ {
+ RECT rcClient;
GetClientRect(hwndDlg, &rcClient);
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("Set messaging options for %s"),
- (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
-
+ TCHAR szBuffer[180];
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("Set messaging options for %s"), pcli->pfnGetContactDisplayName(hContact, 0));
SetWindowText(hwndDlg, szBuffer);
+ memset(&tci, 0, sizeof(tci));
tci.cchTextMax = 100;
tci.mask = TCIF_PARAM | TCIF_TEXT;
tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_USERPREFS), hwndDlg, DlgProcUserPrefs, (LPARAM)hContact);
@@ -492,7 +491,6 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (CMimAPI::m_pfnEnableThemeDialogTexture)
CMimAPI::m_pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
-
tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_USERPREFS1), hwndDlg, DlgProcUserPrefsLogOptions, (LPARAM)hContact);
tci.pszText = TranslateT("Message Log");
TabCtrl_InsertItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), 1, &tci);
@@ -500,88 +498,80 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP ShowWindow((HWND)tci.lParam, SW_HIDE);
if (CMimAPI::m_pfnEnableThemeDialogTexture)
CMimAPI::m_pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
- TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), 0);
- ShowWindow(hwndDlg, SW_SHOW);
- return TRUE;
}
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_OPTIONSTAB:
- switch (((LPNMHDR)lParam)->code) {
- case TCN_SELCHANGING: {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
-
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_OPTIONSTAB)), &tci);
- ShowWindow((HWND)tci.lParam, SW_HIDE);
- }
- break;
- case TCN_SELCHANGE: {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
-
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_OPTIONSTAB)), &tci);
- ShowWindow((HWND)tci.lParam, SW_SHOW);
- }
- break;
- }
- break;
+ TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), 0);
+ ShowWindow(hwndDlg, SW_SHOW);
+ return TRUE;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case IDC_OPTIONSTAB:
+ switch (((LPNMHDR)lParam)->code) {
+ case TCN_SELCHANGING:
+ tci.mask = TCIF_PARAM;
+ TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_OPTIONSTAB)), &tci);
+ ShowWindow((HWND)tci.lParam, SW_HIDE);
+ break;
+ case TCN_SELCHANGE:
+ tci.mask = TCIF_PARAM;
+ TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_OPTIONSTAB)), &tci);
+ ShowWindow((HWND)tci.lParam, SW_SHOW);
+ break;
}
break;
- case WM_COMMAND: {
- switch(LOWORD(wParam)) {
- case IDOK: {
- TCITEM tci;
- int i, count;
- DWORD dwActionToTake = 0; // child pages request which action to take
- HWND hwnd = M.FindWindow(hContact);
+ }
+ break;
- tci.mask = TCIF_PARAM;
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ break;
- count = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_OPTIONSTAB));
- for (i=0;i < count;i++) {
- TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), i, &tci);
- SendMessage((HWND)tci.lParam, WM_COMMAND, WM_USER + 100, (LPARAM)&dwActionToTake);
- }
- if (hwnd) {
- struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (dat) {
- DWORD dwOldFlags = (dat->dwFlags & MWF_LOG_ALL);
+ case IDOK:
+ DWORD dwActionToTake = 0; // child pages request which action to take
+ HWND hwnd = M.FindWindow(hContact);
- SetDialogToType(hwnd);
+ tci.mask = TCIF_PARAM;
+
+ int count = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_OPTIONSTAB));
+ for (int i=0; i < count; i++) {
+ TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), i, &tci);
+ SendMessage((HWND)tci.lParam, WM_COMMAND, WM_USER + 100, (LPARAM)&dwActionToTake);
+ }
+ if (hwnd) {
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (dat) {
+ DWORD dwOldFlags = (dat->dwFlags & MWF_LOG_ALL);
+ SetDialogToType(hwnd);
#if defined(__FEAT_DEPRECATED_DYNAMICSWITCHLOGVIEWER)
- if (dwActionToTake & UPREF_ACTION_SWITCHLOGVIEWER) {
- unsigned int mode = GetIEViewMode(hwndDlg, dat->hContact);
- SwitchMessageLog(dat, mode);
- }
+ if (dwActionToTake & UPREF_ACTION_SWITCHLOGVIEWER) {
+ unsigned int mode = GetIEViewMode(hwndDlg, dat->hContact);
+ SwitchMessageLog(dat, mode);
+ }
#endif
- LoadLocalFlags(hwnd, dat);
- if ((dat->dwFlags & MWF_LOG_ALL) != dwOldFlags) {
- BOOL fShouldHide = TRUE;
-
- if (IsIconic(dat->pContainer->hwnd))
- fShouldHide = FALSE;
- else
- ShowWindow(dat->pContainer->hwnd, SW_HIDE);
- SendMessage(hwnd, DM_OPTIONSAPPLIED, 0, 0);
- SendMessage(hwnd, DM_DEFERREDREMAKELOG, (WPARAM)hwnd, 0);
- if (fShouldHide)
- ShowWindow(dat->pContainer->hwnd, SW_SHOWNORMAL);
- }
- }
+ LoadLocalFlags(hwnd, dat);
+ if ((dat->dwFlags & MWF_LOG_ALL) != dwOldFlags) {
+ bool fShouldHide = true;
+ if (IsIconic(dat->pContainer->hwnd))
+ fShouldHide = false;
+ else
+ ShowWindow(dat->pContainer->hwnd, SW_HIDE);
+ SendMessage(hwnd, DM_OPTIONSAPPLIED, 0, 0);
+ SendMessage(hwnd, DM_DEFERREDREMAKELOG, (WPARAM)hwnd, 0);
+ if (fShouldHide)
+ ShowWindow(dat->pContainer->hwnd, SW_SHOWNORMAL);
}
- DestroyWindow(hwndDlg);
- break;
}
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
}
+ DestroyWindow(hwndDlg);
break;
}
- case WM_DESTROY:
- WindowList_Remove(PluginConfig.hUserPrefsWindowList, hwndDlg);
- break;
+ break;
+
+ case WM_DESTROY:
+ WindowList_Remove(PluginConfig.hUserPrefsWindowList, hwndDlg);
+ break;
}
return FALSE;
-}
+ }
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 3a9884dd52..11b33951c0 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -143,7 +143,7 @@ TCHAR* Utils::FilterEventMarkers(TCHAR *wszText) /**
* this translates formatting tags into rtf sequences...
* flags: loword = words only for simple * /_ formatting
- * hiword = bbcode support (strip bbcodes if 0)
+ *hiword = bbcode support (strip bbcodes if 0)
*/
const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOOL isSent)
{
@@ -677,7 +677,7 @@ void Utils::CreateColorMap(TCHAR *Text) int Utils::RTFColorToIndex(int iCol)
{
- int i = 0;
+ int i=0;
for (i=0; i < RTF_CTABLE_DEFSIZE; i++) {
if (rtf_ctable[i].index == iCol)
return i + 1;
|