summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber.cpp9
-rw-r--r--protocols/JabberG/src/jabber.h3
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp2
-rw-r--r--protocols/JabberG/src/jabber_util.cpp42
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp2
5 files changed, 13 insertions, 45 deletions
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index 13ac23f6dd..10c241f13e 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -57,6 +57,7 @@ XML_API xi;
TIME_API tmi;
CLIST_INTERFACE* pcli;
+FI_INTERFACE *FIP = NULL;
BOOL jabberChatDllPresent = FALSE;
@@ -185,6 +186,14 @@ extern "C" int __declspec(dllexport) Load()
mir_getLP(&pluginInfo);
mir_getCLI();
+ if (ServiceExists(MS_IMG_GETINTERFACE)) {
+ INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP);
+ if (FIP == NULL || result != S_OK) {
+ MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Flags Module will be disabled."), _T("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
+ return 1;
+ }
+ }
+
WORD v[4];
CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
mir_sntprintf(szCoreVersion, SIZEOF(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h
index 3a415aefaf..e482113872 100644
--- a/protocols/JabberG/src/jabber.h
+++ b/protocols/JabberG/src/jabber.h
@@ -592,6 +592,8 @@ extern TCHAR szCoreVersion[];
extern int g_cbCountries;
extern struct CountryListEntry* g_countries;
+extern FI_INTERFACE *FIP;
+
/*******************************************************************
* Function declarations
*******************************************************************/
@@ -753,7 +755,6 @@ time_t str2time(const TCHAR*);
const TCHAR *JabberStrIStr(const TCHAR *str, const TCHAR *substr);
void JabberCopyText(HWND hwnd, TCHAR *text);
-void JabberBitmapPremultiplyChannels(HBITMAP hBitmap);
CJabberProto *JabberChooseInstance(bool bIsLink=false);
bool JabberReadXep203delay(HXML node, time_t &msgTime);
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index 1810d3ec73..986213bf90 100644
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -658,7 +658,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
char* p = mir_t2a(item->photoFileName);
photoInfo->hBitmap = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)p);
mir_free(p);
- JabberBitmapPremultiplyChannels(photoInfo->hBitmap);
+ FIP->FI_Premultiply(photoInfo->hBitmap);
ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_SHOW);
}
}
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index d2a4bf22e4..37cd2185fb 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -1362,48 +1362,6 @@ bool JabberReadXep203delay(HXML node, time_t &msgTime)
return msgTime != 0;
}
-/////////////////////////////////////////////////////////////////////////////////////////
-// Premultiply bitmap channels for 32-bit bitmaps
-
-void JabberBitmapPremultiplyChannels(HBITMAP hBitmap)
-{
- BITMAP bmp;
- DWORD dwLen;
- BYTE *p;
- int x, y;
-
- GetObject(hBitmap, sizeof(bmp), &bmp);
-
- if (bmp.bmBitsPixel != 32)
- return;
-
- dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
- p = (BYTE *)malloc(dwLen);
- if (p == NULL)
- return;
- memset(p, 0, dwLen);
-
- GetBitmapBits(hBitmap, dwLen, p);
-
- for (y = 0; y < bmp.bmHeight; ++y)
- {
- BYTE *px = p + bmp.bmWidth * 4 * y;
-
- for (x = 0; x < bmp.bmWidth; ++x)
- {
- px[0] = px[0] * px[3] / 255;
- px[1] = px[1] * px[3] / 255;
- px[2] = px[2] * px[3] / 255;
-
- px += 4;
- }
- }
-
- SetBitmapBits(hBitmap, dwLen, p);
-
- free(p);
-}
-
BOOL CJabberProto::IsMyOwnJID(LPCTSTR szJID)
{
if ( !m_ThreadInfo)
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index fbfa3d9c7f..89a5e69c88 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -302,7 +302,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (CopyFile(szAvatarFileName, szTempFileName, FALSE) == TRUE) {
char* p = mir_t2a(szTempFileName);
if ((dat->hBitmap=(HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)p)) != NULL) {
- JabberBitmapPremultiplyChannels(dat->hBitmap);
+ FIP->FI_Premultiply(dat->hBitmap);
_tcscpy(dat->ppro->m_szPhotoFileName, szTempFileName);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
}