diff options
-rw-r--r-- | plugins/SRMM/cmdlist.cpp (renamed from plugins/SRMM/cmdlist.c) | 8 | ||||
-rw-r--r-- | plugins/SRMM/commonheaders.h | 4 | ||||
-rw-r--r-- | plugins/SRMM/globals.cpp (renamed from plugins/SRMM/globals.c) | 6 | ||||
-rw-r--r-- | plugins/SRMM/msgdialog.cpp (renamed from plugins/SRMM/msgdialog.c) | 228 | ||||
-rw-r--r-- | plugins/SRMM/msglog.cpp (renamed from plugins/SRMM/msglog.c) | 58 | ||||
-rw-r--r-- | plugins/SRMM/msgoptions.cpp (renamed from plugins/SRMM/msgoptions.c) | 14 | ||||
-rw-r--r-- | plugins/SRMM/msgs.cpp (renamed from plugins/SRMM/msgs.c) | 106 | ||||
-rw-r--r-- | plugins/SRMM/msgs.h | 23 | ||||
-rw-r--r-- | plugins/SRMM/msgtimedout.cpp (renamed from plugins/SRMM/msgtimedout.c) | 2 | ||||
-rw-r--r-- | plugins/SRMM/richutil.cpp (renamed from plugins/SRMM/richutil.c) | 20 | ||||
-rw-r--r-- | plugins/SRMM/srmm.cpp (renamed from plugins/SRMM/srmm.c) | 8 | ||||
-rw-r--r-- | plugins/SRMM/srmm_10.vcxproj | 20 | ||||
-rw-r--r-- | plugins/SRMM/statusicon.cpp (renamed from plugins/SRMM/statusicon.c) | 4 |
13 files changed, 238 insertions, 263 deletions
diff --git a/plugins/SRMM/cmdlist.c b/plugins/SRMM/cmdlist.cpp index 88b1055ca2..426c26031d 100644 --- a/plugins/SRMM/cmdlist.c +++ b/plugins/SRMM/cmdlist.cpp @@ -34,7 +34,7 @@ int tcmdlist_append(SortedList *list, TCHAR *data) li.List_Remove(list, 0);
}
- new_list = mir_alloc(sizeof(TCmdList));
+ new_list = (TCmdList*)mir_alloc(sizeof(TCmdList));
new_list->szCmd = mir_tstrdup(data);
li.List_InsertPtr(list, new_list);
@@ -89,9 +89,7 @@ static VOID CALLBACK MsgTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTi void msgQueue_add(HANDLE hContact, HANDLE id, const TCHAR* szMsg, HANDLE hDbEvent)
{
- TMsgQueue *item;
-
- item = mir_alloc(sizeof(TMsgQueue));
+ TMsgQueue *item = (TMsgQueue*)mir_alloc(sizeof(TMsgQueue));
item->hContact = hContact;
item->id = id;
item->szMsg = mir_tstrdup(szMsg);
@@ -116,7 +114,7 @@ void msgQueue_processack(HANDLE hContact, HANDLE id, BOOL success, const char* s for (i = 0; i < msgQueue.realCount; ++i)
{
item = (TMsgQueue*)msgQueue.items[i];
- if (item->hContact == hContact && item->id == id)
+ if (item->hContact == hContact && item->id == id)
{
li.List_Remove(&msgQueue, i);
diff --git a/plugins/SRMM/commonheaders.h b/plugins/SRMM/commonheaders.h index fec878afd7..89911bcab1 100644 --- a/plugins/SRMM/commonheaders.h +++ b/plugins/SRMM/commonheaders.h @@ -70,10 +70,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "richutil.h"
#include "version.h"
-#if _MSC_VER >= 1500
- #define wEffects wReserved
-#endif
-
extern struct LIST_INTERFACE li;
extern HINSTANCE g_hInst;
diff --git a/plugins/SRMM/globals.c b/plugins/SRMM/globals.cpp index 802bc9fccc..2a5f4d5da6 100644 --- a/plugins/SRMM/globals.c +++ b/plugins/SRMM/globals.cpp @@ -168,11 +168,11 @@ static int ackevent(WPARAM wParam, LPARAM lParam) ACKDATA *pAck = (ACKDATA *)lParam;
if (!pAck) return 0;
- if (pAck->type == ACKTYPE_MESSAGE)
+ if (pAck->type == ACKTYPE_MESSAGE)
{
- msgQueue_processack(pAck->hContact, pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, (char*)pAck->lParam);
+ msgQueue_processack(pAck->hContact, pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, (char*)pAck->lParam);
- if (pAck->result == ACKRESULT_SUCCESS)
+ if (pAck->result == ACKRESULT_SUCCESS)
SkinPlaySound("SendMsg");
}
return 0;
diff --git a/plugins/SRMM/msgdialog.c b/plugins/SRMM/msgdialog.cpp index 1e8849997a..3b4261c305 100644 --- a/plugins/SRMM/msgdialog.c +++ b/plugins/SRMM/msgdialog.cpp @@ -28,11 +28,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SB_CHAR_WIDTH 45
#define SB_TIME_WIDTH 60
#define SB_GRIP_WIDTH 20 // pixels - buffer used to prevent sizegrip from overwriting statusbar icons
-#define VALID_AVATAR(x) (x==PA_FORMAT_PNG||x==PA_FORMAT_JPEG||x==PA_FORMAT_ICON||x==PA_FORMAT_BMP||x==PA_FORMAT_GIF)
+#define VALID_AVATAR(x) (x == PA_FORMAT_PNG || x == PA_FORMAT_JPEG || x == PA_FORMAT_ICON || x == PA_FORMAT_BMP || x == PA_FORMAT_GIF)
extern HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
extern HANDLE hHookWinEvt, hHookWinPopup;
-extern struct CREOleCallback reOleCallback;
+extern CREOleCallback reOleCallback;
static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus);
@@ -40,10 +40,12 @@ static const UINT infoLineControls[] = { IDC_PROTOCOL, IDC_NAME }; static const UINT buttonLineControls[] = { IDC_ADD, IDC_USERMENU, IDC_DETAILS, IDC_HISTORY };
static const UINT sendControls[] = { IDC_MESSAGE };
-static void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type) {
- MessageWindowEventData mwe = { 0 };
+static void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type)
+{
+ if (hContact == NULL || hwnd == NULL)
+ return;
- if (hContact==NULL || hwnd==NULL) return;
+ MessageWindowEventData mwe = { 0 };
mwe.cbSize = sizeof(mwe);
mwe.hContact = hContact;
mwe.hwndWindow = hwnd;
@@ -59,7 +61,7 @@ static char *MsgServiceName(HANDLE hContact) {
char szServiceName[100];
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if (szProto == NULL)
+ if (szProto == NULL)
return PSS_MESSAGE;
mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%sW", szProto, PSS_MESSAGE);
@@ -71,7 +73,7 @@ static char *MsgServiceName(HANDLE hContact) static BOOL IsUtfSendAvailable(HANDLE hContact)
{
char* szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if ( szProto == NULL )
+ if ( szProto == NULL )
return FALSE;
return ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF ) ? TRUE : FALSE;
@@ -87,7 +89,7 @@ static int RTL_Detect(const TCHAR *ptszText) GetStringTypeEx(LOCALE_USER_DEFAULT, CT_CTYPE2, ptszText, iLen, infoTypeC2);
for(i = 0; i < iLen; i++) {
- if(infoTypeC2[i] == C2_RIGHTTOLEFT)
+ if(infoTypeC2[i] == C2_RIGHTTOLEFT)
return 1;
}
return 0;
@@ -101,19 +103,16 @@ HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto) if (RTL_Detect(szMsg)) flags |= PREF_RTL;
- if (IsUtfSendAvailable(hContact))
- {
+ if (IsUtfSendAvailable(hContact)) {
flags |= PREF_UTF;
sendBuffer = mir_utf8encodeT(szMsg);
- if (!sendBuffer || !sendBuffer[0])
- {
+ if (!sendBuffer || !sendBuffer[0]) {
mir_free(sendBuffer);
return NULL;
}
bufSize = (int)strlen(sendBuffer) + 1;
}
- else
- {
+ else {
flags |= PREF_TCHAR;
sendBuffer = mir_t2a(szMsg);
if (!sendBuffer || !sendBuffer[0])
@@ -123,24 +122,18 @@ HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto) }
bufSize = (int)strlen(sendBuffer) + 1;
- {
- size_t bufSizeT = (_tcslen(szMsg) + 1) * sizeof(TCHAR) ;
-
- sendBuffer = (char*)mir_realloc(sendBuffer, bufSizeT + bufSize);
- memcpy((TCHAR*)&sendBuffer[bufSize], szMsg, bufSizeT);
- bufSize += (int)bufSizeT;
- }
-
+ size_t bufSizeT = (_tcslen(szMsg) + 1) * sizeof(TCHAR) ;
+ sendBuffer = (char*)mir_realloc(sendBuffer, bufSizeT + bufSize);
+ memcpy((TCHAR*)&sendBuffer[bufSize], szMsg, bufSizeT);
+ bufSize += (int)bufSizeT;
}
- if (hContact == NULL)
- {
+ if (hContact == NULL) {
mir_free(sendBuffer);
return NULL;
}
- if (sendBuffer)
- {
+ if (sendBuffer) {
HANDLE hNewEvent, hSendId;
DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
@@ -202,7 +195,7 @@ static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus) }
}
-static void ShowTime(struct MessageWindowData *dat)
+static void ShowTime(struct SrmmWindowData *dat)
{
if (dat->hwndStatus && dat->hTimeZone)
{
@@ -220,7 +213,7 @@ static void ShowTime(struct MessageWindowData *dat) }
}
-static void SetupStatusBar(HWND hwndDlg, struct MessageWindowData *dat)
+static void SetupStatusBar(HWND hwndDlg, struct SrmmWindowData *dat)
{
int icons_width, cx, i = 0, statwidths[4];
RECT rc;
@@ -249,9 +242,9 @@ static void SetupStatusBar(HWND hwndDlg, struct MessageWindowData *dat) static void SetDialogToType(HWND hwndDlg)
{
- struct MessageWindowData *dat;
+ struct SrmmWindowData *dat;
- dat = (struct MessageWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat->hContact)
ShowMultipleControls(hwndDlg, infoLineControls, SIZEOF(infoLineControls), (g_dat->flags&SMF_SHOWINFO) ? SW_SHOW : SW_HIDE);
else
@@ -275,7 +268,7 @@ static void SetDialogToType(HWND hwndDlg) ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDOK), (g_dat->flags & SMF_SENDBTN) ? SW_SHOW : SW_HIDE);
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
- if (dat->avatarPic == NULL || !(g_dat->flags & SMF_AVATAR))
+ if (dat->avatarPic == NULL || !(g_dat->flags & SMF_AVATAR))
ShowWindow(GetDlgItem(hwndDlg, IDC_AVATAR), SW_HIDE);
SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -298,7 +291,7 @@ static void SetEditorText(HWND hwnd, const TCHAR* txt) static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct MessageWindowData *pdat = (struct MessageWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
+ struct SrmmWindowData *pdat = (struct SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
struct MsgEditSubclassData *dat = (struct MsgEditSubclassData *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (msg) {
@@ -316,19 +309,19 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY)
break;
- if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) { //ctrl-a
+ if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) { //ctrl-a
SendMessage(hwnd, EM_SETSEL, 0, -1);
return 0;
}
- if (wParam == 23 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w
+ if (wParam == 23 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w
SendMessage(GetParent(hwnd), WM_CLOSE, 0, 0);
return 0;
}
break;
case WM_KEYDOWN:
- if (wParam == VK_RETURN)
+ if (wParam == VK_RETURN)
{
if (!(GetKeyState(VK_SHIFT) & 0x8000) &&
((GetKeyState(VK_CONTROL) & 0x8000) != 0) != ((g_dat->flags & SMF_SENDONENTER) != 0))
@@ -352,15 +345,15 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar else
dat->lastEnterTime = 0;
- if (((wParam == VK_INSERT && (GetKeyState(VK_SHIFT) & 0x8000)) || (wParam == 'V' && (GetKeyState(VK_CONTROL) & 0x8000))) &&
+ if (((wParam == VK_INSERT && (GetKeyState(VK_SHIFT) & 0x8000)) || (wParam == 'V' && (GetKeyState(VK_CONTROL) & 0x8000))) &&
!(GetKeyState(VK_MENU) & 0x8000)) // ctrl-v (paste clean text)
{
SendMessage(hwnd, WM_PASTE, 0, 0);
return 0;
}
- if (wParam == VK_UP && (GetKeyState(VK_CONTROL) & 0x8000) &&
- ((g_dat->flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT))
+ if (wParam == VK_UP && (GetKeyState(VK_CONTROL) & 0x8000) &&
+ ((g_dat->flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT))
{
if (pdat->cmdList->realCount)
{
@@ -378,8 +371,8 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar UpdateReadChars(GetParent(hwnd), pdat->hwndStatus);
return 0;
}
- else if (wParam == VK_DOWN && (GetKeyState(VK_CONTROL) & 0x8000) &&
- ((g_dat->flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT))
+ else if (wParam == VK_DOWN && (GetKeyState(VK_CONTROL) & 0x8000) &&
+ ((g_dat->flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT))
{
if (pdat->cmdList->realCount && pdat->cmdListInd >= 0)
{
@@ -409,7 +402,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar case WM_SYSCHAR:
dat->lastEnterTime = 0;
- if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU) & 0x8000)
+ if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU) & 0x8000)
{
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
@@ -435,7 +428,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar TranslateMenu(mwpd.hMenu);
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin == sel.cpMax)
+ if (sel.cpMin == sel.cpMax)
{
EnableMenuItem(mwpd.hMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(mwpd.hMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
@@ -455,7 +448,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar EnableMenuItem(mwpd.hMenu, IDM_PASTE, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(mwpd.hMenu, IDM_PASTESEND, MF_BYCOMMAND | MF_GRAYED);
}
- if (lParam == 0xFFFFFFFF)
+ if (lParam == 0xFFFFFFFF)
{
SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&mwpd.pt, (LPARAM)sel.cpMax);
ClientToScreen(hwnd, &mwpd.pt);
@@ -548,7 +541,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct MessageWindowData *pdat = (struct MessageWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
+ struct SrmmWindowData *pdat = (struct SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
switch (msg) {
case WM_NCHITTEST:
@@ -567,7 +560,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
case WM_MOUSEMOVE:
- if (GetCapture() == hwnd) {
+ if (GetCapture() == hwnd) {
RECT rc;
GetClientRect(hwnd, &rc);
SendMessage(GetParent(hwnd), DM_SPLITTERMOVED, rc.right > rc.bottom ? (short) HIWORD(GetMessagePos()) + rc.bottom / 2 : (short) LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM) hwnd);
@@ -583,12 +576,12 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc)
{
- struct MessageWindowData *dat = (struct MessageWindowData *) lParam;
+ struct SrmmWindowData *dat = (struct SrmmWindowData *) lParam;
if (!(g_dat->flags&SMF_SHOWINFO) && !(g_dat->flags&SMF_SHOWBTNS)) {
int i;
for (i = 0; i < SIZEOF(buttonLineControls); i++)
- if (buttonLineControls[i] == urc->wId)
+ if (buttonLineControls[i] == urc->wId)
OffsetRect(&urc->rcItem, 0, -dat->lineHeight);
}
@@ -601,15 +594,13 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * h = GetDlgItem(hwndDlg, IDC_NAME);
len = GetWindowTextLength(h);
if (len > 0) {
- HDC hdc;
- SIZE textSize;
TCHAR buf[256];
- HFONT hFont;
-
GetWindowText(h, buf, SIZEOF(buf));
- hdc = GetDC(h);
- hFont = SelectObject(hdc, (HFONT) SendMessage(GetDlgItem(hwndDlg, IDOK), WM_GETFONT, 0, 0));
+ HDC hdc = GetDC(h);
+ HFONT hFont = (HFONT)SelectObject(hdc, (HFONT) SendMessage(GetDlgItem(hwndDlg, IDOK), WM_GETFONT, 0, 0));
+
+ SIZE textSize;
GetTextExtentPoint32(hdc, buf, lstrlen(buf), &textSize);
urc->rcItem.right = urc->rcItem.left + textSize.cx + 10;
if ((g_dat->flags&SMF_SHOWBTNS) && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
@@ -664,7 +655,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
-void ShowAvatar(HWND hwndDlg, struct MessageWindowData *dat)
+void ShowAvatar(HWND hwndDlg, struct SrmmWindowData *dat)
{
if (g_dat->flags & SMF_AVATAR)
{
@@ -681,7 +672,7 @@ void ShowAvatar(HWND hwndDlg, struct MessageWindowData *dat) SendMessage(hwndDlg, DM_AVATARSIZECHANGE, 0, 0);
}
-static void NotifyTyping(struct MessageWindowData *dat, int mode)
+static void NotifyTyping(struct SrmmWindowData *dat, int mode)
{
DWORD protoStatus;
DWORD protoCaps;
@@ -711,10 +702,10 @@ static void NotifyTyping(struct MessageWindowData *dat, int mode) if (protoStatus < ID_STATUS_ONLINE)
return;
- if (protoCaps & PF1_VISLIST && DBGetContactSettingWord(dat->hContact, dat->szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
+ if (protoCaps & PF1_VISLIST && DBGetContactSettingWord(dat->hContact, dat->szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
return;
- if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && DBGetContactSettingWord(dat->hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
+ if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && DBGetContactSettingWord(dat->hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
return;
if (!(g_dat->flags & SMF_TYPINGUNKNOWN) && DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
@@ -750,16 +741,16 @@ void Window_FreeIcon_IcoLib(HWND hwndDlg) INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct MessageWindowData *dat;
+ struct SrmmWindowData *dat;
- dat = (struct MessageWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg)
{
case WM_INITDIALOG:
{
struct NewMessageWindowLParam *newData = (struct NewMessageWindowLParam *) lParam;
TranslateDialogDefault(hwndDlg);
- dat = (struct MessageWindowData *) mir_calloc(sizeof(struct MessageWindowData));
+ dat = (struct SrmmWindowData *) mir_calloc(sizeof(struct SrmmWindowData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
dat->hContact = newData->hContact;
@@ -811,7 +802,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP pt.x = 0;
ScreenToClient(hwndDlg, &pt);
dat->originalSplitterPos = pt.y;
- if (dat->splitterPos == -1)
+ if (dat->splitterPos == -1)
dat->splitterPos = dat->originalSplitterPos;// + 60;
GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rc);
dat->lineHeight = rc.bottom - rc.top + 3;
@@ -860,11 +851,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dbei.cbSize = sizeof(dbei);
for (i = DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i--; )
{
- if (dat->hDbEventFirst == NULL)
+ if (dat->hDbEventFirst == NULL)
hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) dat->hContact, 0);
else
hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDPREV, (WPARAM) dat->hDbEventFirst, 0);
- if (hPrevEvent == NULL)
+ if (hPrevEvent == NULL)
break;
dbei.cbBlob = 0;
@@ -882,18 +873,18 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DWORD firstTime;
dbei.cbSize = sizeof(dbei);
- if (dat->hDbEventFirst == NULL)
+ if (dat->hDbEventFirst == NULL)
dbei.timestamp = (DWORD)time(NULL);
else
CallService(MS_DB_EVENT_GET, (WPARAM) dat->hDbEventFirst, (LPARAM) & dbei);
firstTime = dbei.timestamp - 60 * DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
for (;;)
{
- if (dat->hDbEventFirst == NULL)
+ if (dat->hDbEventFirst == NULL)
hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) dat->hContact, 0);
else
hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDPREV, (WPARAM) dat->hDbEventFirst, 0);
- if (hPrevEvent == NULL)
+ if (hPrevEvent == NULL)
break;
dbei.cbBlob = 0;
CallService(MS_DB_EVENT_GET, (WPARAM) hPrevEvent, (LPARAM) & dbei);
@@ -918,7 +909,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize = sizeof(dbei);
CallService(MS_DB_EVENT_GET, (WPARAM) hdbEvent, (LPARAM) & dbei);
- if (( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && !(dbei.flags & DBEF_SENT)) {
+ if (( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && !(dbei.flags & DBEF_SENT)) {
dat->lastMessage = dbei.timestamp;
PostMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0);
break;
@@ -982,7 +973,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
case WM_CONTEXTMENU:
- if (dat->hwndStatus && dat->hwndStatus == (HWND) wParam) {
+ if (dat->hwndStatus && dat->hwndStatus == (HWND) wParam) {
POINT pt, pt2;
HMENU hMenu;
RECT rc;
@@ -1004,10 +995,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP // Mod from tabsrmm
case WM_DROPFILES:
- if (dat->szProto==NULL) break;
+ if (dat->szProto == NULL) break;
if (!(CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1,0)&PF1_FILESEND)) break;
- if (dat->wStatus==ID_STATUS_OFFLINE) break;
- if (dat->hContact!=NULL) {
+ if (dat->wStatus == ID_STATUS_OFFLINE) break;
+ if (dat->hContact != NULL) {
TCHAR szFilename[MAX_PATH];
HDROP hDrop = (HDROP)wParam;
int fileCount = DragQueryFile(hDrop,-1,NULL,0), totalCount = 0, i;
@@ -1030,7 +1021,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
BITMAP bminfo;
- if (dat->avatarPic == NULL || !(g_dat->flags&SMF_AVATAR))
+ if (dat->avatarPic == NULL || !(g_dat->flags&SMF_AVATAR))
{
dat->avatarWidth=50;
dat->avatarHeight=50;
@@ -1129,7 +1120,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP EmptyClipboard();
hData = GlobalAlloc(GMEM_MOVEABLE, _tcslen(buf) * sizeof(TCHAR) + 1);
- _tcscpy(GlobalLock(hData), buf);
+ _tcscpy((TCHAR*)GlobalLock(hData), buf);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
@@ -1255,7 +1246,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else
SetDlgItemText(hwndDlg, IDC_NAME, contactName);
- szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dat->szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), GSMDF_TCHAR);
+ szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dat->szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), GSMDF_TCHAR);
if (statusIcon)
mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s - %s"), contactName, TranslateTS(pszNewTitleEnd));
else
@@ -1280,12 +1271,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR *szOldStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) dat->wOldStatus, GSMDF_TCHAR);
TCHAR *szNewStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) dat->wStatus, GSMDF_TCHAR);
- if (dat->wStatus == ID_STATUS_OFFLINE)
+ if (dat->wStatus == ID_STATUS_OFFLINE)
{
iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("signed off (was %s)"), szOldStatus);
SendMessage(hwndDlg, DM_TYPING, 0, 0);
}
- else if (dat->wOldStatus == ID_STATUS_OFFLINE)
+ else if (dat->wOldStatus == ID_STATUS_OFFLINE)
iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("signed on (%s)"), szNewStatus);
else
iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("is now %s (was %s)"), szNewStatus, szOldStatus);
@@ -1302,7 +1293,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dbei.timestamp = (DWORD)time(NULL);
dbei.szModule = dat->szProto;
hNewEvent = (HANDLE) CallService(MS_DB_EVENT_ADD, (WPARAM) dat->hContact, (LPARAM) & dbei);
- if (dat->hDbEventFirst == NULL)
+ if (dat->hDbEventFirst == NULL)
{
dat->hDbEventFirst = hNewEvent;
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
@@ -1335,7 +1326,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP state |= MSG_WINDOW_STATE_EXISTS;
if (IsWindowVisible(hwndDlg))
state |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow()==hwndDlg)
+ if (GetForegroundWindow() == hwndDlg)
state |= MSG_WINDOW_STATE_FOCUS;
if (IsIconic(hwndDlg))
state |= MSG_WINDOW_STATE_ICONIC;
@@ -1345,7 +1336,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
case DM_CASCADENEWWINDOW:
- if ((HWND) wParam == hwndDlg)
+ if ((HWND) wParam == hwndDlg)
break;
{
RECT rcThis, rcNew;
@@ -1430,7 +1421,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_SPLITTERMOVED:
{
- if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_SPLITTER))
+ if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_SPLITTER))
{
POINT pt;
RECT rc;
@@ -1491,30 +1482,30 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dbei.cbSize = sizeof(dbei);
CallService(MS_DB_EVENT_GET, lParam, (LPARAM) & dbei);
- if (dat->hDbEventFirst == NULL)
+ if (dat->hDbEventFirst == NULL)
dat->hDbEventFirst = (HANDLE) lParam;
if (DbEventIsShown(&dbei, dat) && !(dbei.flags & DBEF_READ))
{
- if ((dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && !(dbei.flags & DBEF_SENT))
+ if ((dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && !(dbei.flags & DBEF_SENT))
{
- if (GetForegroundWindow() == hwndDlg)
+ if (GetForegroundWindow() == hwndDlg)
SkinPlaySound("RecvMsgActive");
else
SkinPlaySound("RecvMsgInactive");
}
- if (( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && dat->hwndStatus && !(dbei.flags & DBEF_SENT))
+ if (( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && dat->hwndStatus && !(dbei.flags & DBEF_SENT))
{
dat->lastMessage = dbei.timestamp;
SendMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0);
}
- if ((HANDLE) lParam != dat->hDbEventFirst && (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, lParam, 0) == NULL)
+ if ((HANDLE) lParam != dat->hDbEventFirst && (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, lParam, 0) == NULL)
SendMessage(hwndDlg, DM_APPENDTOLOG, lParam, 0);
else
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
if (!(dbei.flags & DBEF_SENT) && dbei.eventType != EVENTTYPE_STATUSCHANGE)
{
- if (GetActiveWindow() == hwndDlg && GetForegroundWindow() == hwndDlg)
+ if (GetActiveWindow() == hwndDlg && GetForegroundWindow() == hwndDlg)
{
HWND hwndLog = GetDlgItem(hwndDlg, IDC_LOG);
if (GetWindowLongPtr(hwndLog, GWL_STYLE) & WS_VSCROLL)
@@ -1540,7 +1531,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case WM_TIMER:
- if (wParam == TIMERID_FLASHWND)
+ if (wParam == TIMERID_FLASHWND)
{
FlashWindow(hwndDlg, TRUE);
if (dat->nFlash > 2 * g_dat->nFlashMax)
@@ -1551,10 +1542,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
dat->nFlash++;
}
- else if (wParam == TIMERID_TYPE)
+ else if (wParam == TIMERID_TYPE)
{
ShowTime(dat);
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - dat->nLastTyping > TIMEOUT_TYPEOFF)
+ if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - dat->nLastTyping > TIMEOUT_TYPEOFF)
NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
if (dat->showTyping)
@@ -1562,7 +1553,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->nTypeSecs)
{
dat->nTypeSecs--;
- if (GetForegroundWindow() == hwndDlg)
+ if (GetForegroundWindow() == hwndDlg)
SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
}
else
@@ -1601,7 +1592,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_MEASUREITEM:
{
LPMEASUREITEMSTRUCT mis = (LPMEASUREITEMSTRUCT) lParam;
- if (mis->CtlType == ODT_MENU)
+ if (mis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
}
break;
@@ -1609,14 +1600,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam;
- if (dis->CtlType == ODT_MENU)
+ if (dis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- else if (dis->hwndItem == dat->hwndStatus)
+ else if (dis->hwndItem == dat->hwndStatus)
{
DrawStatusIcons(dat->hContact, dis->hDC, dis->rcItem, 2);
return TRUE;
}
- else if (dis->CtlID == IDC_PROTOCOL)
+ else if (dis->CtlID == IDC_PROTOCOL)
{
if (dat->szProto)
{
@@ -1643,16 +1634,15 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
}
- else if (dis->CtlID == IDC_AVATAR && dat->avatarPic && (g_dat->flags & SMF_AVATAR))
+ else if (dis->CtlID == IDC_AVATAR && dat->avatarPic && (g_dat->flags & SMF_AVATAR))
{
- BITMAP bminfo;
- HPEN hPen, hOldPen;
-
- hPen = CreatePen(PS_SOLID, 1, RGB(0,0,0));
- hOldPen = SelectObject(dis->hDC, hPen);
+ HPEN hPen = CreatePen(PS_SOLID, 1, RGB(0,0,0));
+ HPEN hOldPen = (HPEN)SelectObject(dis->hDC, hPen);
Rectangle(dis->hDC, 0, 0, dat->avatarWidth, dat->avatarHeight);
SelectObject(dis->hDC,hOldPen);
DeleteObject(hPen);
+
+ BITMAP bminfo;
GetObject(dat->avatarPic, sizeof(bminfo), &bminfo);
{
HDC hdcMem = CreateCompatibleDC(dis->hDC);
@@ -1693,13 +1683,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP tcmdlist_append(dat->cmdList, temp);
dat->cmdListInd = -1;
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- if (dat->hDbEventFirst == NULL)
+ if (dat->hDbEventFirst == NULL)
{
dat->hDbEventFirst = hNewEvent;
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
@@ -1754,7 +1744,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case IDC_MESSAGE:
- if (HIWORD(wParam) == EN_CHANGE)
+ if (HIWORD(wParam) == EN_CHANGE)
{
int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
UpdateReadChars(hwndDlg, dat->hwndStatus);
@@ -1764,10 +1754,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->nLastTyping = GetTickCount();
if (len)
{
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_OFF)
+ if (dat->nTypeMode == PROTOTYPE_SELFTYPING_OFF)
NotifyTyping(dat, PROTOTYPE_SELFTYPING_ON);
}
- else if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ else if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
}
}
@@ -1776,16 +1766,16 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case WM_NOTIFY:
- if (dat && ((LPNMHDR) lParam)->hwndFrom == dat->hwndStatus)
+ if (dat && ((LPNMHDR) lParam)->hwndFrom == dat->hwndStatus)
{
- if (((LPNMHDR) lParam)->code == NM_CLICK || ((LPNMHDR) lParam)->code == NM_RCLICK)
+ if (((LPNMHDR) lParam)->code == NM_CLICK || ((LPNMHDR) lParam)->code == NM_RCLICK)
{
NMMOUSE *nm = (NMMOUSE *) lParam;
RECT rc;
SendMessage(dat->hwndStatus, SB_GETRECT, SendMessage(dat->hwndStatus, SB_GETPARTS, 0, 0) - 1, (LPARAM)&rc);
if (nm->pt.x >= rc.left)
- CheckIconClick(dat->hContact, dat->hwndStatus, nm->pt, rc, 2, ((LPNMHDR) lParam)->code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0);
+ CheckIconClick(dat->hContact, dat->hwndStatus, nm->pt, rc, 2, ((LPNMHDR) lParam)->code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0);
return TRUE;
}
}
@@ -1801,8 +1791,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_LBUTTONDOWN:
{
HCURSOR hCur = GetCursor();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
- || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
+ if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
+ || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
{
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
@@ -1812,8 +1802,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_MOUSEMOVE:
{
HCURSOR hCur = GetCursor();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
- || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
+ if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
+ || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
SetCursor(LoadCursor(NULL, IDC_ARROW));
break;
}
@@ -1827,7 +1817,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP hSubMenu = GetSubMenu(hMenu, 0);
TranslateMenu(hSubMenu);
SendMessage(((NMHDR *) lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel);
- if (sel.cpMin == sel.cpMax)
+ if (sel.cpMin == sel.cpMax)
EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
@@ -1860,7 +1850,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case EN_VSCROLL:
- if (LOWORD(wParam) == IDC_LOG && GetWindowLongPtr((HWND)lParam, GWL_STYLE) & WS_VSCROLL)
+ if (LOWORD(wParam) == IDC_LOG && GetWindowLongPtr((HWND)lParam, GWL_STYLE) & WS_VSCROLL)
{
SCROLLINFO si = {0};
si.cbSize = sizeof(si);
@@ -1889,14 +1879,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (sel.cpMin != sel.cpMax)
break;
tr.chrg = ((ENLINK *) lParam)->chrg;
- tr.lpstrText = _alloca((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR));
+ tr.lpstrText = (TCHAR*)_alloca((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR));
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM) & tr);
- if (_tcschr(tr.lpstrText, '@') != NULL && _tcschr(tr.lpstrText, ':') == NULL && _tcschr(tr.lpstrText, '/') == NULL)
+ if (_tcschr(tr.lpstrText, '@') != NULL && _tcschr(tr.lpstrText, ':') == NULL && _tcschr(tr.lpstrText, '/') == NULL)
{
memmove(tr.lpstrText + 7, tr.lpstrText, (tr.chrg.cpMax - tr.chrg.cpMin + 1) * sizeof(TCHAR));
memcpy(tr.lpstrText, _T("mailto:"), 7 * sizeof(TCHAR));
}
- if (((ENLINK *) lParam)->msg == WM_RBUTTONDOWN)
+ if (((ENLINK *) lParam)->msg == WM_RBUTTONDOWN)
{
HMENU hMenu, hSubMenu;
POINT pt;
@@ -1920,7 +1910,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP HGLOBAL hData;
EmptyClipboard();
hData = GlobalAlloc(GMEM_MOVEABLE, (_tcslen(tr.lpstrText) + 1) * sizeof(TCHAR));
- _tcscpy(GlobalLock(hData), tr.lpstrText);
+ _tcscpy((TCHAR*)GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
@@ -1968,7 +1958,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBDeleteContactSetting(dat->hContact, SRMSGMOD, DBSAVEDMSG);
}
KillTimer(hwndDlg, TIMERID_TYPE);
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
if (dat->hBkgBrush)
diff --git a/plugins/SRMM/msglog.c b/plugins/SRMM/msglog.cpp index 82bb0f8da5..e32c98ae50 100644 --- a/plugins/SRMM/msglog.c +++ b/plugins/SRMM/msglog.cpp @@ -41,7 +41,7 @@ struct LogStreamData int bufferOffset, bufferLen;
int eventsToInsert;
int isEmpty;
- struct MessageWindowData *dlgDat;
+ struct SrmmWindowData *dlgDat;
};
static char szSep2[40], szSep2_RTL[50];
@@ -72,7 +72,7 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA char *d;
int lineLen;
- if (line == NULL)
+ if (line == NULL)
return 0;
lineLen = (int)_tcslen(line) * 9 + 8;
@@ -88,32 +88,32 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA for (; *line; line++, textCharsCount++)
{
- if (*line == '\r' && line[1] == '\n')
+ if (*line == '\r' && line[1] == '\n')
{
memcpy(d, "\\par ", 5);
line++;
d += 5;
}
- else if (*line == '\n') {
+ else if (*line == '\n') {
memcpy(d, "\\par ", 5);
d += 5;
}
- else if (*line == '\t')
+ else if (*line == '\t')
{
memcpy(d, "\\tab ", 5);
d += 5;
}
- else if (*line == '\\' || *line == '{' || *line == '}')
+ else if (*line == '\\' || *line == '{' || *line == '}')
{
*d++ = '\\';
*d++ = (char) *line;
}
- else if (*line == '[' && (g_dat->flags & SMF_SHOWFORMAT))
+ else if (*line == '[' && (g_dat->flags & SMF_SHOWFORMAT))
{
int i, found = 0;
for (i = 0; i < SIZEOF(bbcodes); ++i)
{
- if (line[1] == bbcodes[i][1])
+ if (line[1] == bbcodes[i][1])
{
size_t lenb = _tcslen(bbcodes[i]);
if (!_tcsnicmp(line, bbcodes[i], lenb))
@@ -134,7 +134,7 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA TCHAR* tag = _tcschr(line + 4, ']');
if (tag)
{
- TCHAR *tagu = (line[4] == '=') ? line + 5 : tag + 1;
+ TCHAR *tagu = (line[4] == '=') ? line + 5 : tag + 1;
TCHAR *tage = _tcsstr(tag, _T("[/url]"));
if (!tage) tage = _tcsstr(tag, _T("[/URL]"));
if (tage)
@@ -182,7 +182,7 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA #define FONT_FORMAT "{\\f%u\\fnil\\fcharset%u %S;}"
-static char *CreateRTFHeader(struct MessageWindowData *dat)
+static char *CreateRTFHeader(struct SrmmWindowData *dat)
{
char *buffer;
int bufferAlloced, bufferEnd;
@@ -209,7 +209,7 @@ static char *CreateRTFHeader(struct MessageWindowData *dat) LoadMsgDlgFont(i, NULL, &colour);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
}
- if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL)
+ if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL)
colour = RGB(0, 0, 255);
else
colour = GetSysColor(COLOR_HOTLIGHT);
@@ -220,7 +220,7 @@ static char *CreateRTFHeader(struct MessageWindowData *dat) }
//mir_free() the return value
-static char *CreateRTFTail(struct MessageWindowData *dat)
+static char *CreateRTFTail(struct SrmmWindowData *dat)
{
char *buffer;
int bufferAlloced, bufferEnd;
@@ -250,7 +250,7 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei) return et && ( et->flags & DETF_MSGWINDOW );
}
-int DbEventIsShown(DBEVENTINFO * dbei, struct MessageWindowData *dat)
+int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat)
{
switch (dbei->eventType) {
case EVENTTYPE_MESSAGE:
@@ -259,13 +259,13 @@ int DbEventIsShown(DBEVENTINFO * dbei, struct MessageWindowData *dat) case EVENTTYPE_JABBER_PRESENCE:
case EVENTTYPE_STATUSCHANGE:
case EVENTTYPE_FILE:
- return (dbei->flags & DBEF_READ) == 0;
+ return (dbei->flags & DBEF_READ) == 0;
}
return DbEventIsForMsgWindow(dbei);
}
//mir_free() the return value
-static char *CreateRTFFromDbEvent(struct MessageWindowData *dat, HANDLE hContact, HANDLE hDbEvent, struct LogStreamData *streamData)
+static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent, struct LogStreamData *streamData)
{
char *buffer;
int bufferAlloced, bufferEnd;
@@ -274,7 +274,7 @@ static char *CreateRTFFromDbEvent(struct MessageWindowData *dat, HANDLE hContact dbei.cbSize = sizeof(dbei);
dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM) hDbEvent, 0);
- if (dbei.cbBlob == -1)
+ if (dbei.cbBlob == -1)
return NULL;
dbei.pBlob = (PBYTE) mir_alloc(dbei.cbBlob);
CallService(MS_DB_EVENT_GET, (WPARAM) hDbEvent, (LPARAM) & dbei);
@@ -282,12 +282,12 @@ static char *CreateRTFFromDbEvent(struct MessageWindowData *dat, HANDLE hContact mir_free(dbei.pBlob);
return NULL;
}
- if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
+ if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
{
CallService(MS_DB_EVENT_MARKREAD, (WPARAM) hContact, (LPARAM) hDbEvent);
CallService(MS_CLIST_REMOVEEVENT, (WPARAM) hContact, (LPARAM) hDbEvent);
}
- else if (dbei.eventType == EVENTTYPE_STATUSCHANGE || dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) {
+ else if (dbei.eventType == EVENTTYPE_STATUSCHANGE || dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) {
CallService(MS_DB_EVENT_MARKREAD, (WPARAM) hContact, (LPARAM) hDbEvent);
}
bufferEnd = 0;
@@ -428,7 +428,7 @@ static char *CreateRTFFromDbEvent(struct MessageWindowData *dat, HANDLE hContact }
case EVENTTYPE_FILE:
{
- char* filename = dbei.pBlob + sizeof(DWORD);
+ char* filename = (char*)dbei.pBlob + sizeof(DWORD);
char* descr = filename + strlen( filename ) + 1;
TCHAR* ptszFileName = DbGetEventStringT( &dbei, filename );
@@ -460,7 +460,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG {
struct LogStreamData *dat = (struct LogStreamData *) dwCookie;
- if (dat->buffer == NULL)
+ if (dat->buffer == NULL)
{
dat->bufferOffset = 0;
switch (dat->stage)
@@ -479,9 +479,9 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG if (dat->buffer)
dat->hDbEventLast = dat->hDbEvent;
dat->hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) dat->hDbEvent, 0);
- if (--dat->eventsToInsert == 0)
+ if (--dat->eventsToInsert == 0)
break;
- } while (dat->buffer == NULL && dat->hDbEvent);
+ } while (dat->buffer == NULL && dat->hDbEvent);
if (dat->buffer)
{
dat->isEmpty = 0;
@@ -503,7 +503,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG *pcb = min(cb, dat->bufferLen - dat->bufferOffset);
CopyMemory(pbBuff, dat->buffer + dat->bufferOffset, *pcb);
dat->bufferOffset += *pcb;
- if (dat->bufferOffset == dat->bufferLen)
+ if (dat->bufferOffset == dat->bufferLen)
{
mir_free(dat->buffer);
dat->buffer = NULL;
@@ -515,7 +515,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) {
EDITSTREAM stream = {0};
struct LogStreamData streamData = {0};
- struct MessageWindowData *dat = (struct MessageWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ struct SrmmWindowData *dat = (struct SrmmWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
CHARRANGE oldSel, sel;
POINT scrollPos;
BOOL bottomScroll = TRUE;
@@ -528,7 +528,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) streamData.hDbEvent = hDbEventFirst;
streamData.dlgDat = dat;
streamData.eventsToInsert = count;
- streamData.isEmpty = !fAppend || GetWindowTextLength(hwndLog) == 0;
+ streamData.isEmpty = !fAppend || GetWindowTextLength(hwndLog) == 0;
stream.pfnCallback = LogStreamInEvents;
stream.dwCookie = (DWORD_PTR)&streamData;
@@ -609,10 +609,10 @@ void LoadMsgLogIcons(void) pBmpBits = (PBYTE) mir_alloc(widthBytes * bih.biHeight);
for (i = 0; i < SIZEOF(pLogIconBmpBits); i++) {
- hIcon = (HANDLE)CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)hIconLibItem[i]);
+ hIcon = Skin_GetIconByHandle(hIconLibItem[i]);
pLogIconBmpBits[i] = (PBYTE) mir_alloc(RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2);
//I can't seem to get binary mode working. No matter.
- rtfHeaderSize = sprintf(pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
+ rtfHeaderSize = sprintf((char*)pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
hoBmp = (HBITMAP) SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBkgBrush);
DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL);
@@ -623,9 +623,9 @@ void LoadMsgLogIcons(void) {
int n;
for (n = 0; n < sizeof(BITMAPINFOHEADER); n++)
- sprintf(pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE) & bih)[n]);
+ sprintf((char*)pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE) & bih)[n]);
for (n = 0; n < widthBytes * bih.biHeight; n += 4)
- sprintf(pLogIconBmpBits[i] + rtfHeaderSize + (bih.biSize + n) * 2, "%02X%02X%02X%02X", pBmpBits[n], pBmpBits[n + 1], pBmpBits[n + 2], pBmpBits[n + 3]);
+ sprintf((char*)pLogIconBmpBits[i] + rtfHeaderSize + (bih.biSize + n) * 2, "%02X%02X%02X%02X", pBmpBits[n], pBmpBits[n + 1], pBmpBits[n + 2], pBmpBits[n + 3]);
}
logIconBmpSize[i] = rtfHeaderSize + (bih.biSize + widthBytes * bih.biHeight) * 2 + 1;
pLogIconBmpBits[i][logIconBmpSize[i] - 1] = '}';
diff --git a/plugins/SRMM/msgoptions.c b/plugins/SRMM/msgoptions.cpp index 86e8c0321f..a3458d348a 100644 --- a/plugins/SRMM/msgoptions.c +++ b/plugins/SRMM/msgoptions.cpp @@ -108,7 +108,7 @@ void RegisterSRMMFonts( void ) fontid.order = index;
fontid.flags &= ~FIDF_CLASSMASK;
- fontid.flags |= (fontOptionsList[i].defStyle == FONTF_BOLD) ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL;
+ fontid.flags |= (fontOptionsList[i].defStyle == FONTF_BOLD) ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL;
fontid.deffontsettings.colour = fontOptionsList[i].defColour;
fontid.deffontsettings.size = fontOptionsList[i].defSize;
@@ -173,7 +173,7 @@ static DWORD MakeCheckBoxTreeFlags(HWND hwndTree) tvi.hItem = TreeView_GetRoot(hwndTree);
while (tvi.hItem) {
TreeView_GetItem(hwndTree, &tvi);
- if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2))
+ if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2))
flags |= tvi.lParam;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
@@ -261,7 +261,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_NOTIFY:
switch (((LPNMHDR) lParam)->idFrom) {
case IDC_POPLIST:
- if (((LPNMHDR) lParam)->code == NM_CLICK) {
+ if (((LPNMHDR) lParam)->code == NM_CLICK) {
TVHITTESTINFO hti;
hti.pt.x = (short) LOWORD(GetMessagePos());
hti.pt.y = (short) HIWORD(GetMessagePos());
@@ -272,7 +272,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.hItem = hti.hItem;
TreeView_GetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
- tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1;
+ tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1;
TreeView_SetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
@@ -426,10 +426,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE;
}
-static ResetCList(HWND hwndDlg)
+static void ResetCList(HWND hwndDlg)
{
- int i;
-
if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) FALSE, 0);
else
@@ -440,7 +438,7 @@ static ResetCList(HWND hwndDlg) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKBITMAP, 0, (LPARAM) (HBITMAP) NULL);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETINDENT, 10, 0);
- for (i = 0; i <= FONTID_MAX; i++)
+ for (int i = 0; i <= FONTID_MAX; i++)
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT));
}
diff --git a/plugins/SRMM/msgs.c b/plugins/SRMM/msgs.cpp index 8ebb549339..ce278f36bd 100644 --- a/plugins/SRMM/msgs.c +++ b/plugins/SRMM/msgs.cpp @@ -26,8 +26,6 @@ const CLSID IID_IRichEditOle = { 0x00020D00, 0x00, 0x00, { 0xC0, 0x00, 0x00, 0x0 const CLSID IID_IRichEditOleCallback = { 0x00020D03, 0x00, 0x00, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
#endif
-static void InitREOleCallback(void);
-
HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
HANDLE hHookWinEvt, hHookWinPopup, hMsgMenuItem;
static HANDLE hServices[7];
@@ -58,7 +56,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) dbei.cbSize = sizeof(dbei);
CallService(MS_DB_EVENT_GET, lParam, (LPARAM) & dbei);
- if (dbei.flags & (DBEF_SENT | DBEF_READ) || !(dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
+ if (dbei.flags & (DBEF_SENT | DBEF_READ) || !(dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
return 0;
CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1);
@@ -75,7 +73,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) }
else
{
- if (GetForegroundWindow() == hwnd)
+ if (GetForegroundWindow() == hwnd)
SkinPlaySound("RecvMsgActive");
else
SkinPlaySound("RecvMsgInactive");
@@ -217,7 +215,7 @@ static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
HANDLE hContact = (HANDLE)wParam;
- if (cws->szModule == NULL) return 0;
+ if (cws->szModule == NULL) return 0;
if (!strcmp(cws->szModule, "CList"))
WindowList_Broadcast(g_dat->hMessageWindowList, DM_UPDATETITLE, (WPARAM) cws, 0);
@@ -269,7 +267,7 @@ static void RestoreUnreadMessageAlerts(void) autoPopup = 0;
dbei.cbBlob = 0;
CallService(MS_DB_EVENT_GET, (WPARAM) hDbEvent, (LPARAM) & dbei);
- if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && ( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
+ if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && ( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
{
windowAlreadyExists = WindowList_Find(g_dat->hMessageWindowList, hContact) != NULL;
if (windowAlreadyExists)
@@ -413,10 +411,10 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) MessageWindowData *mwd = (MessageWindowData*)lParam;
HWND hwnd;
- if (mwid==NULL||mwd==NULL) return 1;
- if (mwid->cbSize!=sizeof(MessageWindowInputData)||mwd->cbSize!=sizeof(MessageWindowData)) return 1;
- if (mwid->hContact==NULL) return 1;
- if (mwid->uFlags!=MSG_WINDOW_UFLAG_MSG_BOTH) return 1;
+ if (mwid == NULL || mwd == NULL) return 1;
+ if (mwid->cbSize != sizeof(MessageWindowInputData) || mwd->cbSize != sizeof(SrmmWindowData)) return 1;
+ if (mwid->hContact == NULL) return 1;
+ if (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH) return 1;
hwnd = WindowList_Find(g_dat->hMessageWindowList, mwid->hContact);
mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
mwd->hwndWindow = hwnd;
@@ -427,8 +425,8 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) int LoadSendRecvMessageModule(void)
{
- if (LoadLibraryA("riched20.dll") == NULL) {
- if (IDYES !=
+ if (LoadLibraryA("riched20.dll") == NULL) {
+ if (IDYES !=
MessageBox(0,
TranslateT
("Miranda could not load the built-in message module, riched20.dll is missing. If you are using Windows 95 or WINE please make sure you have riched20.dll installed. Press 'Yes' to continue loading Miranda."),
@@ -440,7 +438,6 @@ int LoadSendRecvMessageModule(void) InitGlobals();
RichUtil_Load();
OleInitialize(NULL);
- InitREOleCallback();
InitOptions();
msgQueue_init();
@@ -472,118 +469,99 @@ int LoadSendRecvMessageModule(void) hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
- if (hCurHyperlinkHand == NULL)
+ if (hCurHyperlinkHand == NULL)
hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
InitStatusIcons();
return 0;
}
-static IRichEditOleCallbackVtbl reOleCallbackVtbl;
-struct CREOleCallback reOleCallback;
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+
+CREOleCallback reOleCallback;
-static STDMETHODIMP_(ULONG) CREOleCallback_QueryInterface(struct CREOleCallback *lpThis, REFIID riid, LPVOID * ppvObj)
+STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj)
{
- if (IsEqualIID(riid, &IID_IRichEditOleCallback)) {
- *ppvObj = lpThis;
- lpThis->lpVtbl->AddRef((IRichEditOleCallback *) lpThis);
+ if (IsEqualIID(riid, IID_IRichEditOleCallback)) {
+ *ppvObj = this;
+ AddRef();
return S_OK;
}
*ppvObj = NULL;
return E_NOINTERFACE;
}
-static STDMETHODIMP_(ULONG) CREOleCallback_AddRef(struct CREOleCallback *lpThis)
+STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
{
- if (lpThis->refCount == 0) {
- if (S_OK != StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &lpThis->pictStg))
- lpThis->pictStg = NULL;
- lpThis->nextStgId = 0;
+ if (refCount == 0) {
+ if (S_OK != StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg))
+ pictStg = NULL;
+ nextStgId = 0;
}
- return ++lpThis->refCount;
+ return ++refCount;
}
-static STDMETHODIMP_(ULONG) CREOleCallback_Release(struct CREOleCallback *lpThis)
+STDMETHODIMP_(ULONG) CREOleCallback::Release()
{
- if (--lpThis->refCount == 0) {
- if (lpThis->pictStg)
- lpThis->pictStg->lpVtbl->Release(lpThis->pictStg);
+ if (--refCount == 0) {
+ if (pictStg)
+ pictStg->Release();
}
- return lpThis->refCount;
+ return refCount;
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_ContextSensitiveHelp(struct CREOleCallback *lpThis, BOOL fEnterMode)
+STDMETHODIMP CREOleCallback::ContextSensitiveHelp(BOOL fEnterMode)
{
return S_OK;
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_DeleteObject(struct CREOleCallback *lpThis, LPOLEOBJECT lpoleobj)
+STDMETHODIMP CREOleCallback::DeleteObject(LPOLEOBJECT lpoleobj)
{
return S_OK;
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_GetClipboardData(struct CREOleCallback *lpThis, CHARRANGE * lpchrg, DWORD reco, LPDATAOBJECT * lplpdataobj)
+STDMETHODIMP CREOleCallback::GetClipboardData(CHARRANGE * lpchrg, DWORD reco, LPDATAOBJECT * lplpdataobj)
{
return E_NOTIMPL;
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_GetContextMenu(struct CREOleCallback *lpThis, WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE * lpchrg, HMENU * lphmenu)
+STDMETHODIMP CREOleCallback::GetContextMenu(WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE * lpchrg, HMENU * lphmenu)
{
return E_INVALIDARG;
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_GetDragDropEffect(struct CREOleCallback *lpThis, BOOL fDrag, DWORD grfKeyState, LPDWORD pdwEffect)
+STDMETHODIMP CREOleCallback::GetDragDropEffect(BOOL fDrag, DWORD grfKeyState, LPDWORD pdwEffect)
{
return S_OK;
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_GetInPlaceContext(struct CREOleCallback *lpThis, LPOLEINPLACEFRAME * lplpFrame, LPOLEINPLACEUIWINDOW * lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo)
+STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME * lplpFrame, LPOLEINPLACEUIWINDOW * lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
return E_INVALIDARG;
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_GetNewStorage(struct CREOleCallback *lpThis, LPSTORAGE * lplpstg)
+STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg)
{
WCHAR szwName[64];
char szName[64];
- wsprintfA(szName, "s%u", lpThis->nextStgId++);
+ wsprintfA(szName, "s%u", nextStgId++);
MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, SIZEOF(szwName));
- if (lpThis->pictStg == NULL)
+ if (pictStg == NULL)
return STG_E_MEDIUMFULL;
- return lpThis->pictStg->lpVtbl->CreateStorage(lpThis->pictStg, szwName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
+ return pictStg->CreateStorage(szwName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_QueryAcceptData(struct CREOleCallback *lpThis, LPDATAOBJECT lpdataobj, CLIPFORMAT * lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict)
+STDMETHODIMP CREOleCallback::QueryAcceptData(LPDATAOBJECT lpdataobj, CLIPFORMAT * lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict)
{
return S_OK;
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_QueryInsertObject(struct CREOleCallback *lpThis, LPCLSID lpclsid, LPSTORAGE lpstg, LONG cp)
+STDMETHODIMP CREOleCallback::QueryInsertObject(LPCLSID lpclsid, LPSTORAGE lpstg, LONG cp)
{
return S_OK;
}
-static STDMETHODIMP_(HRESULT) CREOleCallback_ShowContainerUI(struct CREOleCallback *lpThis, BOOL fShow)
+STDMETHODIMP CREOleCallback::ShowContainerUI(BOOL fShow)
{
return S_OK;
}
-
-static void InitREOleCallback(void)
-{
- reOleCallback.lpVtbl = &reOleCallbackVtbl;
- reOleCallback.lpVtbl->AddRef = (ULONG(__stdcall *) (IRichEditOleCallback *)) CREOleCallback_AddRef;
- reOleCallback.lpVtbl->Release = (ULONG(__stdcall *) (IRichEditOleCallback *)) CREOleCallback_Release;
- reOleCallback.lpVtbl->QueryInterface = (ULONG(__stdcall *) (IRichEditOleCallback *, REFIID, PVOID *)) CREOleCallback_QueryInterface;
- reOleCallback.lpVtbl->ContextSensitiveHelp = (HRESULT(__stdcall *) (IRichEditOleCallback *, BOOL)) CREOleCallback_ContextSensitiveHelp;
- reOleCallback.lpVtbl->DeleteObject = (HRESULT(__stdcall *) (IRichEditOleCallback *, LPOLEOBJECT)) CREOleCallback_DeleteObject;
- reOleCallback.lpVtbl->GetClipboardData = (HRESULT(__stdcall *) (IRichEditOleCallback *, CHARRANGE *, DWORD, LPDATAOBJECT *)) CREOleCallback_GetClipboardData;
- reOleCallback.lpVtbl->GetContextMenu = (HRESULT(__stdcall *) (IRichEditOleCallback *, WORD, LPOLEOBJECT, CHARRANGE *, HMENU *)) CREOleCallback_GetContextMenu;
- reOleCallback.lpVtbl->GetDragDropEffect = (HRESULT(__stdcall *) (IRichEditOleCallback *, BOOL, DWORD, LPDWORD)) CREOleCallback_GetDragDropEffect;
- reOleCallback.lpVtbl->GetInPlaceContext = (HRESULT(__stdcall *) (IRichEditOleCallback *, LPOLEINPLACEFRAME *, LPOLEINPLACEUIWINDOW *, LPOLEINPLACEFRAMEINFO))
- CREOleCallback_GetInPlaceContext;
- reOleCallback.lpVtbl->GetNewStorage = (HRESULT(__stdcall *) (IRichEditOleCallback *, LPSTORAGE *)) CREOleCallback_GetNewStorage;
- reOleCallback.lpVtbl->QueryAcceptData = (HRESULT(__stdcall *) (IRichEditOleCallback *, LPDATAOBJECT, CLIPFORMAT *, DWORD, BOOL, HGLOBAL)) CREOleCallback_QueryAcceptData;
- reOleCallback.lpVtbl->QueryInsertObject = (HRESULT(__stdcall *) (IRichEditOleCallback *, LPCLSID, LPSTORAGE, LONG)) CREOleCallback_QueryInsertObject;
- reOleCallback.lpVtbl->ShowContainerUI = (HRESULT(__stdcall *) (IRichEditOleCallback *, BOOL)) CREOleCallback_ShowContainerUI;
- reOleCallback.refCount = 0;
-}
diff --git a/plugins/SRMM/msgs.h b/plugins/SRMM/msgs.h index 842b291a08..4a02e67a32 100644 --- a/plugins/SRMM/msgs.h +++ b/plugins/SRMM/msgs.h @@ -31,7 +31,7 @@ struct NewMessageWindowLParam int noActivate;
};
-struct MessageWindowData
+struct SrmmWindowData
{
HANDLE hContact;
HANDLE hDbEventFirst, hDbEventLast;
@@ -89,18 +89,33 @@ struct MessageWindowData #define EVENTTYPE_JABBER_PRESENCE 2001
#define EVENTTYPE_STATUSCHANGE 25368
-struct CREOleCallback
+struct CREOleCallback : public IRichEditOleCallback
{
- IRichEditOleCallbackVtbl *lpVtbl;
+ CREOleCallback() : refCount(0) {}
unsigned refCount;
IStorage *pictStg;
int nextStgId;
+
+ STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * lplpObj);
+ STDMETHOD_(ULONG,AddRef) (THIS);
+ STDMETHOD_(ULONG,Release) (THIS);
+
+ STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode);
+ STDMETHOD(GetNewStorage) (LPSTORAGE FAR * lplpstg);
+ STDMETHOD(GetInPlaceContext) (LPOLEINPLACEFRAME FAR * lplpFrame, LPOLEINPLACEUIWINDOW FAR * lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo);
+ STDMETHOD(ShowContainerUI) (BOOL fShow);
+ STDMETHOD(QueryInsertObject) (LPCLSID lpclsid, LPSTORAGE lpstg, LONG cp);
+ STDMETHOD(DeleteObject) (LPOLEOBJECT lpoleobj);
+ STDMETHOD(QueryAcceptData) (LPDATAOBJECT lpdataobj, CLIPFORMAT FAR * lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
+ STDMETHOD(GetClipboardData) (CHARRANGE FAR * lpchrg, DWORD reco, LPDATAOBJECT FAR * lplpdataobj);
+ STDMETHOD(GetDragDropEffect) (BOOL fDrag, DWORD grfKeyState, LPDWORD pdwEffect);
+ STDMETHOD(GetContextMenu) (WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE FAR * lpchrg, HMENU FAR * lphmenu) ;
};
INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int DbEventIsForMsgWindow(DBEVENTINFO *dbei);
-int DbEventIsShown(DBEVENTINFO * dbei, struct MessageWindowData *dat);
+int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat);
void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend);
HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto);
diff --git a/plugins/SRMM/msgtimedout.c b/plugins/SRMM/msgtimedout.cpp index 1b1773aa8e..5b85682d87 100644 --- a/plugins/SRMM/msgtimedout.c +++ b/plugins/SRMM/msgtimedout.cpp @@ -98,7 +98,7 @@ void MessageFailureProcess(TMsgQueue *item, const char* err) CallService(MS_DB_EVENT_DELETE, (WPARAM)item->hContact, (LPARAM)item->hDbEvent);
hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE)item->hContact);
- if (hwnd == NULL)
+ if (hwnd == NULL)
{
SendMessageCmd(item->hContact, NULL, 0);
hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE)item->hContact);
diff --git a/plugins/SRMM/richutil.c b/plugins/SRMM/richutil.cpp index a8253be098..5210f1bf00 100644 --- a/plugins/SRMM/richutil.c +++ b/plugins/SRMM/richutil.cpp @@ -79,12 +79,12 @@ void RichUtil_Load(void) MyDrawThemeParentBackground = (HRESULT (WINAPI *)(HWND, HDC, RECT*))GetProcAddress(mTheme, "DrawThemeParentBackground");
MyIsThemeBackgroundPartiallyTransparent = (BOOL (WINAPI *)(HANDLE, int, int))GetProcAddress(mTheme, "IsThemeBackgroundPartiallyTransparent");
- if (!MyOpenThemeData ||
- !MyCloseThemeData ||
- !MyIsThemeActive ||
- !MyDrawThemeBackground ||
- !MyGetThemeBackgroundContentRect ||
- !MyDrawThemeParentBackground ||
+ if (!MyOpenThemeData ||
+ !MyCloseThemeData ||
+ !MyIsThemeActive ||
+ !MyDrawThemeBackground ||
+ !MyGetThemeBackgroundContentRect ||
+ !MyDrawThemeParentBackground ||
!MyIsThemeBackgroundPartiallyTransparent)
{
FreeLibrary(mTheme);
@@ -128,10 +128,10 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM TRichUtil *ru;
EnterCriticalSection(&csRich);
- ru = li.List_Find(&sListInt, (TRichUtil*)&hwnd);
+ ru = (TRichUtil *)li.List_Find(&sListInt, (TRichUtil*)&hwnd);
LeaveCriticalSection(&csRich);
- if (ru == NULL) return 0;
+ if (ru == NULL) return 0;
switch(msg)
{
@@ -209,7 +209,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rcClient ={0};
HDC hdc = GetDC(GetParent(hwnd));
- if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK)
+ if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK)
{
ru->rect.left = rcClient.left-ncsParam->rgrc[0].left;
ru->rect.top = rcClient.top-ncsParam->rgrc[0].top;
@@ -241,7 +241,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (IsWindow(hwnd))
{
- if ((WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC) == &RichUtil_Proc)
+ if ((WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC) == &RichUtil_Proc)
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)ru->origProc);
}
diff --git a/plugins/SRMM/srmm.c b/plugins/SRMM/srmm.cpp index 801b856a61..20ef673b8e 100644 --- a/plugins/SRMM/srmm.c +++ b/plugins/SRMM/srmm.cpp @@ -52,18 +52,18 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE;
}
-__declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
}
static const MUUID interfaces[] = {MIID_SRMM, MIID_LAST};
-__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
{
return interfaces;
}
-int __declspec(dllexport) Load(PLUGINLINK * link)
+extern "C" int __declspec(dllexport) Load(PLUGINLINK * link)
{
pluginLink = link;
mir_getMMI(&mmi);
@@ -75,7 +75,7 @@ int __declspec(dllexport) Load(PLUGINLINK * link) return LoadSendRecvMessageModule();
}
-int __declspec(dllexport) Unload(void)
+extern "C" int __declspec(dllexport) Unload(void)
{
UnloadOptions();
return SplitmsgShutdown();
diff --git a/plugins/SRMM/srmm_10.vcxproj b/plugins/SRMM/srmm_10.vcxproj index bde897fe7b..e6f96a5014 100644 --- a/plugins/SRMM/srmm_10.vcxproj +++ b/plugins/SRMM/srmm_10.vcxproj @@ -201,18 +201,18 @@ </PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="cmdlist.c" />
- <ClCompile Include="globals.c" />
- <ClCompile Include="msgdialog.c" />
- <ClCompile Include="msglog.c" />
- <ClCompile Include="msgoptions.c" />
- <ClCompile Include="msgs.c" />
- <ClCompile Include="msgtimedout.c" />
- <ClCompile Include="richutil.c" />
- <ClCompile Include="srmm.c">
+ <ClCompile Include="cmdlist.cpp" />
+ <ClCompile Include="globals.cpp" />
+ <ClCompile Include="msgdialog.cpp" />
+ <ClCompile Include="msglog.cpp" />
+ <ClCompile Include="msgoptions.cpp" />
+ <ClCompile Include="msgs.cpp" />
+ <ClCompile Include="msgtimedout.cpp" />
+ <ClCompile Include="richutil.cpp" />
+ <ClCompile Include="srmm.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="statusicon.c" />
+ <ClCompile Include="statusicon.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cmdlist.h" />
diff --git a/plugins/SRMM/statusicon.c b/plugins/SRMM/statusicon.cpp index cd7ac3872e..7e45c4c844 100644 --- a/plugins/SRMM/statusicon.c +++ b/plugins/SRMM/statusicon.cpp @@ -55,7 +55,7 @@ INT_PTR RemoveStatusIcon(WPARAM wParam, LPARAM lParam) { struct StatusIconListNode *current = status_icon_list, *prev = 0;
while(current) {
- if(strcmp(current->sid.szModule, sid->szModule) == 0 && current->sid.dwId == sid->dwId) {
+ if(strcmp(current->sid.szModule, sid->szModule) == 0 && current->sid.dwId == sid->dwId) {
if(prev) prev->next = current->next;
else status_icon_list = current->next;
@@ -102,7 +102,7 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) { struct StatusIconListNode *current = status_icon_list, *prev = 0;
while(current) {
- if(strcmp(current->sid.szModule, sid->szModule) == 0 && current->sid.dwId == sid->dwId) {
+ if(strcmp(current->sid.szModule, sid->szModule) == 0 && current->sid.dwId == sid->dwId) {
if (!hContact) {
current->sid.flags = sid->flags;
if(sid->hIcon) {
|