summaryrefslogtreecommitdiff
path: root/plugins/AVS/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-12-13 07:47:16 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-12-13 07:47:16 +0000
commitcce79a92d5341111997eaf7fd0a420fdddc3e50d (patch)
tree5b7677c4fae5647220b0e9e160296c2834826d6e /plugins/AVS/src
parent3a93a20a595f312127dc086bc673b41a3bcd9def (diff)
AVS: changed warning lavel to w4
git-svn-id: http://svn.miranda-ng.org/main/trunk@11360 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AVS/src')
-rw-r--r--plugins/AVS/src/acc.cpp267
-rw-r--r--plugins/AVS/src/acc.h8
-rw-r--r--plugins/AVS/src/image_utils.cpp34
-rw-r--r--plugins/AVS/src/image_utils.h4
-rw-r--r--plugins/AVS/src/main.cpp45
-rw-r--r--plugins/AVS/src/options.cpp310
-rw-r--r--plugins/AVS/src/poll.cpp14
-rw-r--r--plugins/AVS/src/services.cpp29
-rw-r--r--plugins/AVS/src/utils.cpp11
9 files changed, 347 insertions, 375 deletions
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp
index 9a85388ef7..77adec8d91 100644
--- a/plugins/AVS/src/acc.cpp
+++ b/plugins/AVS/src/acc.cpp
@@ -158,7 +158,6 @@ void AnimatedGifMountFrame(ACCData* data, int page)
data->ag.frame.height = fei->FI_GetHeight(dib);
//decode page
- int palSize = fei->FI_GetColorsUsed(dib);
RGBQUAD *pal = fei->FI_GetPalette(dib);
bool have_transparent = false;
int transparent_color = -1;
@@ -206,7 +205,7 @@ void AnimatedGifDeleteTmpValues(ACCData* data)
}
}
-void DestroyAnimatedGif(HWND hwnd, ACCData* data)
+void DestroyAnimatedGif(ACCData* data)
{
if (!data->showingAnimatedGif)
return;
@@ -231,7 +230,7 @@ void DestroyAnimatedGif(HWND hwnd, ACCData* data)
data->ag.started = FALSE;
}
-void StartAnimatedGif(HWND hwnd, ACCData* data)
+void StartAnimatedGif(ACCData* data)
{
if (fei == NULL)
return;
@@ -292,14 +291,14 @@ ERR:
data->ag.multi = NULL;
}
-void DestroyAnimation(HWND hwnd, ACCData* data)
+void DestroyAnimation(ACCData* data)
{
- DestroyAnimatedGif(hwnd, data);
+ DestroyAnimatedGif(data);
}
-void StartAnimation(HWND hwnd, ACCData* data)
+void StartAnimation(ACCData* data)
{
- StartAnimatedGif(hwnd, data);
+ StartAnimatedGif(data);
}
BOOL ScreenToClient(HWND hWnd, LPRECT lpRect)
@@ -400,7 +399,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
return TRUE;
case WM_NCDESTROY:
- DestroyAnimation(hwnd, data);
+ DestroyAnimation(data);
if (data) {
UnhookEvent(data->hHook);
UnhookEvent(data->hHookMy);
@@ -418,8 +417,8 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (lParam == 0)
return FALSE;
- if (data->hContact != lParam) {
- DestroyAnimation(hwnd, data);
+ if (data->hContact != (MCONTACT)lParam) {
+ DestroyAnimation(data);
data->hContact = lParam;
if (lParam == NULL)
@@ -427,7 +426,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
else
mir_strncpy(data->proto, GetContactProto(data->hContact), sizeof(data->proto));
- StartAnimation(hwnd, data);
+ StartAnimation(data);
NotifyAvatarChange(hwnd);
Invalidate(hwnd);
@@ -437,12 +436,12 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case AVATAR_SETPROTOCOL:
szProto = (lParam == NULL) ? "" : (char*)lParam;
if (data->hContact != 0 || strcmp(szProto, data->proto)) {
- DestroyAnimation(hwnd, data);
+ DestroyAnimation(data);
data->hContact = NULL;
strncpy_s(data->proto, szProto, _TRUNCATE);
- StartAnimation(hwnd, data);
+ StartAnimation(data);
NotifyAvatarChange(hwnd);
Invalidate(hwnd);
}
@@ -494,52 +493,52 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
return(TRUE);
case AVATAR_GETUSEDSPACE:
- {
- int *width = (int*)wParam;
- int *height = (int*)lParam;
+ {
+ int *width = (int*)wParam;
+ int *height = (int*)lParam;
- RECT rc;
- GetClientRect(hwnd, &rc);
-
- // Get avatar
- avatarCacheEntry *ace;
- if (data->hContact == NULL)
- ace = (avatarCacheEntry *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)data->proto);
- else
- ace = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0);
-
- if (ace == NULL || ace->bmHeight == 0 || ace->bmWidth == 0
- || (data->respectHidden && (ace->dwFlags & AVS_HIDEONCLIST))) {
- *width = 0;
- *height = 0;
- return TRUE;
- }
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+
+ // Get avatar
+ avatarCacheEntry *ace;
+ if (data->hContact == NULL)
+ ace = (avatarCacheEntry *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)data->proto);
+ else
+ ace = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0);
+
+ if (ace == NULL || ace->bmHeight == 0 || ace->bmWidth == 0
+ || (data->respectHidden && (ace->dwFlags & AVS_HIDEONCLIST))) {
+ *width = 0;
+ *height = 0;
+ return TRUE;
+ }
- // Get its size
- int targetWidth = rc.right - rc.left;
- int targetHeight = rc.bottom - rc.top;
+ // Get its size
+ int targetWidth = rc.right - rc.left;
+ int targetHeight = rc.bottom - rc.top;
- if (!data->resizeIfSmaller && ace->bmHeight <= targetHeight && ace->bmWidth <= targetWidth) {
- *height = ace->bmHeight;
- *width = ace->bmWidth;
- }
- else if (ace->bmHeight > ace->bmWidth) {
- float dScale = targetHeight / (float)ace->bmHeight;
- *height = targetHeight;
- *width = (int)(ace->bmWidth * dScale);
- }
- else {
- float dScale = targetWidth / (float)ace->bmWidth;
- *height = (int)(ace->bmHeight * dScale);
- *width = targetWidth;
- }
+ if (!data->resizeIfSmaller && ace->bmHeight <= targetHeight && ace->bmWidth <= targetWidth) {
+ *height = ace->bmHeight;
+ *width = ace->bmWidth;
}
- return TRUE;
+ else if (ace->bmHeight > ace->bmWidth) {
+ float dScale = targetHeight / (float)ace->bmHeight;
+ *height = targetHeight;
+ *width = (int)(ace->bmWidth * dScale);
+ }
+ else {
+ float dScale = targetWidth / (float)ace->bmWidth;
+ *height = (int)(ace->bmHeight * dScale);
+ *width = targetWidth;
+ }
+ }
+ return TRUE;
case DM_AVATARCHANGED:
if (data->hContact == wParam) {
- DestroyAnimation(hwnd, data);
- StartAnimation(hwnd, data);
+ DestroyAnimation(data);
+ StartAnimation(data);
NotifyAvatarChange(hwnd);
Invalidate(hwnd);
@@ -548,8 +547,8 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case DM_MYAVATARCHANGED:
if (data->hContact == NULL && strcmp(data->proto, (char*)wParam) == 0) {
- DestroyAnimation(hwnd, data);
- StartAnimation(hwnd, data);
+ DestroyAnimation(data);
+ StartAnimation(data);
NotifyAvatarChange(hwnd);
Invalidate(hwnd);
@@ -558,99 +557,99 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case WM_NCPAINT:
case WM_PAINT:
- {
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(hwnd, &ps);
- if (hdc == NULL)
- break;
+ {
+ PAINTSTRUCT ps;
+ HDC hdc = BeginPaint(hwnd, &ps);
+ if (hdc == NULL)
+ break;
- int oldBkMode = SetBkMode(hdc, TRANSPARENT);
- SetStretchBltMode(hdc, HALFTONE);
+ int oldBkMode = SetBkMode(hdc, TRANSPARENT);
+ SetStretchBltMode(hdc, HALFTONE);
- RECT rc;
- GetClientRect(hwnd, &rc);
+ RECT rc;
+ GetClientRect(hwnd, &rc);
- // Draw background
- if (data->bkgColor != -1) {
- HBRUSH hbrush = CreateSolidBrush(data->bkgColor);
- FillRect(hdc, &rc, hbrush);
- DeleteObject(hbrush);
- }
+ // Draw background
+ if (data->bkgColor != -1) {
+ HBRUSH hbrush = CreateSolidBrush(data->bkgColor);
+ FillRect(hdc, &rc, hbrush);
+ DeleteObject(hbrush);
+ }
- if (data->hContact == NULL && data->proto[0] == 0 && db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1))
- DrawText(hdc, data->hFont, rc, TranslateT("Protocols have different avatars"));
-
- // Has an animated gif
- // Has a "normal" image
- else {
- // Draw avatar
- AVATARDRAWREQUEST avdrq = { 0 };
- avdrq.cbSize = sizeof(avdrq);
- avdrq.rcDraw = rc;
- avdrq.hContact = data->hContact;
- avdrq.szProto = data->proto;
- avdrq.hTargetDC = hdc;
- avdrq.dwFlags = AVDRQ_HIDEBORDERONTRANSPARENCY
- | (data->respectHidden ? AVDRQ_RESPECTHIDDEN : 0)
- | (data->hContact != NULL ? 0 : AVDRQ_OWNPIC)
- | (data->avatarBorderColor == -1 ? 0 : AVDRQ_DRAWBORDER)
- | (data->avatarRoundCornerRadius <= 0 ? 0 : AVDRQ_ROUNDEDCORNER)
- | (data->fAero ? AVDRQ_AERO : 0)
- | (data->resizeIfSmaller ? 0 : AVDRQ_DONTRESIZEIFSMALLER);
- avdrq.clrBorder = data->avatarBorderColor;
- avdrq.radius = data->avatarRoundCornerRadius;
-
- INT_PTR ret;
- if (data->showingAnimatedGif) {
- InternalDrawAvatar(&avdrq, data->ag.hbms[data->ag.frame.num], data->ag.logicalWidth, data->ag.logicalHeight, 0);
- ret = 1;
-
- if (!data->ag.started) {
- SetTimer(hwnd, 0, data->ag.times[data->ag.frame.num], NULL);
- data->ag.started = TRUE;
- }
+ if (data->hContact == NULL && data->proto[0] == 0 && db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1))
+ DrawText(hdc, data->hFont, rc, TranslateT("Protocols have different avatars"));
+
+ // Has an animated gif
+ // Has a "normal" image
+ else {
+ // Draw avatar
+ AVATARDRAWREQUEST avdrq = { 0 };
+ avdrq.cbSize = sizeof(avdrq);
+ avdrq.rcDraw = rc;
+ avdrq.hContact = data->hContact;
+ avdrq.szProto = data->proto;
+ avdrq.hTargetDC = hdc;
+ avdrq.dwFlags = AVDRQ_HIDEBORDERONTRANSPARENCY
+ | (data->respectHidden ? AVDRQ_RESPECTHIDDEN : 0)
+ | (data->hContact != NULL ? 0 : AVDRQ_OWNPIC)
+ | (data->avatarBorderColor == -1 ? 0 : AVDRQ_DRAWBORDER)
+ | (data->avatarRoundCornerRadius <= 0 ? 0 : AVDRQ_ROUNDEDCORNER)
+ | (data->fAero ? AVDRQ_AERO : 0)
+ | (data->resizeIfSmaller ? 0 : AVDRQ_DONTRESIZEIFSMALLER);
+ avdrq.clrBorder = data->avatarBorderColor;
+ avdrq.radius = data->avatarRoundCornerRadius;
+
+ INT_PTR ret;
+ if (data->showingAnimatedGif) {
+ InternalDrawAvatar(&avdrq, data->ag.hbms[data->ag.frame.num], data->ag.logicalWidth, data->ag.logicalHeight, 0);
+ ret = 1;
+
+ if (!data->ag.started) {
+ SetTimer(hwnd, 0, data->ag.times[data->ag.frame.num], NULL);
+ data->ag.started = TRUE;
}
- else
- ret = DrawAvatarPicture(0, (LPARAM)&avdrq);
-
- if (ret == 0)
- DrawText(hdc, data->hFont, rc, data->noAvatarText);
- }
-
- // Draw control border
- if (data->borderColor != -1) {
- HBRUSH hbrush = CreateSolidBrush(data->borderColor);
- FrameRect(hdc, &rc, hbrush);
- DeleteObject(hbrush);
}
+ else
+ ret = DrawAvatarPicture(0, (LPARAM)&avdrq);
- SetBkMode(hdc, oldBkMode);
+ if (ret == 0)
+ DrawText(hdc, data->hFont, rc, data->noAvatarText);
+ }
- EndPaint(hwnd, &ps);
+ // Draw control border
+ if (data->borderColor != -1) {
+ HBRUSH hbrush = CreateSolidBrush(data->borderColor);
+ FrameRect(hdc, &rc, hbrush);
+ DeleteObject(hbrush);
}
- return TRUE;
+
+ SetBkMode(hdc, oldBkMode);
+
+ EndPaint(hwnd, &ps);
+ }
+ return TRUE;
case WM_ERASEBKGND:
- {
- HDC hdc = (HDC)wParam;
- RECT rc;
- GetClientRect(hwnd, &rc);
-
- // Draw background
- if (data->bkgColor != -1) {
- HBRUSH hbrush = CreateSolidBrush(data->bkgColor);
- FillRect(hdc, &rc, hbrush);
- DeleteObject(hbrush);
- }
+ {
+ HDC hdc = (HDC)wParam;
+ RECT rc;
+ GetClientRect(hwnd, &rc);
- // Draw control border
- if (data->borderColor != -1) {
- HBRUSH hbrush = CreateSolidBrush(data->borderColor);
- FrameRect(hdc, &rc, hbrush);
- DeleteObject(hbrush);
- }
+ // Draw background
+ if (data->bkgColor != -1) {
+ HBRUSH hbrush = CreateSolidBrush(data->bkgColor);
+ FillRect(hdc, &rc, hbrush);
+ DeleteObject(hbrush);
}
- return TRUE;
+
+ // Draw control border
+ if (data->borderColor != -1) {
+ HBRUSH hbrush = CreateSolidBrush(data->borderColor);
+ FrameRect(hdc, &rc, hbrush);
+ DeleteObject(hbrush);
+ }
+ }
+ return TRUE;
case WM_SIZE:
InvalidateRect(hwnd, NULL, TRUE);
diff --git a/plugins/AVS/src/acc.h b/plugins/AVS/src/acc.h
index 4ac03915f0..356a09dea3 100644
--- a/plugins/AVS/src/acc.h
+++ b/plugins/AVS/src/acc.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 2006 Ricardo Pescuma Domenecci, Nightwish
This is free software; you can redistribute it and/or
@@ -14,15 +14,15 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#ifndef __ACC_H__
# define __ACC_H__
-INT_PTR avSetAvatar(MCONTACT hContact, TCHAR* tszPath );
-INT_PTR avSetMyAvatar( char* szProto, TCHAR* tszPath );
+static INT_PTR avSetAvatar(MCONTACT hContact, TCHAR *tszPath);
+INT_PTR avSetMyAvatar(char *szProto, TCHAR *tszPath);
int LoadACC();
diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp
index f73793a44d..520e077254 100644
--- a/plugins/AVS/src/image_utils.cpp
+++ b/plugins/AVS/src/image_utils.cpp
@@ -214,7 +214,7 @@ int BmpFilterSaveBitmap(HBITMAP hBmp, const TCHAR *ptszFile, int flags)
if (_tcslen(tszFilename) <= 4)
return -1;
-
+
IMGSRVC_INFO i = { 0 };
i.cbSize = sizeof(IMGSRVC_INFO);
i.wszName = tszFilename;
@@ -248,8 +248,8 @@ void AddToStack(int *stack, int *topPos, int x, int y)
(*topPos)++;
}
-BOOL GetColorForPoint(int colorDiff, BYTE *p, int width, int height,
- int x0, int y0, int x1, int y1, int x2, int y2, BOOL *foundBkg, BYTE colors[][3])
+BOOL GetColorForPoint(int colorDiff, BYTE *p, int width,
+ int x0, int y0, int x1, int y1, int x2, int y2, BOOL *foundBkg, BYTE colors[][3])
{
BYTE *px1 = GET_PIXEL(p, x0, y0);
BYTE *px2 = GET_PIXEL(p, x1, y1);
@@ -296,7 +296,7 @@ DWORD GetImgHash(HBITMAP hBitmap)
/*
* Changes the handle to a grayscale image
*/
-HBITMAP MakeGrayscale(MCONTACT hContact, HBITMAP hBitmap)
+HBITMAP MakeGrayscale(HBITMAP hBitmap)
{
if (hBitmap) {
FIBITMAP *dib = fei->FI_CreateDIBFromHBITMAP(hBitmap);
@@ -350,7 +350,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
// Top left
BYTE colors[8][3];
BOOL foundBkg[8];
- if (!GetColorForPoint(colorDiff, p, width, height, 0, 0, 0, 1, 1, 0, &foundBkg[0], &colors[0])) {
+ if (!GetColorForPoint(colorDiff, p, width, 0, 0, 0, 1, 1, 0, &foundBkg[0], &colors[0])) {
if (hBmpTmp != *hBitmap)
DeleteObject(hBmpTmp);
free(p);
@@ -358,7 +358,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
}
// Top center
- if (!GetColorForPoint(colorDiff, p, width, height, width / 2, 0, width / 2 - 1, 0, width / 2 + 1, 0, &foundBkg[1], &colors[1])) {
+ if (!GetColorForPoint(colorDiff, p, width, width / 2, 0, width / 2 - 1, 0, width / 2 + 1, 0, &foundBkg[1], &colors[1])) {
if (hBmpTmp != *hBitmap)
DeleteObject(hBmpTmp);
free(p);
@@ -366,7 +366,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
}
// Top Right
- if (!GetColorForPoint(colorDiff, p, width, height,
+ if (!GetColorForPoint(colorDiff, p, width,
width - 1, 0, width - 1, 1, width - 2, 0, &foundBkg[2], &colors[2])) {
if (hBmpTmp != *hBitmap)
DeleteObject(hBmpTmp);
@@ -375,7 +375,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
}
// Center left
- if (!GetColorForPoint(colorDiff, p, width, height, 0, height / 2, 0, height / 2 - 1, 0, height / 2 + 1, &foundBkg[3], &colors[3])) {
+ if (!GetColorForPoint(colorDiff, p, width, 0, height / 2, 0, height / 2 - 1, 0, height / 2 + 1, &foundBkg[3], &colors[3])) {
if (hBmpTmp != *hBitmap)
DeleteObject(hBmpTmp);
free(p);
@@ -383,7 +383,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
}
// Center left
- if (!GetColorForPoint(colorDiff, p, width, height, width - 1, height / 2, width - 1, height / 2 - 1, width - 1, height / 2 + 1, &foundBkg[4], &colors[4])) {
+ if (!GetColorForPoint(colorDiff, p, width, width - 1, height / 2, width - 1, height / 2 - 1, width - 1, height / 2 + 1, &foundBkg[4], &colors[4])) {
if (hBmpTmp != *hBitmap)
DeleteObject(hBmpTmp);
free(p);
@@ -391,7 +391,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
}
// Bottom left
- if (!GetColorForPoint(colorDiff, p, width, height, 0, height - 1, 0, height - 2, 1, height - 1, &foundBkg[5], &colors[5])) {
+ if (!GetColorForPoint(colorDiff, p, width, 0, height - 1, 0, height - 2, 1, height - 1, &foundBkg[5], &colors[5])) {
if (hBmpTmp != *hBitmap)
DeleteObject(hBmpTmp);
free(p);
@@ -399,7 +399,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
}
// Bottom center
- if (!GetColorForPoint(colorDiff, p, width, height, width / 2, height - 1, width / 2 - 1, height - 1, width / 2 + 1, height - 1, &foundBkg[6], &colors[6])) {
+ if (!GetColorForPoint(colorDiff, p, width, width / 2, height - 1, width / 2 - 1, height - 1, width / 2 + 1, height - 1, &foundBkg[6], &colors[6])) {
if (hBmpTmp != *hBitmap)
DeleteObject(hBmpTmp);
free(p);
@@ -407,7 +407,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
}
// Bottom Right
- if (!GetColorForPoint(colorDiff, p, width, height, width - 1, height - 1, width - 1, height - 2, width - 2, height - 1, &foundBkg[7], &colors[7])) {
+ if (!GetColorForPoint(colorDiff, p, width, width - 1, height - 1, width - 1, height - 2, width - 2, height - 1, &foundBkg[7], &colors[7])) {
if (hBmpTmp != *hBitmap)
DeleteObject(hBmpTmp);
free(p);
@@ -429,7 +429,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
}
// Ok, X corners at least have a color, lets compare then
- int maxCount = 0, selectedColor;
+ int maxCount = 0, selectedColor = 0;
for (i = 0; i < 8; i++) {
if (foundBkg[i]) {
count = 0;
@@ -521,10 +521,10 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
if (px1[3] >= 253) {
if (ColorsAreTheSame(colorDiff, px1, (BYTE *)&colors[selectedColor])) {
px1[3] = (transpProportional) ? min(252,
- (abs(px1[0] - colors[selectedColor][0])
- + abs(px1[1] - colors[selectedColor][1])
- + abs(px1[2] - colors[selectedColor][2])) / 3) : 0;
-
+ (abs(px1[0] - colors[selectedColor][0])
+ + abs(px1[1] - colors[selectedColor][1])
+ + abs(px1[2] - colors[selectedColor][2])) / 3) : 0;
+
// Add 4 neighbours
if (x + 1 < width)
AddToStack(stack, &topPos, x + 1, y);
diff --git a/plugins/AVS/src/image_utils.h b/plugins/AVS/src/image_utils.h
index e69e3b8b69..b61f05b883 100644
--- a/plugins/AVS/src/image_utils.h
+++ b/plugins/AVS/src/image_utils.h
@@ -8,9 +8,9 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap);
BOOL PreMultiply(HBITMAP hBitmap);
BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap);
-HBITMAP MakeGrayscale(MCONTACT hContact, HBITMAP hBitmap);
+HBITMAP MakeGrayscale(HBITMAP hBitmap);
DWORD GetImgHash(HBITMAP hBitmap);
-int SaveAvatar( const char* protocol, const TCHAR* tszFileName );
+int SaveAvatar(const char* protocol, const TCHAR* tszFileName);
#endif // __IMAGE_UTILS_H__
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp
index 963f12429b..98da569036 100644
--- a/plugins/AVS/src/main.cpp
+++ b/plugins/AVS/src/main.cpp
@@ -43,18 +43,18 @@ HANDLE hEventChanged, hEventContactAvatarChanged, hMyAvatarChanged;
void InitServices();
-static int ComparePicture( const protoPicCacheEntry* p1, const protoPicCacheEntry* p2 )
+static int ComparePicture(const protoPicCacheEntry* p1, const protoPicCacheEntry* p2)
{
if ((mir_strcmp(p1->szProtoname, "Global avatar") == 0) || strstr(p1->szProtoname, "Global avatar"))
return -1;
if ((mir_strcmp(p2->szProtoname, "Global avatar") == 0) || strstr(p1->szProtoname, "Global avatar"))
return 1;
- return mir_strcmp( p1->szProtoname, p2->szProtoname );
+ return mir_strcmp(p1->szProtoname, p2->szProtoname);
}
OBJLIST<protoPicCacheEntry>
- g_ProtoPictures( 10, ComparePicture ),
- g_MyAvatars( 10, ComparePicture );
+g_ProtoPictures(10, ComparePicture),
+g_MyAvatars(10, ComparePicture);
char* g_szMetaName = NULL;
@@ -76,29 +76,10 @@ PLUGININFOEX pluginInfoEx = {
__AUTHORWEB,
UNICODE_AWARE,
// {E00F1643-263C-4599-B84B-053E5C511D29}
- {0xe00f1643, 0x263c, 0x4599, {0xb8, 0x4b, 0x5, 0x3e, 0x5c, 0x51, 0x1d, 0x29}}
+ { 0xe00f1643, 0x263c, 0x4599, { 0xb8, 0x4b, 0x5, 0x3e, 0x5c, 0x51, 0x1d, 0x29 } }
};
-static TCHAR* getJGMailID(char *szProto)
-{
- static TCHAR szJID[MAX_PATH + 1]; szJID[0] = '\0';
-
- DBVARIANT dbva, dbvb;
- if (db_get_ts(NULL, szProto, "LoginName", &dbva))
- return szJID;
-
- if (db_get_ts(NULL, szProto, "LoginServer", &dbvb)) {
- db_free(&dbva);
- return szJID;
- }
-
- mir_sntprintf(szJID, SIZEOF(szJID), _T("%s@%s"), dbva.ptszVal, dbvb.ptszVal);
- db_free(&dbva);
- db_free(&dbvb);
- return szJID;
-}
-
-static int ProtocolAck(WPARAM wParam, LPARAM lParam)
+static int ProtocolAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
if (ack != NULL && ack->type == ACKTYPE_AVATAR && !db_mc_isMeta(ack->hContact)) {
@@ -210,7 +191,7 @@ static int OnAccChanged(WPARAM wParam, LPARAM lParam)
if ((idx = g_MyAvatars.getIndex(&tmp)) != -1)
g_MyAvatars.remove(idx);
}
- break;
+ break;
}
return 0;
@@ -229,13 +210,13 @@ static int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
}
-static int ContactDeleted(WPARAM wParam, LPARAM lParam)
+static int ContactDeleted(WPARAM wParam, LPARAM)
{
DeleteAvatarFromCache(wParam, TRUE);
return 0;
}
-static int ShutdownProc(WPARAM wParam, LPARAM lParam)
+static int ShutdownProc(WPARAM, LPARAM)
{
g_shutDown = true;
SetEvent(hLoaderEvent);
@@ -350,12 +331,10 @@ void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bm
}
}
-static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+static int ModulesLoaded(WPARAM, LPARAM)
{
int i;
- DBVARIANT dbv = { 0 };
TCHAR szEventName[100];
- int result = 0;
mir_sntprintf(szEventName, SIZEOF(szEventName), _T("avs_loaderthread_%d"), GetCurrentThreadId());
hLoaderEvent = CreateEvent(NULL, TRUE, FALSE, szEventName);
@@ -418,13 +397,13 @@ static int LoadAvatarModule()
return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved)
+BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID)
{
g_hInst = hInstDLL;
return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp
index 25dcb99a5d..91e7c75151 100644
--- a/plugins/AVS/src/options.cpp
+++ b/plugins/AVS/src/options.cpp
@@ -209,8 +209,8 @@ static INT_PTR CALLBACK DlgProcOptionsAvatars(HWND hwndDlg, UINT msg, WPARAM wPa
case WM_COMMAND:
if ((LOWORD(wParam) == IDC_BKG_NUM_POINTS || LOWORD(wParam) == IDC_BKG_COLOR_DIFFERENCE)
- && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return FALSE;
+ && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
+ return FALSE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -246,7 +246,7 @@ static INT_PTR CALLBACK DlgProcOptionsAvatars(HWND hwndDlg, UINT msg, WPARAM wPa
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR CALLBACK DlgProcOptionsOwn(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcOptionsOwn(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
@@ -343,19 +343,19 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar
break;
case WM_DRAWITEM:
- {
- LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
- if (dis->CtlType == ODT_BUTTON && dis->CtlID == IDC_PROTOPIC) {
- AVATARDRAWREQUEST avdrq = { 0 };
- avdrq.cbSize = sizeof(avdrq);
- avdrq.hTargetDC = dis->hDC;
- avdrq.dwFlags |= AVDRQ_PROTOPICT;
- avdrq.szProto = g_selectedProto;
- GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), &avdrq.rcDraw);
- CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&avdrq);
- }
+ {
+ LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
+ if (dis->CtlType == ODT_BUTTON && dis->CtlID == IDC_PROTOPIC) {
+ AVATARDRAWREQUEST avdrq = { 0 };
+ avdrq.cbSize = sizeof(avdrq);
+ avdrq.hTargetDC = dis->hDC;
+ avdrq.dwFlags |= AVDRQ_PROTOPICT;
+ avdrq.szProto = g_selectedProto;
+ GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), &avdrq.rcDraw);
+ CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&avdrq);
}
- return TRUE;
+ }
+ return TRUE;
case WM_NOTIFY:
if (dialoginit)
@@ -365,20 +365,20 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar
case IDC_PROTOCOLS:
switch (((LPNMHDR)lParam)->code) {
case LVN_KEYDOWN:
- {
- NMLVKEYDOWN* ptkd = (NMLVKEYDOWN*)lParam;
- if (ptkd&&ptkd->wVKey == VK_SPACE&&ListView_GetSelectedCount(ptkd->hdr.hwndFrom) == 1)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
+ {
+ NMLVKEYDOWN* ptkd = (NMLVKEYDOWN*)lParam;
+ if (ptkd&&ptkd->wVKey == VK_SPACE&&ListView_GetSelectedCount(ptkd->hdr.hwndFrom) == 1)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
case LVN_ITEMCHANGED:
- {
- NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
- if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_PROTOCOLS)) && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
+ {
+ NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
+ if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_PROTOCOLS)) && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
case NM_CLICK:
EnableWindow(hwndChoosePic, TRUE);
@@ -532,28 +532,28 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case IDOK:
- {
- BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR);
- int hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) ? 1 : 0;
- SetAvatarAttribute(hContact, AVS_HIDEONCLIST, hidden);
- if (hidden != db_get_b(hContact, "ContactPhoto", "Hidden", 0))
- db_set_b(hContact, "ContactPhoto", "Hidden", hidden);
-
- if (!locked && db_get_b(hContact, "ContactPhoto", "NeedUpdate", 0))
- QueueAdd(hContact);
- }
- // Continue to the cancel handle
+ {
+ BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR);
+ int hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) ? 1 : 0;
+ SetAvatarAttribute(hContact, AVS_HIDEONCLIST, hidden);
+ if (hidden != db_get_b(hContact, "ContactPhoto", "Hidden", 0))
+ db_set_b(hContact, "ContactPhoto", "Hidden", hidden);
+
+ if (!locked && db_get_b(hContact, "ContactPhoto", "NeedUpdate", 0))
+ QueueAdd(hContact);
+ }
+ // Continue to the cancel handle
case IDCANCEL:
DestroyWindow(hwndDlg);
break;
case IDC_PROTECTAVATAR:
- {
- BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR);
- ProtectAvatar(hContact, locked ? 1 : 0);
- }
- break;
+ {
+ BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR);
+ ProtectAvatar(hContact, locked ? 1 : 0);
+ }
+ break;
case IDC_CHANGE:
SetAvatar(hContact, 0);
@@ -567,18 +567,18 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case IDC_MAKETRANSPBKG:
- {
- BOOL enable = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_SPIN), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_L), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), enable);
-
- SendMessage(hwndDlg, DM_REALODAVATAR, 0, 0);
- }
- break;
+ {
+ BOOL enable = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_SPIN), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_L), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), enable);
+
+ SendMessage(hwndDlg, DM_REALODAVATAR, 0, 0);
+ }
+ break;
case IDC_RESET:
ProtectAvatar(hContact, 0);
@@ -627,69 +627,69 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case WM_DRAWITEM:
- {
- LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
- if (dis->CtlType == ODT_BUTTON && dis->CtlID == IDC_PROTOPIC) {
- AVATARDRAWREQUEST avdrq = { 0 };
- GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), &avdrq.rcDraw);
-
- FillRect(dis->hDC, &avdrq.rcDraw, GetSysColorBrush(COLOR_BTNFACE));
-
- avdrq.hContact = hContact;
- avdrq.cbSize = sizeof(avdrq);
- avdrq.hTargetDC = dis->hDC;
- avdrq.dwFlags |= AVDRQ_DRAWBORDER;
- avdrq.clrBorder = GetSysColor(COLOR_BTNTEXT);
- avdrq.radius = 6;
- if (!CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&avdrq)) {
- // Get text rectangle
- RECT rc = avdrq.rcDraw;
- rc.top += 10;
- rc.bottom -= 10;
- rc.left += 10;
- rc.right -= 10;
-
- // Calc text size
- RECT rc_ret = rc;
- DrawText(dis->hDC, TranslateT("Contact has no avatar"), -1, &rc_ret,
- DT_WORDBREAK | DT_NOPREFIX | DT_CENTER | DT_CALCRECT);
-
- // Calc needed size
- rc.top += ((rc.bottom - rc.top) - (rc_ret.bottom - rc_ret.top)) / 2;
- rc.bottom = rc.top + (rc_ret.bottom - rc_ret.top);
- DrawText(dis->hDC, TranslateT("Contact has no avatar"), -1, &rc,
- DT_WORDBREAK | DT_NOPREFIX | DT_CENTER);
- }
-
- FrameRect(dis->hDC, &avdrq.rcDraw, GetSysColorBrush(COLOR_BTNSHADOW));
+ {
+ LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
+ if (dis->CtlType == ODT_BUTTON && dis->CtlID == IDC_PROTOPIC) {
+ AVATARDRAWREQUEST avdrq = { 0 };
+ GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), &avdrq.rcDraw);
+
+ FillRect(dis->hDC, &avdrq.rcDraw, GetSysColorBrush(COLOR_BTNFACE));
+
+ avdrq.hContact = hContact;
+ avdrq.cbSize = sizeof(avdrq);
+ avdrq.hTargetDC = dis->hDC;
+ avdrq.dwFlags |= AVDRQ_DRAWBORDER;
+ avdrq.clrBorder = GetSysColor(COLOR_BTNTEXT);
+ avdrq.radius = 6;
+ if (!CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&avdrq)) {
+ // Get text rectangle
+ RECT rc = avdrq.rcDraw;
+ rc.top += 10;
+ rc.bottom -= 10;
+ rc.left += 10;
+ rc.right -= 10;
+
+ // Calc text size
+ RECT rc_ret = rc;
+ DrawText(dis->hDC, TranslateT("Contact has no avatar"), -1, &rc_ret,
+ DT_WORDBREAK | DT_NOPREFIX | DT_CENTER | DT_CALCRECT);
+
+ // Calc needed size
+ rc.top += ((rc.bottom - rc.top) - (rc_ret.bottom - rc_ret.top)) / 2;
+ rc.bottom = rc.top + (rc_ret.bottom - rc_ret.top);
+ DrawText(dis->hDC, TranslateT("Contact has no avatar"), -1, &rc,
+ DT_WORDBREAK | DT_NOPREFIX | DT_CENTER);
}
+
+ FrameRect(dis->hDC, &avdrq.rcDraw, GetSysColorBrush(COLOR_BTNSHADOW));
}
- return TRUE;
+ }
+ return TRUE;
case DM_SETAVATARNAME:
- {
- TCHAR szFinalName[MAX_PATH];
- DBVARIANT dbv = { 0 };
- BYTE is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0);
+ {
+ TCHAR szFinalName[MAX_PATH];
+ DBVARIANT dbv = { 0 };
+ BYTE is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0);
- szFinalName[0] = 0;
+ szFinalName[0] = 0;
- if (is_locked && !db_get_ts(hContact, "ContactPhoto", "Backup", &dbv)) {
- MyPathToAbsolute(dbv.ptszVal, szFinalName);
- db_free(&dbv);
- }
- else if (!db_get_ts(hContact, "ContactPhoto", "RFile", &dbv)) {
- MyPathToAbsolute(dbv.ptszVal, szFinalName);
- db_free(&dbv);
- }
- else if (!db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
- MyPathToAbsolute(dbv.ptszVal, szFinalName);
- db_free(&dbv);
- }
- szFinalName[MAX_PATH - 1] = 0;
- SetDlgItemText(hwndDlg, IDC_AVATARNAME, szFinalName);
+ if (is_locked && !db_get_ts(hContact, "ContactPhoto", "Backup", &dbv)) {
+ MyPathToAbsolute(dbv.ptszVal, szFinalName);
+ db_free(&dbv);
}
- break;
+ else if (!db_get_ts(hContact, "ContactPhoto", "RFile", &dbv)) {
+ MyPathToAbsolute(dbv.ptszVal, szFinalName);
+ db_free(&dbv);
+ }
+ else if (!db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
+ MyPathToAbsolute(dbv.ptszVal, szFinalName);
+ db_free(&dbv);
+ }
+ szFinalName[MAX_PATH - 1] = 0;
+ SetDlgItemText(hwndDlg, IDC_AVATARNAME, szFinalName);
+ }
+ break;
case DM_REALODAVATAR:
SaveTransparentData(hwndDlg, hContact, IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR));
@@ -712,7 +712,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
return FALSE;
}
-int OptInit(WPARAM wParam, LPARAM lParam)
+int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = g_hInst;
@@ -749,7 +749,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa
switch (msg) {
case WM_INITDIALOG:
- dat = (WindowData*) malloc(sizeof(WindowData));
+ dat = (WindowData*)malloc(sizeof(WindowData));
if (dat == NULL)
return FALSE;
dat->hContact = lParam;
@@ -799,21 +799,21 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa
break;
case IDC_HIDEAVATAR:
- {
- int hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) ? 1 : 0;
- SetAvatarAttribute(hContact, AVS_HIDEONCLIST, hidden);
- if (hidden != db_get_b(hContact, "ContactPhoto", "Hidden", 0))
- db_set_b(hContact, "ContactPhoto", "Hidden", hidden);
- }
- break;
+ {
+ int hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) ? 1 : 0;
+ SetAvatarAttribute(hContact, AVS_HIDEONCLIST, hidden);
+ if (hidden != db_get_b(hContact, "ContactPhoto", "Hidden", 0))
+ db_set_b(hContact, "ContactPhoto", "Hidden", hidden);
+ }
+ break;
case IDC_PROTECTAVATAR:
- {
- BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR);
- SaveTransparentData(hwndDlg, hContact, locked);
- ProtectAvatar(hContact, locked ? 1 : 0);
- }
- break;
+ {
+ BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR);
+ SaveTransparentData(hwndDlg, hContact, locked);
+ ProtectAvatar(hContact, locked ? 1 : 0);
+ }
+ break;
case IDC_BKG_NUM_POINTS:
case IDC_BKG_COLOR_DIFFERENCE:
@@ -821,17 +821,17 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa
break;
case IDC_MAKETRANSPBKG:
- {
- BOOL enable = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_SPIN), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_L), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN), enable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), enable);
- }
- SendMessage(hwndDlg, DM_REALODAVATAR, 0, 0);
- break;
+ {
+ BOOL enable = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_SPIN), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_L), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), enable);
+ }
+ SendMessage(hwndDlg, DM_REALODAVATAR, 0, 0);
+ break;
case IDC_RESET:
ProtectAvatar(hContact, 0);
if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
@@ -1049,28 +1049,28 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP
break;
case WM_NOTIFY:
- {
- LPNMHDR nm = (LPNMHDR)lParam;
- switch (nm->idFrom) {
- case IDC_PROTOCOLS:
- switch (nm->code) {
- case LVN_ITEMCHANGED:
- LPNMLISTVIEW li = (LPNMLISTVIEW)nm;
- if (li->uNewState & LVIS_SELECTED) {
- SendDlgItemMessage(hwndDlg, IDC_PROTOPIC, AVATAR_SETPROTOCOL, 0, li->lParam);
- EnableDisableControls(hwndDlg, (char*)li->lParam);
- }
+ {
+ LPNMHDR nm = (LPNMHDR)lParam;
+ switch (nm->idFrom) {
+ case IDC_PROTOCOLS:
+ switch (nm->code) {
+ case LVN_ITEMCHANGED:
+ LPNMLISTVIEW li = (LPNMLISTVIEW)nm;
+ if (li->uNewState & LVIS_SELECTED) {
+ SendDlgItemMessage(hwndDlg, IDC_PROTOPIC, AVATAR_SETPROTOCOL, 0, li->lParam);
+ EnableDisableControls(hwndDlg, (char*)li->lParam);
}
- break;
+ }
+ break;
- case IDC_PROTOPIC:
- if (nm->code == NM_AVATAR_CHANGED) {
- EnableDisableControls(hwndDlg, GetSelectedProtocol(hwndDlg));
- break;
- }
+ case IDC_PROTOPIC:
+ if (nm->code == NM_AVATAR_CHANGED) {
+ EnableDisableControls(hwndDlg, GetSelectedProtocol(hwndDlg));
+ break;
}
}
- break;
+ }
+ break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp
index 159aef797d..f9c284eb95 100644
--- a/plugins/AVS/src/poll.cpp
+++ b/plugins/AVS/src/poll.cpp
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 2006 Ricardo Pescuma Domenecci, Nightwish
This is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "commonheaders.h"
@@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA.
/*
It has 1 queue:
A queue to request items. One request is done at a time, REQUEST_WAIT_TIME miliseconts after it has beeing fired
- ACKRESULT_STATUS. This thread only requests the avatar (and maybe add it to the cache queue)
+ACKRESULT_STATUS. This thread only requests the avatar (and maybe add it to the cache queue)
*/
#define REQUEST_WAIT_TIME 3000
@@ -100,7 +100,7 @@ static BOOL PollContactCanHaveAvatar(MCONTACT hContact, const char *szProto)
}
// Return true if this contact has to be checked
-static BOOL PollCheckContact(MCONTACT hContact, const char *szProto)
+static BOOL PollCheckContact(MCONTACT hContact)
{
return !db_get_b(hContact, "ContactPhoto", "Locked", 0) && FindAvatarInCache(hContact, FALSE, TRUE) != NULL;
}
@@ -157,8 +157,8 @@ void ProcessAvatarInfo(MCONTACT hContact, int type, PROTO_AVATAR_INFORMATIONT *p
db_set_w(hContact, "ContactPhoto", "Format", pai->format);
if (pai->format == PA_FORMAT_PNG || pai->format == PA_FORMAT_JPEG
- || pai->format == PA_FORMAT_ICON || pai->format == PA_FORMAT_BMP
- || pai->format == PA_FORMAT_GIF) {
+ || pai->format == PA_FORMAT_ICON || pai->format == PA_FORMAT_BMP
+ || pai->format == PA_FORMAT_GIF) {
// We can load it!
MakePathRelative(hContact, pai->filename);
ChangeAvatar(hContact, true, true, pai->format);
@@ -202,7 +202,7 @@ int FetchAvatarFor(MCONTACT hContact, char *szProto)
if (szProto != NULL && PollProtocolCanHaveAvatar(szProto) && PollContactCanHaveAvatar(hContact, szProto)) {
// Can have avatar, but must request it?
if ((g_AvatarHistoryAvail && CallService(MS_AVATARHISTORY_ENABLED, hContact, 0)) ||
- (PollCheckProtocol(szProto) && PollCheckContact(hContact, szProto)))
+ (PollCheckProtocol(szProto) && PollCheckContact(hContact)))
{
// Request it
PROTO_AVATAR_INFORMATIONT pai_s = { 0 };
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp
index fe15a2b332..46034bd2b6 100644
--- a/plugins/AVS/src/services.cpp
+++ b/plugins/AVS/src/services.cpp
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
-INT_PTR GetAvatarBitmap(WPARAM hContact, LPARAM lParam)
+INT_PTR GetAvatarBitmap(WPARAM hContact, LPARAM)
{
if (hContact == 0 || g_shutDown || fei == NULL)
return 0;
@@ -150,7 +150,7 @@ static INT_PTR avSetAvatar(MCONTACT hContact, TCHAR *tszPath)
ofn.lCustData = (LPARAM)&locking_request;
if (!GetOpenFileName(&ofn))
return 0;
-
+
szFinalName = FileName;
is_locked = locking_request ? 1 : is_locked;
}
@@ -186,8 +186,8 @@ INT_PTR SetAvatarW(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// see if is possible to set the avatar for the expecified protocol
-
-static INT_PTR CanSetMyAvatar(WPARAM wParam, LPARAM lParam)
+
+static INT_PTR CanSetMyAvatar(WPARAM wParam, LPARAM)
{
char *protocol = (char *)wParam;
if (protocol == NULL || fei == NULL)
@@ -260,7 +260,7 @@ static void FilterGetStrings(CMString &filter, BOOL xml, BOOL swf)
filter.AppendFormat(_T("%s (*.bmp;*.jpg;*.gif;*.png"), TranslateT("All Files"));
if (swf) filter.Append(_T(";*.swf"));
if (xml) filter.Append(_T(";*.xml"));
-
+
filter.AppendFormat(_T(")%c*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), 0);
if (swf) filter.Append(_T(";*.SWF"));
if (xml) filter.Append(_T(";*.XML"));
@@ -276,14 +276,14 @@ static void FilterGetStrings(CMString &filter, BOOL xml, BOOL swf)
if (xml)
filter.AppendFormat(_T("%s (*.xml)%c*.XML%c"), TranslateT("XML Files"), 0, 0);
-
+
filter.AppendChar(0);
}
/////////////////////////////////////////////////////////////////////////////////////////
// Callback to set thumbnaill view to open dialog
-static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
{
OPENFILENAME *ofn = (OPENFILENAME *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
SetMyAvatarHookData *data;
@@ -426,8 +426,8 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, TCHAR *originalFilenam
// Check if can use original image
if (d.hBmpProto == hBmp
- && Proto_IsAvatarFormatSupported(protocol, originalFormat)
- && (d.max_size == 0 || GetFileSize(originalFilename) < d.max_size)) {
+ && Proto_IsAvatarFormatSupported(protocol, originalFormat)
+ && (d.max_size == 0 || GetFileSize(originalFilename) < d.max_size)) {
if (d.temp_file[0] != '\0')
DeleteFile(d.temp_file);
@@ -439,7 +439,7 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, TCHAR *originalFilenam
if (d.temp_file[0] == '\0') {
d.temp_file[0] = '\0';
if (GetTempPath(MAX_PATH, d.temp_file) == 0
- || GetTempFileName(d.temp_file, _T("mir_av_"), 0, d.temp_file) == 0) {
+ || GetTempFileName(d.temp_file, _T("mir_av_"), 0, d.temp_file) == 0) {
DeleteObject(d.hBmpProto);
return -1;
}
@@ -473,8 +473,7 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, TCHAR *originalFilenam
d.width = orig_width * (4 - num_tries) / 4;
d.height = orig_height * (4 - num_tries) / 4;
}
- }
- while (!d.saved && d.need_smaller_size && num_tries < 4);
+ } while (!d.saved && d.need_smaller_size && num_tries < 4);
int ret;
@@ -724,7 +723,7 @@ static INT_PTR SetMyAvatarW(WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR ContactOptions(WPARAM wParam, LPARAM lParam)
+static INT_PTR ContactOptions(WPARAM wParam, LPARAM)
{
if (wParam)
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AVATAROPTIONS), 0, DlgProcAvatarOptions, (LPARAM)wParam);
@@ -733,7 +732,7 @@ static INT_PTR ContactOptions(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-INT_PTR DrawAvatarPicture(WPARAM wParam, LPARAM lParam)
+INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam)
{
AVATARCACHEENTRY *ace = NULL;
@@ -833,7 +832,7 @@ static void ReloadMyAvatar(LPVOID lpParam)
free(lpParam);
}
-INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM lParam)
+INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM)
{
const char *proto = (const char*)wParam;
if (proto == NULL)
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp
index bceae41a3e..5466b167ae 100644
--- a/plugins/AVS/src/utils.cpp
+++ b/plugins/AVS/src/utils.cpp
@@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA.
#include "commonheaders.h"
-void mir_sleep(int time)
+void mir_sleep(int time)
{
if (!g_shutDown)
WaitForSingleObject(hShutdownEvent, time);
@@ -67,10 +67,6 @@ void MakePathRelative(MCONTACT hContact)
int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto)
{
- char *szExt = NULL;
- HANDLE hFile = INVALID_HANDLE_VALUE;
- DWORD dwFileSizeHigh = 0, dwFileSize = 0, sizeLimit = 0;
-
ptrT tszValue;
TCHAR tszFilename[MAX_PATH]; tszFilename[0] = 0;
@@ -203,7 +199,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto)
}
if (db_get_b(0, AVS_MODULE, "MakeGrayscale", 0))
- ace->hbmPic = MakeGrayscale(hContact, ace->hbmPic);
+ ace->hbmPic = MakeGrayscale(ace->hbmPic);
if (noTransparency) {
fei->FI_CorrectBitmap32Alpha(ace->hbmPic, TRUE);
@@ -261,8 +257,7 @@ int GetFileHash(TCHAR* filename)
remainder = (remainder << 1);
}
}
- }
- while (dwRead == 1024);
+ } while (dwRead == 1024);
CloseHandle(hFile);