diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/TipperYM/src/bitmap_func.cpp | 134 | ||||
-rw-r--r-- | plugins/TipperYM/src/bitmap_func.h | 6 | ||||
-rw-r--r-- | plugins/TipperYM/src/message_pump.cpp | 51 | ||||
-rw-r--r-- | plugins/TipperYM/src/message_pump.h | 3 | ||||
-rw-r--r-- | plugins/TipperYM/src/options.cpp | 47 | ||||
-rw-r--r-- | plugins/TipperYM/src/options.h | 89 | ||||
-rw-r--r-- | plugins/TipperYM/src/popwin.cpp | 12 | ||||
-rw-r--r-- | plugins/TipperYM/src/popwin.h | 87 | ||||
-rw-r--r-- | plugins/TipperYM/src/preset_items.cpp | 21 | ||||
-rw-r--r-- | plugins/TipperYM/src/preset_items.h | 15 | ||||
-rw-r--r-- | plugins/TipperYM/src/skin_parser.cpp | 187 | ||||
-rw-r--r-- | plugins/TipperYM/src/skin_parser.h | 5 | ||||
-rw-r--r-- | plugins/TipperYM/src/str_utils.cpp | 43 | ||||
-rw-r--r-- | plugins/TipperYM/src/subst.cpp | 29 | ||||
-rw-r--r-- | plugins/TipperYM/src/tipper.cpp | 7 | ||||
-rw-r--r-- | plugins/TipperYM/src/translations.cpp | 88 | ||||
-rw-r--r-- | plugins/TipperYM/src/translations.h | 93 |
17 files changed, 437 insertions, 480 deletions
diff --git a/plugins/TipperYM/src/bitmap_func.cpp b/plugins/TipperYM/src/bitmap_func.cpp index 1bc5552107..974f90e81c 100644 --- a/plugins/TipperYM/src/bitmap_func.cpp +++ b/plugins/TipperYM/src/bitmap_func.cpp @@ -22,14 +22,14 @@ Boston, MA 02111-1307, USA. TOOLTIPSKIN skin = {};
-HBITMAP CreateBitmapPart(FIBITMAP *fibSrc, int iSrcWidth, int iSrcHeight, int iDesWidth, int iDesHeight, TransformationMode transfMode)
+HBITMAP CreateBitmapPart(FIBITMAP *fibSrc, int iSrcWidth, int iSrcHeight, int iDesWidth, int iDesHeight, TransformationMode transfMode)
{
FIBITMAP *fibMem = nullptr;
HBITMAP hbmpDes = nullptr;
- if (!fibSrc)
+ if (!fibSrc)
return nullptr;
-
+
switch (transfMode) {
case TM_NONE:
case TM_CENTRE:
@@ -59,11 +59,11 @@ HBITMAP CreateBitmapPart(FIBITMAP *fibSrc, int iSrcWidth, int iSrcHeight, int iD return hbmpDes;
}
-void DrawBitmapPart(HDC hdcMem, HBITMAP hbmpPart, RECT *rcDes, TransformationMode transfMode)
+void DrawBitmapPart(HDC hdcMem, HBITMAP hbmpPart, RECT *rcDes, TransformationMode transfMode)
{
- if (!hbmpPart)
+ if (!hbmpPart)
return;
-
+
BLENDFUNCTION blend;
blend.BlendOp = AC_SRC_OVER;
blend.BlendFlags = 0;
@@ -105,7 +105,7 @@ void DrawBitmapPart(HDC hdcMem, HBITMAP hbmpPart, RECT *rcDes, TransformationMod AlphaBlend(skin.hdc, rcDes->left + (x * iBmpWidth), rcDes->top + (y * iBmpHeight), iEndX, iBmpHeight, hdcMem, 0, 0, iEndX, iBmpHeight, blend);
}
- for (x = 0; x < iRepX; x++)
+ for (x = 0; x < iRepX; x++)
AlphaBlend(skin.hdc, rcDes->left + (x * iBmpWidth), rcDes->top + (y * iBmpHeight), iBmpWidth, iEndY, hdcMem, 0, 0, iBmpWidth, iEndY, blend);
AlphaBlend(skin.hdc, rcDes->left + (x * iBmpWidth), rcDes->top + (y * iBmpHeight), iEndX, iEndY, hdcMem, 0, 0, iEndX, iEndY, blend);
@@ -125,7 +125,7 @@ void DrawBitmapPart(HDC hdcMem, HBITMAP hbmpPart, RECT *rcDes, TransformationMod iRepY = iDesHeight / iBmpHeight;
iEndY = iDesHeight % iBmpHeight;
- for(y = 0; y < iRepY; y++)
+ for (y = 0; y < iRepY; y++)
AlphaBlend(skin.hdc, rcDes->left, rcDes->top + (y * iBmpHeight), iDesWidth, iBmpHeight, hdcMem, 0, 0, iDesWidth, iBmpHeight, blend);
AlphaBlend(skin.hdc, rcDes->left, rcDes->top + (y * iBmpHeight), iDesWidth, iEndY, hdcMem, 0, 0, iDesWidth, iEndY, blend);
@@ -136,8 +136,8 @@ void DrawBitmapPart(HDC hdcMem, HBITMAP hbmpPart, RECT *rcDes, TransformationMod void CreateFromBitmaps(bool bServiceTip)
{
int rcWidth, rcHeight;
- int iCentWidth, iCentHeight;
- int iBmpWidth, iBmpHeight;
+ int iCentWidth, iCentHeight;
+ int iBmpWidth, iBmpHeight;
int top, right, bottom, left;
BLENDFUNCTION blend;
@@ -146,7 +146,7 @@ void CreateFromBitmaps(bool bServiceTip) blend.SourceConstantAlpha = 255;
blend.AlphaFormat = AC_SRC_ALPHA;
- for (int i = 0; i < SKIN_ITEMS_COUNT; i++) {
+ for (int i = 0; i < SKIN_ITEMS_COUNT; i++) {
if (i == SKIN_ITEM_SIDEBAR && (!opt.iSidebarWidth || bServiceTip))
continue;
@@ -158,23 +158,23 @@ void CreateFromBitmaps(bool bServiceTip) if (!fibLoad)
continue;
- if (FreeImage_GetBPP(fibLoad) != 32)
+ if (FreeImage_GetBPP(fibLoad) != 32)
fib = FreeImage_ConvertTo32Bits(fibLoad);
else
fib = fibLoad;
- if (fib != fibLoad)
+ if (fib != fibLoad)
FreeImage_Unload(fibLoad);
- skin.fib[i] = fib;
- }
+ skin.fib[i] = fib;
+ }
else fib = skin.fib[i];
// destination rectangle size
if (i == SKIN_ITEM_BG) {
rcWidth = skin.iWidth;
rcHeight = skin.iHeight;
- }
+ }
else if (i == SKIN_ITEM_SIDEBAR) {
rcWidth = opt.iSidebarWidth;
rcHeight = skin.iHeight;
@@ -183,7 +183,7 @@ void CreateFromBitmaps(bool bServiceTip) // bitmap size
iBmpWidth = FreeImage_GetWidth(fib);
- iBmpHeight = FreeImage_GetHeight(fib);
+ iBmpHeight = FreeImage_GetHeight(fib);
// margins
top = opt.margins[i].top < iBmpHeight ? opt.margins[i].top : 0;
@@ -249,8 +249,8 @@ void CreateFromBitmaps(bool bServiceTip) skin.hbmpSkinParts[i][SP_EDGE_LEFT] = CreateBitmapPart(fibMem, left, iBmpHeight - top - bottom, left, iCentHeight, opt.transfMode[i]);
if (fibMem)
FreeImage_Unload(fibMem);
- }
-
+ }
+
fibCentre = FreeImage_Copy(fib, left, top, iBmpWidth - right, iBmpHeight - bottom);
if (fibCentre) {
fib = fibCentre;
@@ -260,20 +260,20 @@ void CreateFromBitmaps(bool bServiceTip) }
// create centre area bitmap
- skin.hbmpSkinParts[i][SP_CENTRE_AREA] = CreateBitmapPart(fib, iBmpWidth, iBmpHeight, iCentWidth, iCentHeight, opt.transfMode[i]);
- if (fibCentre)
+ skin.hbmpSkinParts[i][SP_CENTRE_AREA] = CreateBitmapPart(fib, iBmpWidth, iBmpHeight, iCentWidth, iCentHeight, opt.transfMode[i]);
+ if (fibCentre)
FreeImage_Unload(fibCentre);
if (i == SKIN_ITEM_SIDEBAR) {
int limit = skin.bCached ? SP_CORNER_TL : SKIN_PARTS_COUNT; // don't premultiply corner bitmaps multiple times
for (int j = 0; j < limit; j++) {
- if (skin.hbmpSkinParts[i][j])
+ if (skin.hbmpSkinParts[i][j])
FreeImage_Premultiply(skin.hbmpSkinParts[i][j]);
}
}
- HDC hdcMem = CreateCompatibleDC(nullptr);
- RECT rc = {0};
+ HDC hdcMem = CreateCompatibleDC(nullptr);
+ RECT rc = { 0 };
if (skin.hbmpSkinParts[i][SP_CENTRE_AREA]) {
SetRect(&rc, left, top, rcWidth - right, rcHeight - bottom);
@@ -318,7 +318,7 @@ void CreateFromBitmaps(bool bServiceTip) }
}
- for (int j = 0; j < SP_CORNER_TL; j++)
+ for (int j = 0; j < SP_CORNER_TL; j++)
if (skin.hbmpSkinParts[i][j]) {
DeleteObject(skin.hbmpSkinParts[i][j]);
skin.hbmpSkinParts[i][j] = nullptr;
@@ -336,7 +336,7 @@ void CreateFromBitmaps(bool bServiceTip) void SolidColorFill(bool bServiceTip)
{
- RECT rc = {0};
+ RECT rc = { 0 };
rc.right = skin.iWidth;
rc.bottom = skin.iHeight;
HBRUSH hBrush = CreateSolidBrush(opt.colBg);
@@ -347,7 +347,7 @@ void SolidColorFill(bool bServiceTip) rc.right = opt.iSidebarWidth;
hBrush = CreateSolidBrush(opt.colSidebar);
FillRect(skin.hdc, &rc, hBrush);
- DeleteObject(hBrush);
+ DeleteObject(hBrush);
}
}
@@ -375,7 +375,7 @@ void CreateSkinBitmap(int iWidth, int iHeight, bool bServiceTip) bi.bmiHeader.biBitCount = 32;
bi.bmiHeader.biCompression = BI_RGB;
skin.hBitmap = (HBITMAP)CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, (void **)&skin.colBits, nullptr, 0);
- if (!skin.hBitmap)
+ if (!skin.hBitmap)
return;
skin.hdc = CreateCompatibleDC(nullptr);
@@ -383,7 +383,7 @@ void CreateSkinBitmap(int iWidth, int iHeight, bool bServiceTip) if (opt.skinMode == SM_COLORFILL)
SolidColorFill(bServiceTip);
- else {
+ else {
CreateFromBitmaps(bServiceTip);
if (opt.iEnableColoring == 1)
ColorizeBitmap();
@@ -392,7 +392,7 @@ void CreateSkinBitmap(int iWidth, int iHeight, bool bServiceTip) void DestroySkinBitmap()
{
- for (int i = 0; i < SKIN_ITEMS_COUNT; i++) {
+ for (int i = 0; i < SKIN_ITEMS_COUNT; i++) {
if (skin.fib[i]) {
FreeImage_Unload(skin.fib[i]);
skin.fib[i] = nullptr;
@@ -413,7 +413,7 @@ COLOR32* SaveAlpha(LPRECT lpRect) {
GdiFlush();
- if (lpRect->left < 0) lpRect->left = 0;
+ if (lpRect->left < 0) lpRect->left = 0;
if (lpRect->top < 0) lpRect->top = 0;
if (lpRect->right - lpRect->left > skin.iWidth) lpRect->right = lpRect->left + skin.iWidth;
if (lpRect->bottom - lpRect->top > skin.iHeight) lpRect->bottom = lpRect->top + skin.iHeight;
@@ -427,12 +427,12 @@ COLOR32* SaveAlpha(LPRECT lpRect) COLOR32 *p1 = res;
for (int i = 0; i < h; i++) {
- if (i+y < 0) continue;
- if (i+y >= skin.iHeight) break;
- COLOR32 *p2 = skin.colBits + (y+i)*skin.iWidth + x;
+ if (i + y < 0) continue;
+ if (i + y >= skin.iHeight) break;
+ COLOR32 *p2 = skin.colBits + (y + i)*skin.iWidth + x;
for (int j = 0; j < w; j++) {
- if (j+x < 0) continue;
- if (j+x >= skin.iWidth) break;
+ if (j + x < 0) continue;
+ if (j + x >= skin.iWidth) break;
*p1++ = *p2++;
}
}
@@ -443,7 +443,7 @@ void RestoreAlpha(LPRECT lpRect, COLOR32 *pBits, BYTE alpha) {
GdiFlush();
- if (lpRect->left < 0) lpRect->left = 0;
+ if (lpRect->left < 0) lpRect->left = 0;
if (lpRect->top < 0) lpRect->top = 0;
if (lpRect->right > skin.iWidth) lpRect->right = skin.iWidth;
if (lpRect->bottom > skin.iHeight) lpRect->bottom = skin.iHeight;
@@ -456,17 +456,17 @@ void RestoreAlpha(LPRECT lpRect, COLOR32 *pBits, BYTE alpha) COLOR32 *p1 = pBits;
for (int i = 0; i < h; i++) {
- if (i+y < 0) continue;
- if (i+y >= skin.iHeight) break;
- COLOR32 *p2 = skin.colBits + (y+i)*skin.iWidth + x;
+ if (i + y < 0) continue;
+ if (i + y >= skin.iHeight) break;
+ COLOR32 *p2 = skin.colBits + (y + i)*skin.iWidth + x;
for (int j = 0; j < w; j++) {
- if (j+x < 0) continue;
- if (j+x >= skin.iWidth) break;
+ if (j + x < 0) continue;
+ if (j + x >= skin.iWidth) break;
- if ((*p1&0x00ffffff) != (*p2&0x00ffffff))
+ if ((*p1 & 0x00ffffff) != (*p2 & 0x00ffffff))
*p2 |= (alpha << 24);
else
- *p2 = (*p2&0x00ffffff) | (*p1&0xff000000);
+ *p2 = (*p2 & 0x00ffffff) | (*p1 & 0xff000000);
++p1; ++p2;
}
@@ -509,8 +509,8 @@ void DrawIconExAlpha(HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int if (skin.bNeedLayerUpdate && !bIsSmiley) {
ICONINFO icon;
- if ( GetIconInfo(hIcon, &icon)) {
- if ( !IsAlphaTransparent(icon.hbmColor)) {
+ if (GetIconInfo(hIcon, &icon)) {
+ if (!IsAlphaTransparent(icon.hbmColor)) {
RECT rc;
SetRect(&rc, xLeft, yTop, xLeft + cxWidth, yTop + cyWidth);
pBits = SaveAlpha(&rc);
@@ -521,7 +521,7 @@ void DrawIconExAlpha(HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int }
}
- DrawIconEx(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth, istepIfAniCur, hbrFlickerFreeDraw, diFlags);
+ DrawIconEx(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth, istepIfAniCur, hbrFlickerFreeDraw, diFlags);
if (skin.bNeedLayerUpdate && pBits != NULL) {
RECT rc;
@@ -548,17 +548,17 @@ static __forceinline COLOR32 rgba(COLOR32 r, COLOR32 g, COLOR32 b, COLOR32 a) return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);
}
-static __forceinline COLOR32 getr(COLOR32 c)
+static __forceinline COLOR32 getr(COLOR32 c)
{
return (c >> 16) & 0xff;
}
-static __forceinline COLOR32 getg(COLOR32 c)
+static __forceinline COLOR32 getg(COLOR32 c)
{
return (c >> 8) & 0xff;
}
-static __forceinline COLOR32 getb(COLOR32 c)
+static __forceinline COLOR32 getb(COLOR32 c)
{
return c & 0xff;
}
@@ -571,17 +571,17 @@ static __forceinline COLOR32 geta(COLOR32 c) void PremultipleChannels()
{
for (int i = 0; i < skin.iWidth * skin.iHeight; i++)
- skin.colBits[i] = rgba( getr(skin.colBits[i])*geta(skin.colBits[i])/255,
- getg(skin.colBits[i])*geta(skin.colBits[i])/255,
- getb(skin.colBits[i])*geta(skin.colBits[i])/255,
- geta(skin.colBits[i]));
+ skin.colBits[i] = rgba(getr(skin.colBits[i])*geta(skin.colBits[i]) / 255,
+ getg(skin.colBits[i])*geta(skin.colBits[i]) / 255,
+ getb(skin.colBits[i])*geta(skin.colBits[i]) / 255,
+ geta(skin.colBits[i]));
}
#define PU_DIV255(x) ((x)/255)
void ColorizeBitmap()
{
- if (!skin.colBits)
+ if (!skin.colBits)
return;
GdiFlush();
@@ -594,9 +594,9 @@ void ColorizeBitmap() float koef1g = (255 - getg(opt.colBg)) / 128.0;
float koef1b = (255 - getr(opt.colBg)) / 128.0;
- int br = - 255 + 2 * getb(opt.colBg);
- int bg = - 255 + 2 * getg(opt.colBg);
- int bb = - 255 + 2 * getr(opt.colBg);
+ int br = -255 + 2 * getb(opt.colBg);
+ int bg = -255 + 2 * getg(opt.colBg);
+ int bb = -255 + 2 * getr(opt.colBg);
float koef2r = (getb(opt.colBg)) / 128.0;
float koef2g = (getg(opt.colBg)) / 128.0;
@@ -604,14 +604,14 @@ void ColorizeBitmap() for (int i = 0; i < w * h; i++) {
long alpha = geta(skin.colBits[i]);
- COLOR32 cl = alpha ? getr(skin.colBits[i])*255/alpha : 0;
+ COLOR32 cl = alpha ? getr(skin.colBits[i]) * 255 / alpha : 0;
skin.colBits[i] = (cl > 128) ?
rgba(
PU_DIV255((koef1r * cl + br)*alpha),
PU_DIV255((koef1g * cl + bg)*alpha),
PU_DIV255((koef1b * cl + bb)*alpha),
- alpha):
+ alpha) :
rgba(
PU_DIV255(koef2r * cl * alpha),
PU_DIV255(koef2g * cl * alpha),
@@ -630,18 +630,18 @@ HRGN CreateOpaqueRgn(BYTE level, bool bOpaque) RGBQUAD *buff = (RGBQUAD *)skin.colBits;
- int x,y;
unsigned int cRect = 64;
- PRGNDATA pRgnData = (PRGNDATA)malloc(sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
+ PRGNDATA pRgnData = (PRGNDATA)malloc(sizeof(RGNDATAHEADER) + (cRect) * sizeof(RECT));
memset(pRgnData, 0, sizeof(RGNDATAHEADER));
pRgnData->rdh.dwSize = sizeof(RGNDATAHEADER);
pRgnData->rdh.iType = RDH_RECTANGLES;
- for (y = 0; y < skin.iHeight; ++y) {
+ for (int y = 0; y < skin.iHeight; ++y) {
bool inside = false;
bool lastin = false;
unsigned int entry = 0;
+ int x;
for (x = 0; x < skin.iWidth; ++x) {
inside = bOpaque ? (buff->rgbReserved > level) : (buff->rgbReserved < level);
++buff;
@@ -650,11 +650,11 @@ HRGN CreateOpaqueRgn(BYTE level, bool bOpaque) if (inside) {
lastin = true;
entry = x;
- }
+ }
else {
if (pRgnData->rdh.nCount == cRect) {
cRect = cRect + 64;
- pRgnData = (PRGNDATA)realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
+ pRgnData = (PRGNDATA)realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect) * sizeof(RECT));
}
SetRect(((LPRECT)pRgnData->Buffer) + pRgnData->rdh.nCount, entry, skin.iHeight - y, x, skin.iHeight - y + 1);
@@ -667,7 +667,7 @@ HRGN CreateOpaqueRgn(BYTE level, bool bOpaque) if (lastin) {
if (pRgnData->rdh.nCount == cRect) {
cRect = cRect + 64;
- pRgnData = (PRGNDATA)realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
+ pRgnData = (PRGNDATA)realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect) * sizeof(RECT));
}
SetRect(((LPRECT)pRgnData->Buffer) + pRgnData->rdh.nCount, entry, skin.iHeight - y, x, skin.iHeight - y + 1);
@@ -675,7 +675,7 @@ HRGN CreateOpaqueRgn(BYTE level, bool bOpaque) }
}
- HRGN hRgn = ExtCreateRegion(nullptr, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
+ HRGN hRgn = ExtCreateRegion(nullptr, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount * sizeof(RECT), (LPRGNDATA)pRgnData);
free(pRgnData);
return hRgn;
}
diff --git a/plugins/TipperYM/src/bitmap_func.h b/plugins/TipperYM/src/bitmap_func.h index ec79f1d8fe..96d5c7a29f 100644 --- a/plugins/TipperYM/src/bitmap_func.h +++ b/plugins/TipperYM/src/bitmap_func.h @@ -39,13 +39,15 @@ Boston, MA 02111-1307, USA. #define SP_CORNER_BL 8
// image paint options
-typedef enum {
+typedef enum
+{
TM_NONE = 0, TM_CENTRE = 1, TM_STRECH_ALL = 2, TM_STRECH_HORIZONTAL = 3, TM_STRECH_VERTICAL = 4,
TM_TILE_ALL = 5, TM_TILE_HORIZONTAL = 6, TM_TILE_VERTICAL = 7
} TransformationMode;
typedef unsigned long COLOR32;
-typedef struct {
+typedef struct
+{
HDC hdc;
HBITMAP hBitmap, hOldBitmap;
HBITMAP hbmpSkinParts[SKIN_ITEMS_COUNT][SKIN_PARTS_COUNT];
diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index 9aaa791482..dab7a37265 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -23,10 +23,10 @@ Boston, MA 02111-1307, USA. #include <tchar.h>
HMODULE hDwmapiDll = nullptr;
-HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind) = nullptr;
+HRESULT(WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind) = nullptr;
unsigned int uintMessagePumpThreadId = 0;
-POINT pt = {-1};
+POINT pt = { -1 };
UINT WaitForContentTimerID = 0;
bool bAvatarReady = false;
bool bStatusMsgReady = false;
@@ -48,17 +48,14 @@ void CALLBACK TimerProcWaitForContent(HWND, UINT, UINT_PTR, DWORD) bool NeedWaitForContent(CLCINFOTIPEX *clcitex)
{
bool bNeedWait = false;
- if (opt.bWaitForContent && IsContactTooltip(clcitex))
- {
+ if (opt.bWaitForContent && IsContactTooltip(clcitex)) {
MCONTACT hContact = (DWORD_PTR)clcitex->hItem;
char *szProto = GetContactProto(hContact);
if (!szProto) return false;
- if (opt.bWaitForStatusMsg && !bStatusMsgReady)
- {
- db_unset(hContact, MODULENAME, "TempStatusMsg");
- if (CanRetrieveStatusMsg(hContact, szProto) && ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0))
- {
+ if (opt.bWaitForStatusMsg && !bStatusMsgReady) {
+ g_plugin.delSetting(hContact, "TempStatusMsg");
+ if (CanRetrieveStatusMsg(hContact, szProto) && ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0)) {
if (WaitForContentTimerID)
KillTimer(nullptr, WaitForContentTimerID);
@@ -68,16 +65,12 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) }
if (opt.bWaitForAvatar && !bAvatarReady &&
- CallProtoService(szProto, PS_GETAVATARCAPS, AF_ENABLED, 0))
- {
+ CallProtoService(szProto, PS_GETAVATARCAPS, AF_ENABLED, 0)) {
DBVARIANT dbv;
- if (!db_get_s(hContact, "ContactPhoto", "File", &dbv))
- {
- if (!strstr(dbv.pszVal, ".xml"))
- {
+ if (!db_get_s(hContact, "ContactPhoto", "File", &dbv)) {
+ if (!strstr(dbv.pszVal, ".xml")) {
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
- if (!ace)
- {
+ if (!ace) {
if (WaitForContentTimerID)
KillTimer(nullptr, WaitForContentTimerID);
@@ -161,7 +154,7 @@ unsigned int CALLBACK MessagePumpThread(void*) }
if (swzMsg) {
- db_set_ws((DWORD_PTR)clcitex->hItem, MODULENAME, "TempStatusMsg", swzMsg);
+ g_plugin.setWString((DWORD_PTR)clcitex->hItem, "TempStatusMsg", swzMsg);
mir_free(swzMsg);
}
@@ -211,7 +204,7 @@ void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam) void InitMessagePump()
{
- WNDCLASSEX wcl = {0};
+ WNDCLASSEX wcl = { 0 };
wcl.cbSize = sizeof(wcl);
wcl.lpfnWndProc = PopupWindowProc;
wcl.hInstance = g_plugin.getInst();
@@ -222,7 +215,7 @@ void InitMessagePump() hDwmapiDll = LoadLibrary(L"dwmapi.dll");
if (hDwmapiDll)
- MyDwmEnableBlurBehindWindow = (HRESULT (WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(hDwmapiDll, "DwmEnableBlurBehindWindow");
+ MyDwmEnableBlurBehindWindow = (HRESULT(WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(hDwmapiDll, "DwmEnableBlurBehindWindow");
CloseHandle(mir_forkthreadex(MessagePumpThread, nullptr, &uintMessagePumpThreadId));
}
@@ -238,7 +231,7 @@ INT_PTR ShowTip(WPARAM wParam, LPARAM lParam) {
CLCINFOTIP *clcit = (CLCINFOTIP *)lParam;
HWND clist = g_clistApi.hwndContactTree;
-
+
if (clcit->isGroup) return 0; // no group tips (since they're pretty useless)
if (clcit->isTreeFocused == 0 && !opt.bShowNoFocus && clist == WindowFromPoint(clcit->ptCursor)) return 0;
if (clcit->ptCursor.x == pt.x && clcit->ptCursor.y == pt.y) return 0;
@@ -262,8 +255,8 @@ INT_PTR ShowTip(WPARAM wParam, LPARAM lParam) int ShowTipHook(WPARAM wParam, LPARAM lParam)
{
- ShowTip(wParam, lParam);
- return 0;
+ ShowTip(wParam, lParam);
+ return 0;
}
INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam)
@@ -311,7 +304,7 @@ int HideTipHook(WPARAM wParam, LPARAM lParam) int ProtoAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
- if ((ack==nullptr) || (ack->result != ACKRESULT_SUCCESS))
+ if ((ack == nullptr) || (ack->result != ACKRESULT_SUCCESS))
return 0;
if (ack->type == ACKTYPE_AWAYMSG) {
@@ -333,14 +326,13 @@ int AvatarChanged(WPARAM hContact, LPARAM) int FramesShowSBTip(WPARAM wParam, LPARAM)
{
- if (opt.bStatusBarTips)
- {
+ if (opt.bStatusBarTips) {
char *szProto = (char *)wParam;
CLCINFOTIPEX *clcit2 = (CLCINFOTIPEX *)mir_alloc(sizeof(CLCINFOTIPEX));
memset(clcit2, 0, sizeof(CLCINFOTIPEX));
clcit2->cbSize = sizeof(CLCINFOTIPEX);
- clcit2->szProto= szProto; // assume static string
+ clcit2->szProto = szProto; // assume static string
GetCursorPos(&clcit2->ptCursor);
PostMPMessage(MUM_CREATEPOPUP, 0, (LPARAM)clcit2);
@@ -351,8 +343,7 @@ int FramesShowSBTip(WPARAM wParam, LPARAM) int FramesHideSBTip(WPARAM, LPARAM)
{
- if (opt.bStatusBarTips)
- {
+ if (opt.bStatusBarTips) {
PostMPMessage(MUM_DELETEPOPUP, 0, 0);
return 1;
}
@@ -363,4 +354,4 @@ BOOL MyDestroyWindow(HWND hwnd) {
SendMessage(hwnd, PUM_FADEOUTWINDOW, 0, 0);
return DestroyWindow(hwnd);
-}
\ No newline at end of file +}
diff --git a/plugins/TipperYM/src/message_pump.h b/plugins/TipperYM/src/message_pump.h index e155373e84..9bb7d755b2 100644 --- a/plugins/TipperYM/src/message_pump.h +++ b/plugins/TipperYM/src/message_pump.h @@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. #define DWM_BB_ENABLE 0x00000001
#define DWM_BB_BLURREGION 0x00000002
#define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004
+
struct DWM_BLURBEHIND
{
DWORD dwFlags;
@@ -40,7 +41,7 @@ struct DWM_BLURBEHIND BOOL fTransitionOnMaximized;
};
-extern HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind);
+extern HRESULT(WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind);
void InitMessagePump();
void DeinitMessagePump();
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 6f5bde404b..214e408c78 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -23,6 +23,45 @@ Boston, MA 02111-1307, USA. OPTIONS opt;
ICONSTATE exIcons[EXICONS_COUNT];
+// display item types
+static struct
+{
+ DisplayItemType type;
+ wchar_t *title;
+}
+displayItemTypes[] = {
+ { DIT_ALL, LPGENW("Show for all contact types") },
+ { DIT_CONTACTS, LPGENW("Show only for contacts") },
+ { DIT_CHATS, LPGENW("Show only for chatrooms") }
+};
+
+// tray tooltip items
+static wchar_t *trayTipItems[] =
+{
+ LPGENW("Number of contacts"),
+ LPGENW("Protocol lock status"),
+ LPGENW("Logon time"),
+ LPGENW("Unread emails"),
+ LPGENW("Status"),
+ LPGENW("Status message"),
+ LPGENW("Extra status"),
+ LPGENW("Listening to"),
+ LPGENW("Favorite contacts"),
+ LPGENW("Miranda uptime"),
+ LPGENW("Contact list event")
+};
+
+// extra icons
+static wchar_t *extraIconName[] =
+{
+ LPGENW("Status"),
+ LPGENW("Extra status"),
+ LPGENW("Jabber activity"),
+ LPGENW("Gender"),
+ LPGENW("Country flag"),
+ LPGENW("Client")
+};
+
extern int IsTrayProto(const wchar_t *swzProto, BOOL bExtendedTip)
{
if (swzProto == nullptr)
@@ -1191,7 +1230,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvi.mask = TVIF_PARAM;
for (HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS)); hItem != nullptr;
- hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem)) {
+ hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem)) {
tvi.hItem = hItem;
if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi)) {
DIListNode *di_value = (DIListNode *)tvi.lParam;
@@ -1844,7 +1883,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, for (auto &hContact : Contacts()) {
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
- if (hItem && db_get_b(hContact, MODULENAME, "FavouriteContact", 0))
+ if (hItem && g_plugin.getByte(hContact, "FavouriteContact"))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
}
@@ -1863,7 +1902,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
if (hItem) {
isChecked = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0);
- db_set_b(hContact, MODULENAME, "FavouriteContact", isChecked);
+ g_plugin.setByte(hContact, "FavouriteContact", isChecked);
if (isChecked)
count++;
}
@@ -1939,7 +1978,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND:
switch (LOWORD(wParam)) {
- UINT state;
+ UINT state;
case IDC_CHK_ENABLETRAYTIP:
state = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLETRAYTIP);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_HANDLEBYTIPPER), state);
diff --git a/plugins/TipperYM/src/options.h b/plugins/TipperYM/src/options.h index da77526992..b95cf7c533 100644 --- a/plugins/TipperYM/src/options.h +++ b/plugins/TipperYM/src/options.h @@ -33,98 +33,74 @@ Boston, MA 02111-1307, USA. #define MS_TOOLTIP_SHOWTIP "mToolTip/ShowTip"
-typedef struct {
+struct OPTBUTTON
+{
UINT id, uintCoreIconId, uintResIconId;
wchar_t *swzTooltip;
-} OPTBUTTON;
+};
+
+enum DisplayItemType { DIT_ALL = 0, DIT_CONTACTS = 1, DIT_CHATS = 2 };
-typedef enum { DIT_ALL = 0, DIT_CONTACTS = 1, DIT_CHATS = 2 } DisplayItemType;
-typedef struct {
+struct DISPLAYITEM
+{
wchar_t swzLabel[LABEL_LEN];
wchar_t swzValue[VALUE_LEN];
DisplayItemType type;
bool bLineAbove, bValueNewline;
bool bIsVisible;
bool bParseTipperVarsFirst;
-} DISPLAYITEM;
-
-// display item types
-static struct {
- DisplayItemType type;
- wchar_t *title;
-} displayItemTypes[] = {
- { DIT_ALL, LPGENW("Show for all contact types") },
- { DIT_CONTACTS, LPGENW("Show only for contacts") },
- { DIT_CHATS, LPGENW("Show only for chatrooms") }
};
-typedef enum { DVT_DB = 0, DVT_PROTODB = 1 } DisplaySubstType;
-typedef struct {
+enum DisplaySubstType { DVT_DB = 0, DVT_PROTODB = 1 };
+
+struct DISPLAYSUBST
+{
wchar_t swzName[LABEL_LEN];
DisplaySubstType type;
char szModuleName[MODULE_NAME_LEN];
char szSettingName[SETTING_NAME_LEN];
int iTranslateFuncId;
-} DISPLAYSUBST;
+};
-struct DSListNode {
+struct DSListNode
+{
DISPLAYSUBST ds;
DSListNode *next;
};
-struct DIListNode {
+struct DIListNode
+{
DISPLAYITEM di;
DIListNode *next;
};
-typedef struct {
+struct MARGINS
+{
BYTE top;
BYTE right;
BYTE bottom;
BYTE left;
-} MARGINS;
-
-// tray tooltip items
-static wchar_t *trayTipItems[TRAYTIP_ITEMS_COUNT] = {
- LPGENW("Number of contacts"),
- LPGENW("Protocol lock status"),
- LPGENW("Logon time"),
- LPGENW("Unread emails"),
- LPGENW("Status"),
- LPGENW("Status message"),
- LPGENW("Extra status"),
- LPGENW("Listening to"),
- LPGENW("Favorite contacts"),
- LPGENW("Miranda uptime"),
- LPGENW("Contact list event")
};
-// extra icons
-static wchar_t *extraIconName[6] = {
- LPGENW("Status"),
- LPGENW("Extra status"),
- LPGENW("Jabber activity"),
- LPGENW("Gender"),
- LPGENW("Country flag"),
- LPGENW("Client")
-};
-
-typedef struct {
+struct EXTRAICONDATA
+{
bool bDragging;
HTREEITEM hDragItem;
-} EXTRAICONDATA;
+};
-typedef struct {
+struct ICONSTATE
+{
BYTE order;
BYTE vis;
-} ICONSTATE;
+};
-typedef enum { PAV_NONE = 0, PAV_LEFT = 1, PAV_RIGHT = 2 } PopupAvLayout;
-typedef enum { PTL_NOICON = 0, PTL_LEFTICON = 1, PTL_RIGHTICON = 2 } PopupIconTitleLayout;
-typedef enum { PP_BOTTOMRIGHT = 0, PP_BOTTOMLEFT = 1, PP_TOPRIGHT = 2, PP_TOPLEFT = 3 } PopupPosition;
-typedef enum { PSE_NONE = 0, PSE_ANIMATE = 1, PSE_FADE = 2 } PopupShowEffect;
+enum PopupAvLayout { PAV_NONE = 0, PAV_LEFT = 1, PAV_RIGHT = 2 };
+enum PopupIconTitleLayout { PTL_NOICON = 0, PTL_LEFTICON = 1, PTL_RIGHTICON = 2 };
+enum PopupPosition { PP_BOTTOMRIGHT = 0, PP_BOTTOMLEFT = 1, PP_TOPRIGHT = 2, PP_TOPLEFT = 3 };
+enum PopupShowEffect { PSE_NONE = 0, PSE_ANIMATE = 1, PSE_FADE = 2 };
-typedef struct {
+struct OPTIONS
+{
int iWinWidth, iWinMaxHeight, iAvatarSize; //tweety
PopupIconTitleLayout titleIconLayout;
bool bShowTitle;
@@ -145,7 +121,7 @@ typedef struct { COLORREF colBg, colBorder, colAvatarBorder, colDivider, colBar, colTitle, colLabel, colValue, colTrayTitle, colSidebar;
int iLabelValign, iLabelHalign, iValueValign, iValueHalign;
bool bWaitForStatusMsg, bWaitForAvatar;
-
+
// tooltip skin
SkinMode skinMode;
wchar_t szSkinName[256];
@@ -186,8 +162,7 @@ typedef struct { int iSmileyAddFlags;
BYTE exIconsOrder[EXICONS_COUNT];
BYTE exIconsVis[EXICONS_COUNT];
-} OPTIONS;
-
+};
extern OPTIONS opt;
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 7624cdcd55..db2e28460c 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -20,12 +20,12 @@ Boston, MA 02111-1307, USA. #include "stdafx.h" -__inline void AddRow(PopupWindowData *pwd, wchar_t *swzLabel, wchar_t *swzValue, char *szProto, bool bParseSmileys, bool bNewline, bool bLineAbove, bool bIsTitle = false, HICON hIcon = nullptr) +__inline void AddRow(PopupWindowData *pwd, wchar_t *swzLabel, wchar_t *swzValue, char *szProto, bool bParseSmileys, bool bNewline, bool bLineAbove, bool bIsTitle = false, HICON hIcon = nullptr) { RowData *pRows = (RowData *)mir_realloc(pwd->rows, sizeof(RowData) * (pwd->iRowCount + 1)); if (pRows == nullptr) return; - pwd->rows = pRows; + pwd->rows = pRows; pwd->rows[pwd->iRowCount].swzLabel = swzLabel ? mir_wstrdup(swzLabel) : nullptr; pwd->rows[pwd->iRowCount].swzValue = swzValue ? mir_wstrdup(swzValue) : nullptr; pwd->rows[pwd->iRowCount].spi = bParseSmileys ? Smileys_PreParse(swzValue, (int)mir_wstrlen(swzValue), szProto) : nullptr; @@ -35,7 +35,7 @@ __inline void AddRow(PopupWindowData *pwd, wchar_t *swzLabel, wchar_t *swzValue, pwd->rows[pwd->iRowCount++].hIcon = hIcon; } -LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { POINT pt; RECT rc; @@ -302,7 +302,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // don't use stored status message if (!opt.bWaitForContent) - db_unset(pwd->hContact, MODULENAME, "TempStatusMsg"); + g_plugin.delSetting(pwd->hContact, "TempStatusMsg"); wcsncpy_s(pwd->swzTitle, Clist_GetContactDisplayName(pwd->hContact), _TRUNCATE); @@ -954,7 +954,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa case PUM_SETSTATUSTEXT: if (pwd && wParam == pwd->hContact) { - db_set_ws(pwd->hContact, MODULENAME, "TempStatusMsg", (wchar_t *)lParam); + g_plugin.setWString(pwd->hContact, "TempStatusMsg", (wchar_t *)lParam); pwd->bIsPainted = false; pwd->bNeedRefresh = true; SendMessage(hwnd, PUM_REFRESH_VALUES, TRUE, 0); @@ -1586,7 +1586,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa int iCount = 0, iCountOnline = 0; for (auto &hContact : Contacts()) { - if (db_get_b(hContact, MODULENAME, "FavouriteContact", 0)) { + if (g_plugin.getByte(hContact, "FavouriteContact")) { char *proto = GetContactProto(hContact); if (proto == nullptr) continue; diff --git a/plugins/TipperYM/src/popwin.h b/plugins/TipperYM/src/popwin.h index 1721111b16..252a1c85f5 100644 --- a/plugins/TipperYM/src/popwin.h +++ b/plugins/TipperYM/src/popwin.h @@ -35,54 +35,53 @@ Boston, MA 02111-1307, USA. #define PUM_FADEOUTWINDOW (WM_USER + 0x029)
// extra icons
-#define EXICONS_COUNT 6
-#define CTRY_ERROR 42 //Flags - some strange value ???
-#define GEN_FEMALE 70
-#define GEN_MALE 77
+#define EXICONS_COUNT 6
+#define CTRY_ERROR 42 // Flags - some strange value ???
+#define GEN_FEMALE 70
+#define GEN_MALE 77
// copy menu
-#define COPYMENU_ALLITEMS_LABELS 1000
-#define COPYMENU_ALLITEMS 1001
-#define COPYMENU_AVATAR 1002
+#define COPYMENU_ALLITEMS_LABELS 1000
+#define COPYMENU_ALLITEMS 1001
+#define COPYMENU_AVATAR 1002
// tray tooltip items
-#define TRAYTIP_ITEMS_COUNT 11
-
-#define TRAYTIP_NUMCONTACTS 1
-#define TRAYTIP_LOCKSTATUS 2
-#define TRAYTIP_LOGON 4
-#define TRAYTIP_UNREAD_EMAILS 8
-#define TRAYTIP_STATUS 16
-#define TRAYTIP_STATUS_MSG 32
-#define TRAYTIP_EXTRA_STATUS 64
-#define TRAYTIP_LISTENINGTO 128
-#define TRAYTIP_FAVCONTACTS 256
-#define TRAYTIP_MIRANDA_UPTIME 512
-#define TRAYTIP_CLIST_EVENT 1024
+#define TRAYTIP_NUMCONTACTS 1
+#define TRAYTIP_LOCKSTATUS 2
+#define TRAYTIP_LOGON 4
+#define TRAYTIP_UNREAD_EMAILS 8
+#define TRAYTIP_STATUS 16
+#define TRAYTIP_STATUS_MSG 32
+#define TRAYTIP_EXTRA_STATUS 64
+#define TRAYTIP_LISTENINGTO 128
+#define TRAYTIP_FAVCONTACTS 256
+#define TRAYTIP_MIRANDA_UPTIME 512
+#define TRAYTIP_CLIST_EVENT 1024
// favorite contacts options
-#define FAVCONT_HIDE_OFFLINE 1
-#define FAVCONT_APPEND_PROTO 2
+#define FAVCONT_HIDE_OFFLINE 1
+#define FAVCONT_APPEND_PROTO 2
// other
-#define TITLE_TEXT_LEN 512
-#define MAX_VALUE_LEN 64
+#define TITLE_TEXT_LEN 512
+#define MAX_VALUE_LEN 64
-#define ANIM_ELAPSE 10
-#define ANIM_STEPS 255
-#define CHECKMOUSE_ELAPSE 250
+#define ANIM_ELAPSE 10
+#define ANIM_STEPS 255
+#define CHECKMOUSE_ELAPSE 250
-#define ID_TIMER_ANIMATE 0x0100
-#define ID_TIMER_CHECKMOUSE 0x0101
-#define ID_TIMER_TRAYTIP 0x0102
+#define ID_TIMER_ANIMATE 0x0100
+#define ID_TIMER_CHECKMOUSE 0x0101
+#define ID_TIMER_TRAYTIP 0x0102
-
-typedef struct {
+struct ExtraIcons
+{
HICON hIcon;
bool bDestroy;
-} ExtraIcons;
+};
-typedef struct {
+struct CLCINFOTIPEX
+{
int cbSize;
int isTreeFocused; //so the plugin can provide an option
int isGroup; //0 if it's a contact, 1 if it's a group
@@ -91,9 +90,10 @@ typedef struct { RECT rcItem;
wchar_t *swzText; // for tips with specific text
char *szProto; // for proto tips
-} CLCINFOTIPEX;
+};
-typedef struct {
+struct RowData
+{
wchar_t *swzLabel, *swzValue;
HICON hIcon;
bool bValueNewline;
@@ -101,9 +101,10 @@ typedef struct { bool bIsTitle;
int iLabelHeight, iValueHeight, iTotalHeight;
SMILEYPARSEINFO spi;
-} RowData;
+};
-typedef struct {
+struct PopupWindowData
+{
HPEN hpenBorder, hpenDivider;
int iTitleHeight, iAvatarHeight, iIconsHeight, iTextHeight, iLabelWidth;
int iRealAvatarWidth, iRealAvatarHeight;
@@ -119,20 +120,18 @@ typedef struct { bool bIsTextTip, bIsTrayTip;
int iIndent, iSidebarWidth;
POINT ptCursorStartPos; // work around bugs with hiding tips (timer check mouse position)
- ExtraIcons extraIcons[EXICONS_COUNT];
+ ExtraIcons extraIcons[EXICONS_COUNT];
bool bIsIconVisible[EXICONS_COUNT];
int iTrans;
int iHotkeyId;
bool bIsPainted;
bool bNeedRefresh;
bool bAllowReposition;
- RECT rcWindow;
- HRGN hrgnAeroGlass;
-} PopupWindowData;
-
+ RECT rcWindow;
+ HRGN hrgnAeroGlass;
+};
LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern int IsTrayProto(const wchar_t *swzProto, BOOL bExtendedTip);
-
#endif
diff --git a/plugins/TipperYM/src/preset_items.cpp b/plugins/TipperYM/src/preset_items.cpp index 459d5d8465..f06322276a 100644 --- a/plugins/TipperYM/src/preset_items.cpp +++ b/plugins/TipperYM/src/preset_items.cpp @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-PRESETITEM presetItems[] =
+PRESETITEM presetItems[] =
{
"account", LPGENW("Account"), LPGENW("Account:"), L"%sys:account%", nullptr, nullptr, nullptr,
"birth", LPGENW("Birthday"), LPGENW("Birthday:"), L"%birthday_date% (%birthday_age%) @ Next: %birthday_next%", "birthdate", "birthage", "birthnext",
@@ -58,10 +58,10 @@ PRESETITEM presetItems[] = "uvindex", LPGENW("[weather.dll] UV Index"), LPGENW("UV Index:"), L"%raw:Current/UV% - %raw:Current/UVI%", nullptr, nullptr, nullptr,
"vis", LPGENW("[weather.dll] Visibility"), LPGENW("Visibility:"), L"%raw:Current/Visibility%", nullptr, nullptr, nullptr,
"wind", LPGENW("[weather.dll] Wind"), LPGENW("Wind:"), L"%raw:Current/Wind Direction% (%raw:Current/Wind Direction DEG%)/%raw:Current/Wind Speed%", nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
};
-PRESETSUBST presetSubsts[] =
+PRESETSUBST presetSubsts[] =
{
"gender", L"gender", DVT_PROTODB, nullptr, "Gender", 5,
"status", L"Status", DVT_PROTODB, nullptr, "Status", 1,
@@ -77,13 +77,13 @@ PRESETSUBST presetSubsts[] = "birthdate", L"birthday_date", DVT_PROTODB, nullptr, "Birth", 8,
"birthage", L"birthday_age", DVT_PROTODB, nullptr, "Birth", 9,
"birthnext", L"birthday_next", DVT_PROTODB, nullptr, "Birth", 12,
- "logondate", L"logon_date", DVT_PROTODB, nullptr, "LogonTS", 15,
+ "logondate", L"logon_date", DVT_PROTODB, nullptr, "LogonTS", 15,
"logontime", L"logon_time", DVT_PROTODB, nullptr, "LogonTS", 13,
"logonago", L"logon_ago", DVT_PROTODB, nullptr, "LogonTS", 3,
nullptr, nullptr, DVT_DB, nullptr, nullptr, 0
};
-DEFAULTITEM defaultItemList[] =
+DEFAULTITEM defaultItemList[] =
{
"statusmsg", true,
"-", false,
@@ -101,10 +101,9 @@ DEFAULTITEM defaultItemList[] = nullptr,0
};
-PRESETITEM *GetPresetItemByName(char *szName)
+PRESETITEM* GetPresetItemByName(char *szName)
{
- for (int i = 0; presetItems[i].szID; i++)
- {
+ for (int i = 0; presetItems[i].szID; i++) {
if (mir_strcmp(presetItems[i].szID, szName) == 0)
return &presetItems[i];
}
@@ -112,15 +111,13 @@ PRESETITEM *GetPresetItemByName(char *szName) return nullptr;
}
-PRESETSUBST *GetPresetSubstByName(char *szName)
+PRESETSUBST* GetPresetSubstByName(char *szName)
{
if (!szName) return nullptr;
- for (int i = 0; presetSubsts[i].szID; i++)
- {
+ for (int i = 0; presetSubsts[i].szID; i++) {
if (mir_strcmp(presetSubsts[i].szID, szName) == 0)
return &presetSubsts[i];
}
return nullptr;
}
-
diff --git a/plugins/TipperYM/src/preset_items.h b/plugins/TipperYM/src/preset_items.h index a402cca5d6..83e73283fc 100644 --- a/plugins/TipperYM/src/preset_items.h +++ b/plugins/TipperYM/src/preset_items.h @@ -23,27 +23,30 @@ Boston, MA 02111-1307, USA. #define MAX_PRESET_SUBST_COUNT 3
-typedef struct {
+struct PRESETITEM
+{
char *szID;
wchar_t *swzName;
wchar_t *swzLabel;
wchar_t *swzValue;
char *szNeededSubst[MAX_PRESET_SUBST_COUNT];
-} PRESETITEM;
+};
-typedef struct {
+struct PRESETSUBST
+{
char *szID;
wchar_t *swzName;
DisplaySubstType type;
char *szModuleName;
char *szSettingName;
int iTranslateFuncId;
-} PRESETSUBST;
+};
-typedef struct {
+struct DEFAULTITEM
+{
char *szName;
bool bValueNewline;
-} DEFAULTITEM;
+};
extern PRESETITEM presetItems[];
extern PRESETSUBST presetSubsts[];
diff --git a/plugins/TipperYM/src/skin_parser.cpp b/plugins/TipperYM/src/skin_parser.cpp index cb57ceacc5..971dce8e12 100644 --- a/plugins/TipperYM/src/skin_parser.cpp +++ b/plugins/TipperYM/src/skin_parser.cpp @@ -32,10 +32,8 @@ int RefreshSkinList(HWND hwndDlg) WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(L"*.*", &ffd);
- while (hFind != INVALID_HANDLE_VALUE)
- {
- if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_wstrcmp(L".", ffd.cFileName) && mir_wstrcmp(L"..", ffd.cFileName))
- {
+ while (hFind != INVALID_HANDLE_VALUE) {
+ if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_wstrcmp(L".", ffd.cFileName) && mir_wstrcmp(L"..", ffd.cFileName)) {
SetCurrentDirectory(ffd.cFileName);
WIN32_FIND_DATA ffd2;
HANDLE hFindFile = FindFirstFile(L"*.tsf", &ffd2);
@@ -59,8 +57,7 @@ int RefreshSkinList(HWND hwndDlg) bool FileExists(wchar_t *filename)
{
HANDLE hFile = CreateFile(filename, 0, 0, nullptr, OPEN_EXISTING, 0, nullptr);
- if (hFile != INVALID_HANDLE_VALUE)
- {
+ if (hFile != INVALID_HANDLE_VALUE) {
CloseHandle(hFile);
return true;
}
@@ -71,22 +68,17 @@ bool FileExists(wchar_t *filename) void ParseAboutPart(FILE *fp, wchar_t *buff, wchar_t *szSkinName)
{
myfgets(buff, 1024, fp);
- while (buff[0] != '[')
- {
- if (buff[0] != ';')
- {
+ while (buff[0] != '[') {
+ if (buff[0] != ';') {
wchar_t *pch = wcschr(buff, '=');
- if (pch++)
- {
- while (pch && (*pch == ' ' || *pch == '\t'))
+ if (pch++) {
+ while (pch && (*pch == ' ' || *pch == '\t'))
pch++;
- if (pch)
- {
- if (wcsstr(buff, L"author"))
- {}
- else if (wcsstr(buff, L"preview"))
- {
+ if (pch) {
+ if (wcsstr(buff, L"author")) {
+ }
+ else if (wcsstr(buff, L"preview")) {
wchar_t szImgPath[1024];
mir_snwprintf(szImgPath, L"%s\\%s\\%s", SKIN_FOLDER, szSkinName, pch);
if (FileExists(szImgPath))
@@ -111,26 +103,20 @@ void ParseImagePart(FILE *fp, wchar_t *buff, int iPart) opt.margins[iPart].bottom = 0;
myfgets(buff, 1024, fp);
- while (buff[0] != '[')
- {
- if (buff[0] != ';')
- {
+ while (buff[0] != '[') {
+ if (buff[0] != ';') {
wchar_t *pch = wcschr(buff, '=');
- if (pch++)
- {
+ if (pch++) {
while (pch && (*pch == ' ' || *pch == '\t'))
pch++;
- if (pch)
- {
- if (wcsstr(buff, L"image"))
- {
+ if (pch) {
+ if (wcsstr(buff, L"image")) {
wchar_t szImgPath[1024];
mir_snwprintf(szImgPath, L"%s\\%s\\%s", SKIN_FOLDER, opt.szSkinName, pch);
opt.szImgFile[iPart] = mir_wstrdup(szImgPath);
}
- else if (wcsstr(buff, L"tm"))
- {
+ else if (wcsstr(buff, L"tm")) {
if (!mir_wstrcmpi(pch, L"TM_NONE"))
opt.transfMode[iPart] = TM_NONE;
else if (!mir_wstrcmpi(pch, L"TM_CENTRE"))
@@ -147,7 +133,7 @@ void ParseImagePart(FILE *fp, wchar_t *buff, int iPart) opt.transfMode[iPart] = TM_TILE_HORIZONTAL;
else if (!mir_wstrcmpi(pch, L"TM_TILE_VERTICAL"))
opt.transfMode[iPart] = TM_TILE_VERTICAL;
- else
+ else
opt.transfMode[iPart] = TM_NONE;
}
else if (wcsstr(buff, L"left"))
@@ -190,61 +176,47 @@ void ParseFontPart(FILE *fp, wchar_t *buff) char szSetting[64];
myfgets(buff, 1024, fp);
- while (buff[0] != '[')
- {
- if (buff[0] != ';')
- {
+ while (buff[0] != '[') {
+ if (buff[0] != ';') {
wchar_t *pch = wcschr(buff, '=');
- if (pch++)
- {
- while (pch && (*pch == ' ' || *pch == '\t'))
+ if (pch++) {
+ while (pch && (*pch == ' ' || *pch == '\t'))
pch++;
- if (pch)
- {
- if (wcsstr(buff, L"face"))
- {
- if (GetSettingName(buff, "", szSetting, sizeof(szSetting) - 1))
- {
+ if (pch) {
+ if (wcsstr(buff, L"face")) {
+ if (GetSettingName(buff, "", szSetting, sizeof(szSetting) - 1)) {
if (mir_wstrlen(pch) > 32)
pch[32] = 0;
g_plugin.setWString(szSetting, pch);
}
- }
- else if (wcsstr(buff, L"color"))
- {
- if (GetSettingName(buff, "Col", szSetting, sizeof(szSetting) - 1))
- {
+ }
+ else if (wcsstr(buff, L"color")) {
+ if (GetSettingName(buff, "Col", szSetting, sizeof(szSetting) - 1)) {
BYTE r = _wtoi(pch);
pch = wcschr(pch, ' ');
- if (++pch)
- {
- BYTE g = _wtoi(pch);
+ if (++pch) {
+ BYTE g = _wtoi(pch);
pch = wcschr(pch, ' ');
- if (++pch)
- {
+ if (++pch) {
BYTE b = _wtoi(pch);
- COLORREF color = RGB(r, g ,b);
+ COLORREF color = RGB(r, g, b);
g_plugin.setDword(szSetting, color);
}
}
}
- }
- else if (wcsstr(buff, L"size"))
- {
- if (GetSettingName(buff, "Size", szSetting, sizeof(szSetting) - 1))
- {
+ }
+ else if (wcsstr(buff, L"size")) {
+ if (GetSettingName(buff, "Size", szSetting, sizeof(szSetting) - 1)) {
HDC hdc = GetDC(nullptr);
int size = -MulDiv(_wtoi(pch), GetDeviceCaps(hdc, LOGPIXELSY), 72);
g_plugin.setByte(szSetting, (BYTE)size);
ReleaseDC(nullptr, hdc);
}
- }
- else if (wcsstr(buff, L"effect"))
- {
- if (GetSettingName(buff, "Sty", szSetting, sizeof(szSetting) - 1))
- {
+ }
+ else if (wcsstr(buff, L"effect")) {
+ if (GetSettingName(buff, "Sty", szSetting, sizeof(szSetting) - 1)) {
BYTE effect = 0;
if (wcsstr(pch, L"font_bold"))
effect |= DBFONTF_BOLD;
@@ -268,18 +240,14 @@ void ParseFontPart(FILE *fp, wchar_t *buff) void ParseAppearancePart(FILE *fp, wchar_t *buff)
{
myfgets(buff, 1024, fp);
- while (buff[0] != '[')
- {
- if (buff[0] != ';')
- {
+ while (buff[0] != '[') {
+ if (buff[0] != ';') {
wchar_t *pch = wcschr(buff, '=');
- if (pch++)
- {
- while (pch && (*pch == ' ' || *pch == '\t'))
+ if (pch++) {
+ while (pch && (*pch == ' ' || *pch == '\t'))
pch++;
- if (pch)
- {
+ if (pch) {
if (wcsstr(buff, L"general-padding"))
opt.iPadding = _wtoi(pch);
else if (wcsstr(buff, L"title-indent"))
@@ -310,20 +278,15 @@ void ParseAppearancePart(FILE *fp, wchar_t *buff) void ParseOtherPart(FILE *fp, wchar_t *buff)
{
myfgets(buff, 1024, fp);
- while (buff[0] != '[')
- {
- if (buff[0] != ';')
- {
+ while (buff[0] != '[') {
+ if (buff[0] != ';') {
wchar_t *pch = wcschr(buff, '=');
- if (pch++)
- {
- while (pch && (*pch == ' ' || *pch == '\t'))
+ if (pch++) {
+ while (pch && (*pch == ' ' || *pch == '\t'))
pch++;
- if (pch)
- {
- if (wcsstr(buff, L"enable-coloring"))
- {
+ if (pch) {
+ if (wcsstr(buff, L"enable-coloring")) {
if (wcsstr(pch, L"false"))
opt.iEnableColoring = -1;
}
@@ -342,7 +305,7 @@ void ParseSkinFile(wchar_t *szSkinName, bool bStartup, bool bOnlyPreview) if (opt.skinMode == SM_OBSOLOTE && bStartup)
return;
-
+
if (!bStartup) opt.iEnableColoring = 0;
opt.szPreviewFile[0] = 0;
@@ -352,48 +315,37 @@ void ParseSkinFile(wchar_t *szSkinName, bool bStartup, bool bOnlyPreview) WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(L"*.tsf", &ffd);
- if (hFind != INVALID_HANDLE_VALUE)
- {
+ if (hFind != INVALID_HANDLE_VALUE) {
FILE *fp = _wfopen(ffd.cFileName, L"r");
- if (fp)
- {
+ if (fp) {
myfgets(buff, 1024, fp);
- while (!feof(fp))
- {
- if (buff[0] == '[')
- {
- if (!mir_wstrcmp(L"[about]", buff))
- {
+ while (!feof(fp)) {
+ if (buff[0] == '[') {
+ if (!mir_wstrcmp(L"[about]", buff)) {
ParseAboutPart(fp, buff, szSkinName);
continue;
- }
- else if (!mir_wstrcmp(L"[other]", buff))
- {
+ }
+ else if (!mir_wstrcmp(L"[other]", buff)) {
ParseOtherPart(fp, buff);
continue;
- }
- else if (!bOnlyPreview)
- {
- if (!mir_wstrcmp(L"[background]", buff))
- {
+ }
+ else if (!bOnlyPreview) {
+ if (!mir_wstrcmp(L"[background]", buff)) {
ParseImagePart(fp, buff, SKIN_ITEM_BG);
continue;
- }
- else if (!mir_wstrcmp(L"[sidebar]", buff))
- {
+ }
+ else if (!mir_wstrcmp(L"[sidebar]", buff)) {
ParseImagePart(fp, buff, SKIN_ITEM_SIDEBAR);
continue;
}
- else if (!bStartup && opt.bLoadFonts && !mir_wstrcmp(L"[fonts]", buff))
- {
+ else if (!bStartup && opt.bLoadFonts && !mir_wstrcmp(L"[fonts]", buff)) {
ParseFontPart(fp, buff);
continue;
- }
- else if (!bStartup && opt.bLoadProportions && !mir_wstrcmp(L"[appearance]", buff))
- {
+ }
+ else if (!bStartup && opt.bLoadProportions && !mir_wstrcmp(L"[appearance]", buff)) {
ParseAppearancePart(fp, buff);
continue;
- }
+ }
}
}
@@ -401,12 +353,11 @@ void ParseSkinFile(wchar_t *szSkinName, bool bStartup, bool bOnlyPreview) }
fclose(fp);
}
- }
- else
- {
+ }
+ else {
opt.skinMode = SM_COLORFILL;
}
FindClose(hFind);
SetCurrentDirectory(szDirSave);
-}
\ No newline at end of file +}
diff --git a/plugins/TipperYM/src/skin_parser.h b/plugins/TipperYM/src/skin_parser.h index c7981709b2..d69ec212f1 100644 --- a/plugins/TipperYM/src/skin_parser.h +++ b/plugins/TipperYM/src/skin_parser.h @@ -21,9 +21,10 @@ Boston, MA 02111-1307, USA. #ifndef _SKIN_INC
#define _SKIN_INC
-typedef enum {
+enum SkinMode
+{
SM_COLORFILL = 0, SM_IMAGE = 1, SM_OBSOLOTE = 2
-} SkinMode;
+};
int RefreshSkinList(HWND hwndDlg);
void ParseSkinFile(wchar_t *szSkinName, bool bStartup, bool bOnlyPreview);
diff --git a/plugins/TipperYM/src/str_utils.cpp b/plugins/TipperYM/src/str_utils.cpp index 0752750d87..b15abbf5fc 100644 --- a/plugins/TipperYM/src/str_utils.cpp +++ b/plugins/TipperYM/src/str_utils.cpp @@ -28,25 +28,25 @@ bool a2w(const char *as, wchar_t *buff, int bufflen) return true;
}
-bool w2a(const wchar_t *ws, char *buff, int bufflen)
+bool w2a(const wchar_t *ws, char *buff, int bufflen)
{
if (ws) WideCharToMultiByte(iCodePage, 0, ws, -1, buff, bufflen, nullptr, nullptr);
return true;
}
-bool utf2w(const char *us, wchar_t *buff, int bufflen)
+bool utf2w(const char *us, wchar_t *buff, int bufflen)
{
if (us) MultiByteToWideChar(CP_UTF8, 0, us, -1, buff, bufflen);
return true;
}
-bool w2utf(const wchar_t *ws, char *buff, int bufflen)
+bool w2utf(const wchar_t *ws, char *buff, int bufflen)
{
if (ws) WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, bufflen, nullptr, nullptr);
return true;
}
-bool a2utf(const char *as, char *buff, int bufflen)
+bool a2utf(const char *as, char *buff, int bufflen)
{
if (!as) return false;
@@ -67,7 +67,7 @@ bool utf2a(const char *us, char *buff, int bufflen) }
-bool t2w(const wchar_t *ts, wchar_t *buff, int bufflen)
+bool t2w(const wchar_t *ts, wchar_t *buff, int bufflen)
{
wcsncpy(buff, ts, bufflen);
return true;
@@ -79,12 +79,12 @@ bool w2t(const wchar_t *ws, wchar_t *buff, int bufflen) return true;
}
-bool t2a(const wchar_t *ts, char *buff, int bufflen)
+bool t2a(const wchar_t *ts, char *buff, int bufflen)
{
return w2a(ts, buff, bufflen);
}
-bool a2t(const char *as, wchar_t *buff, int bufflen)
+bool a2t(const char *as, wchar_t *buff, int bufflen)
{
return a2w(as, buff, bufflen);
}
@@ -94,37 +94,33 @@ bool t2utf(const wchar_t *ts, char *buff, int bufflen) return w2utf(ts, buff, bufflen);
}
-bool utf2t(const char *us, wchar_t *buff, int bufflen)
+bool utf2t(const char *us, wchar_t *buff, int bufflen)
{
return utf2w(us, buff, bufflen);
}
wchar_t *utf2w(const char *us)
{
- if (us)
- {
+ if (us) {
int size = MultiByteToWideChar(CP_UTF8, 0, us, -1, nullptr, 0);
wchar_t *buff = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
MultiByteToWideChar(CP_UTF8, 0, us, -1, buff, size);
return buff;
- }
- else
- {
+ }
+ else {
return nullptr;
}
}
-char *w2utf(const wchar_t *ws)
+char *w2utf(const wchar_t *ws)
{
- if (ws)
- {
+ if (ws) {
int size = WideCharToMultiByte(CP_UTF8, 0, ws, -1, nullptr, 0, nullptr, nullptr);
char *buff = (char *)mir_alloc(size);
WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, size, nullptr, nullptr);
return buff;
- }
- else
- {
+ }
+ else {
return nullptr;
}
}
@@ -153,7 +149,7 @@ char *utf2a(const char *utfs) return ret;
}
-char *a2utf(const char *as)
+char *a2utf(const char *as)
{
wchar_t *ws = a2w(as);
char *ret = w2utf(ws);
@@ -177,7 +173,7 @@ char *t2a(const wchar_t *ts) return w2a(ts);
}
-wchar_t *a2t(const char *as)
+wchar_t *a2t(const char *as)
{
return a2w(as);
}
@@ -195,8 +191,7 @@ char *t2utf(const wchar_t *ts) wchar_t *myfgets(wchar_t *Buf, int MaxCount, FILE *File)
{
fgetws(Buf, MaxCount, File);
- for (size_t i = mir_wstrlen(Buf) - 1; ; i--)
- {
+ for (size_t i = mir_wstrlen(Buf) - 1; ; i--) {
if (Buf[i] == '\n' || Buf[i] == ' ')
Buf[i] = 0;
else
@@ -205,4 +200,4 @@ wchar_t *myfgets(wchar_t *Buf, int MaxCount, FILE *File) CharLower(Buf);
return Buf;
-}
\ No newline at end of file +}
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index b46fd74dcf..78ae3c6c55 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -65,7 +65,7 @@ bool CheckContactType(MCONTACT hContact, const DISPLAYITEM &di) if (di.type == DIT_ALL) return true; - char *szProto = GetContactProto(hContact); + char *szProto = GetContactProto(hContact); if (szProto) { if (db_get_b(hContact, szProto, "ChatRoom", 0) != 0) return di.type == DIT_CHATS; @@ -87,7 +87,7 @@ void StripBBCodesInPlace(wchar_t *ptszText) size_t iRead = 0, iWrite = 0; size_t iLen = mir_wstrlen(ptszText); - while(iRead <= iLen) { // copy terminating null too + while (iRead <= iLen) { // copy terminating null too while (iRead <= iLen && ptszText[iRead] != '[') { if (ptszText[iRead] != ptszText[iWrite]) ptszText[iWrite] = ptszText[iRead]; iRead++; iWrite++; @@ -173,7 +173,7 @@ wchar_t* GetLastMessageText(MCONTACT hContact, bool received) if (dbei.cbBlob == 0 || dbei.pBlob == nullptr) return nullptr; - wchar_t *buff = DbEvent_GetTextW( &dbei, CP_ACP ); + wchar_t *buff = DbEvent_GetTextW(&dbei, CP_ACP); wchar_t *swzMsg = mir_wstrdup(buff); mir_free(buff); @@ -220,7 +220,7 @@ wchar_t* GetStatusMessageText(MCONTACT hContact) if (wStatus == ID_STATUS_OFFLINE) return nullptr; - if (!db_get_ws(hContact, MODULENAME, "TempStatusMsg", &dbv)) { + if (!g_plugin.getWString(hContact, "TempStatusMsg", &dbv)) { if (mir_wstrlen(dbv.pwszVal) != 0) swzMsg = mir_wstrdup(dbv.pwszVal); db_free(&dbv); @@ -304,7 +304,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int MCONTACT hSubContact = db_mc_getMostOnline(hContact); if (!hSubContact) return false; - + wchar_t *swzNick = Clist_GetContactDisplayName(hSubContact); if (swzNick) wcsncpy(buff, swzNick, bufflen); @@ -365,17 +365,17 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int for (int i = 0; i < iNumber; i++) { if (i > 0) hTmpContact = db_mc_getSub(hContact, i); - dwRecountTs = db_get_dw(hTmpContact, MODULENAME, "LastCountTS", 0); + dwRecountTs = g_plugin.getDword(hTmpContact, "LastCountTS"); dwTime = (DWORD)time(0); dwDiff = (dwTime - dwRecountTs); if (dwDiff > (60 * 60 * 24 * 3)) { - db_set_dw(hTmpContact, MODULENAME, "LastCountTS", dwTime); + g_plugin.setDword(hTmpContact, "LastCountTS", dwTime); dwCountOut = dwCountIn = dwLastTs = 0; } else { - dwCountOut = db_get_dw(hTmpContact, MODULENAME, "MsgCountOut", 0); - dwCountIn = db_get_dw(hTmpContact, MODULENAME, "MsgCountIn", 0); - dwLastTs = db_get_dw(hTmpContact, MODULENAME, "LastMsgTS", 0); + dwCountOut = g_plugin.getDword(hTmpContact, "MsgCountOut"); + dwCountIn = g_plugin.getDword(hTmpContact, "MsgCountIn"); + dwLastTs = g_plugin.getDword(hTmpContact, "LastMsgTS"); } dwNewTs = dwLastTs; @@ -397,9 +397,9 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int } if (dwNewTs > dwLastTs) { - db_set_dw(hTmpContact, MODULENAME, "MsgCountOut", dwCountOut); - db_set_dw(hTmpContact, MODULENAME, "MsgCountIn", dwCountIn); - db_set_dw(hTmpContact, MODULENAME, "LastMsgTS", dwNewTs); + g_plugin.setDword(hTmpContact, "MsgCountOut", dwCountOut); + g_plugin.setDword(hTmpContact, "MsgCountIn", dwCountIn); + g_plugin.setDword(hTmpContact, "LastMsgTS", dwNewTs); } dwMetaCountOut += dwCountOut; @@ -760,8 +760,7 @@ wchar_t* GetProtoExtraStatusMessage(char *szProto) } wchar_t *tszParsed = variables_parse(ptszText, nullptr, hContact); - if (tszParsed) - { + if (tszParsed) { mir_free(ptszText); ptszText = tszParsed; } diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index 0cae9b3abe..60b9b439a5 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -50,7 +50,8 @@ PLUGININFOEX pluginInfoEx = CMPlugin::CMPlugin() :
PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
-{}
+{
+}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -101,7 +102,7 @@ static int EventDeleted(WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = {};
if (!db_event_get(lParam, &dbei))
if (dbei.eventType == EVENTTYPE_MESSAGE)
- db_unset(wParam, MODULENAME, "LastCountTS");
+ g_plugin.delSetting(wParam, "LastCountTS");
return 0;
}
@@ -225,7 +226,7 @@ static void InitFonts() static int ModulesLoaded(WPARAM, LPARAM)
{
InitFonts();
-
+
hAvChangeEvent = HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
hShowTipEvent = HookEvent(ME_CLC_SHOWINFOTIP, ShowTipHook);
hHideTipEvent = HookEvent(ME_CLC_HIDEINFOTIP, HideTipHook);
diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index 999585bd3e..36bfd55bc4 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -26,6 +26,94 @@ DBVTranslation *translations = nullptr; DWORD dwNextFuncId;
HANDLE hServiceAdd;
+static LISTTYPEDATAITEM languages[] =
+{
+ {0, LPGEN("None")},
+ {55,LPGEN("Afrikaans")},
+ {58,LPGEN("Albanian")},
+ {1, LPGEN("Arabic")},
+ {59,LPGEN("Armenian")},
+ {68,LPGEN("Azerbaijani")},
+ {72,LPGEN("Belorussian")},
+ {2, LPGEN("Bhojpuri")},
+ {56,LPGEN("Bosnian")},
+ {3, LPGEN("Bulgarian")},
+ {4, LPGEN("Burmese")},
+ {5, LPGEN("Cantonese")},
+ {6, LPGEN("Catalan")},
+ {61,LPGEN("Chamorro")},
+ {7, LPGEN("Chinese")},
+ {8, LPGEN("Croatian")},
+ {9, LPGEN("Czech")},
+ {10,LPGEN("Danish")},
+ {11,LPGEN("Dutch")},
+ {12,LPGEN("English")},
+ {13,LPGEN("Esperanto")},
+ {14,LPGEN("Estonian")},
+ {15,LPGEN("Farsi")},
+ {16,LPGEN("Finnish")},
+ {17,LPGEN("French")},
+ {18,LPGEN("Gaelic")},
+ {19,LPGEN("German")},
+ {20,LPGEN("Greek")},
+ {70,LPGEN("Gujarati")},
+ {21,LPGEN("Hebrew")},
+ {22,LPGEN("Hindi")},
+ {23,LPGEN("Hungarian")},
+ {24,LPGEN("Icelandic")},
+ {25,LPGEN("Indonesian")},
+ {26,LPGEN("Italian")},
+ {27,LPGEN("Japanese")},
+ {28,LPGEN("Khmer")},
+ {29,LPGEN("Korean")},
+ {69,LPGEN("Kurdish")},
+ {30,LPGEN("Lao")},
+ {31,LPGEN("Latvian")},
+ {32,LPGEN("Lithuanian")},
+ {65,LPGEN("Macedonian")},
+ {33,LPGEN("Malay")},
+ {63,LPGEN("Mandarin")},
+ {62,LPGEN("Mongolian")},
+ {34,LPGEN("Norwegian")},
+ {57,LPGEN("Persian")},
+ {35,LPGEN("Polish")},
+ {36,LPGEN("Portuguese")},
+ {60,LPGEN("Punjabi")},
+ {37,LPGEN("Romanian")},
+ {38,LPGEN("Russian")},
+ {39,LPGEN("Serbo-Croatian")},
+ {66,LPGEN("Sindhi")},
+ {40,LPGEN("Slovak")},
+ {41,LPGEN("Slovenian")},
+ {42,LPGEN("Somali")},
+ {43,LPGEN("Spanish")},
+ {44,LPGEN("Swahili")},
+ {45,LPGEN("Swedish")},
+ {46,LPGEN("Tagalog")},
+ {64,LPGEN("Taiwanese")},
+ {71,LPGEN("Tamil")},
+ {47,LPGEN("Tatar")},
+ {48,LPGEN("Thai")},
+ {49,LPGEN("Turkish")},
+ {50,LPGEN("Ukrainian")},
+ {51,LPGEN("Urdu")},
+ {52,LPGEN("Vietnamese")},
+ {67,LPGEN("Welsh")},
+ {53,LPGEN("Yiddish")},
+ {54,LPGEN("Yoruba")},
+};
+
+static char *days[7] =
+{
+ LPGEN("Sunday"), LPGEN("Monday"), LPGEN("Tuesday"), LPGEN("Wednesday"), LPGEN("Thursday"), LPGEN("Friday"), LPGEN("Saturday")
+};
+
+static char *months[12] =
+{
+ LPGEN("January"), LPGEN("February"), LPGEN("March"), LPGEN("April"), LPGEN("May"), LPGEN("June"),
+ LPGEN("July"), LPGEN("August"), LPGEN("September"), LPGEN("October"), LPGEN("November"), LPGEN("December")
+};
+
void AddTranslation(DBVTranslation *newTrans)
{
DBVTranslation *ptranslations = (DBVTranslation *)mir_realloc(translations, sizeof(DBVTranslation) * (iTransFuncsCount + 1));
diff --git a/plugins/TipperYM/src/translations.h b/plugins/TipperYM/src/translations.h index d981a2601c..8329047d9f 100644 --- a/plugins/TipperYM/src/translations.h +++ b/plugins/TipperYM/src/translations.h @@ -24,94 +24,10 @@ Boston, MA 02111-1307, USA. extern int iTransFuncsCount;
extern DBVTranslation *translations;
-typedef struct {
- int id;
- char *szValue;
-} LISTTYPEDATAITEM;
-
-static LISTTYPEDATAITEM languages[] = {
- {0, LPGEN("None")},
- {55,LPGEN("Afrikaans")},
- {58,LPGEN("Albanian")},
- {1, LPGEN("Arabic")},
- {59,LPGEN("Armenian")},
- {68,LPGEN("Azerbaijani")},
- {72,LPGEN("Belorussian")},
- {2, LPGEN("Bhojpuri")},
- {56,LPGEN("Bosnian")},
- {3, LPGEN("Bulgarian")},
- {4, LPGEN("Burmese")},
- {5, LPGEN("Cantonese")},
- {6, LPGEN("Catalan")},
- {61,LPGEN("Chamorro")},
- {7, LPGEN("Chinese")},
- {8, LPGEN("Croatian")},
- {9, LPGEN("Czech")},
- {10,LPGEN("Danish")},
- {11,LPGEN("Dutch")},
- {12,LPGEN("English")},
- {13,LPGEN("Esperanto")},
- {14,LPGEN("Estonian")},
- {15,LPGEN("Farsi")},
- {16,LPGEN("Finnish")},
- {17,LPGEN("French")},
- {18,LPGEN("Gaelic")},
- {19,LPGEN("German")},
- {20,LPGEN("Greek")},
- {70,LPGEN("Gujarati")},
- {21,LPGEN("Hebrew")},
- {22,LPGEN("Hindi")},
- {23,LPGEN("Hungarian")},
- {24,LPGEN("Icelandic")},
- {25,LPGEN("Indonesian")},
- {26,LPGEN("Italian")},
- {27,LPGEN("Japanese")},
- {28,LPGEN("Khmer")},
- {29,LPGEN("Korean")},
- {69,LPGEN("Kurdish")},
- {30,LPGEN("Lao")},
- {31,LPGEN("Latvian")},
- {32,LPGEN("Lithuanian")},
- {65,LPGEN("Macedonian")},
- {33,LPGEN("Malay")},
- {63,LPGEN("Mandarin")},
- {62,LPGEN("Mongolian")},
- {34,LPGEN("Norwegian")},
- {57,LPGEN("Persian")},
- {35,LPGEN("Polish")},
- {36,LPGEN("Portuguese")},
- {60,LPGEN("Punjabi")},
- {37,LPGEN("Romanian")},
- {38,LPGEN("Russian")},
- {39,LPGEN("Serbo-Croatian")},
- {66,LPGEN("Sindhi")},
- {40,LPGEN("Slovak")},
- {41,LPGEN("Slovenian")},
- {42,LPGEN("Somali")},
- {43,LPGEN("Spanish")},
- {44,LPGEN("Swahili")},
- {45,LPGEN("Swedish")},
- {46,LPGEN("Tagalog")},
- {64,LPGEN("Taiwanese")},
- {71,LPGEN("Tamil")},
- {47,LPGEN("Tatar")},
- {48,LPGEN("Thai")},
- {49,LPGEN("Turkish")},
- {50,LPGEN("Ukrainian")},
- {51,LPGEN("Urdu")},
- {52,LPGEN("Vietnamese")},
- {67,LPGEN("Welsh")},
- {53,LPGEN("Yiddish")},
- {54,LPGEN("Yoruba")},
-};
-
-static char *days[7] = {
- LPGEN("Sunday"), LPGEN("Monday"), LPGEN("Tuesday"), LPGEN("Wednesday"), LPGEN("Thursday"), LPGEN("Friday"), LPGEN("Saturday")
-};
-
-static char *months[12] = {
- LPGEN("January"), LPGEN("February"), LPGEN("March"), LPGEN("April"), LPGEN("May"), LPGEN("June"),
- LPGEN("July"), LPGEN("August"), LPGEN("September"), LPGEN("October"), LPGEN("November"), LPGEN("December")
+struct LISTTYPEDATAITEM
+{
+ int id;
+ char *szValue;
};
void InitTranslations();
@@ -121,5 +37,4 @@ wchar_t *TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, wchar_t *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen);
wchar_t *WordToStatusDesc(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen);
-
#endif
|