summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10>2012-07-19 00:17:32 +0000
committer(no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10>2012-07-19 00:17:32 +0000
commite89fe281f2589d9bc562b8f59efba3680d497137 (patch)
tree2129283d730d508ef295d377b05321c0cc67b63f
parent9a04d5930c26ba291b4ceee5180ec599147cdb64 (diff)
Updated for compatibility with Unicode avatars
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@602 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r--metacontacts/MetaContacts.dsp4
-rw-r--r--metacontacts/MetaContacts_9.vcproj49
-rw-r--r--metacontacts/edit.c13
-rw-r--r--metacontacts/meta_menu.c13
-rw-r--r--metacontacts/meta_services.c118
-rw-r--r--metacontacts/meta_utils.c39
-rw-r--r--metacontacts/metacontacts.h2
-rw-r--r--metacontacts/version.h2
8 files changed, 109 insertions, 131 deletions
diff --git a/metacontacts/MetaContacts.dsp b/metacontacts/MetaContacts.dsp
index af10a0f..05bc0af 100644
--- a/metacontacts/MetaContacts.dsp
+++ b/metacontacts/MetaContacts.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "METACONTACTS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O1 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "METACONTACTS_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /FR /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX- /O1 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "METACONTACTS_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0xc09 /d "NDEBUG"
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "METACONTACTS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "METACONTACTS_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /FR /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX- /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "METACONTACTS_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0xc09 /d "_DEBUG"
diff --git a/metacontacts/MetaContacts_9.vcproj b/metacontacts/MetaContacts_9.vcproj
index f72867a..6921ec3 100644
--- a/metacontacts/MetaContacts_9.vcproj
+++ b/metacontacts/MetaContacts_9.vcproj
@@ -52,15 +52,13 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="../../include"
+ AdditionalIncludeDirectories="../../include;..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;METACONTACTS_EXPORTS"
- BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="metacontacts.h"
BrowseInformation="1"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="3"
ShowIncludes="false"
/>
@@ -82,8 +80,6 @@
SuppressStartupBanner="true"
GenerateDebugInformation="true"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="1"
/>
<Tool
@@ -152,7 +148,6 @@
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="3"
ShowIncludes="false"
/>
@@ -170,14 +165,11 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="user32.lib gdi32.lib comctl32.lib"
- OutputFile="c:\miranda im\Plugins\$(ProjectName).dll"
+ OutputFile="\miranda im\Plugins\$(ProjectName).dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/MetaContacts.pdb"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="17"
/>
<Tool
@@ -239,11 +231,11 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
WholeProgramOptimization="true"
- AdditionalIncludeDirectories="../../include"
+ AdditionalIncludeDirectories="../../include;..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;METACONTACTS_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
- RuntimeLibrary="0"
+ RuntimeLibrary="2"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
@@ -251,7 +243,6 @@
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="metacontacts.h"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="0"
ShowIncludes="false"
/>
@@ -276,8 +267,6 @@
EnableCOMDATFolding="2"
BaseAddress="0x22010000"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="1"
/>
<Tool
@@ -339,7 +328,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
WholeProgramOptimization="true"
- AdditionalIncludeDirectories="../../include"
+ AdditionalIncludeDirectories="../../include;..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;METACONTACTS_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
@@ -354,7 +343,6 @@
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="0"
ShowIncludes="false"
/>
@@ -379,8 +367,6 @@
EnableCOMDATFolding="2"
BaseAddress="0x22010000"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="17"
/>
<Tool
@@ -438,7 +424,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="../../include"
+ AdditionalIncludeDirectories="../../include;..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;METACONTACTS_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -446,7 +432,6 @@
PrecompiledHeaderThrough="metacontacts.h"
BrowseInformation="1"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="3"
ShowIncludes="false"
/>
@@ -468,7 +453,6 @@
SuppressStartupBanner="true"
GenerateDebugInformation="true"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="1"
/>
@@ -527,7 +511,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="../../include"
+ AdditionalIncludeDirectories="../../include;..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;METACONTACTS_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -538,7 +522,6 @@
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="3"
ShowIncludes="false"
/>
@@ -562,7 +545,6 @@
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/MetaContacts.pdb"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="17"
/>
@@ -620,15 +602,16 @@
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="3"
+ Optimization="1"
InlineFunctionExpansion="1"
+ EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
WholeProgramOptimization="true"
- AdditionalIncludeDirectories="../../include"
+ AdditionalIncludeDirectories="../../include;..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;METACONTACTS_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
- RuntimeLibrary="0"
+ RuntimeLibrary="2"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
@@ -636,7 +619,6 @@
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="metacontacts.h"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="0"
ShowIncludes="false"
/>
@@ -660,8 +642,6 @@
EnableCOMDATFolding="2"
BaseAddress="0x22010000"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="1"
/>
<Tool
@@ -723,11 +703,11 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
WholeProgramOptimization="true"
- AdditionalIncludeDirectories="../../include"
+ AdditionalIncludeDirectories="../../include;..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;METACONTACTS_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
- RuntimeLibrary="0"
+ RuntimeLibrary="2"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
@@ -738,7 +718,6 @@
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
- SuppressStartupBanner="true"
DebugInformationFormat="0"
ShowIncludes="false"
/>
@@ -764,8 +743,6 @@
EnableCOMDATFolding="2"
BaseAddress="0x22010000"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="17"
/>
<Tool
diff --git a/metacontacts/edit.c b/metacontacts/edit.c
index 9a5f55d..4aa5cf6 100644
--- a/metacontacts/edit.c
+++ b/metacontacts/edit.c
@@ -213,18 +213,7 @@ void ApplyChanges(CHANGES *chg)
Meta_FixStatus(chg->hMeta);
// fix avatar
- most_online = Meta_GetMostOnlineSupporting(chg->hMeta, PFLAGNUM_4, PF4_AVATARS);
- if(most_online) {
- PROTO_AVATAR_INFORMATION AI;
-
- AI.cbSize = sizeof(AI);
- AI.hContact = chg->hMeta;
- AI.format = PA_FORMAT_UNKNOWN;
- strcpy(AI.filename, "X");
-
- if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS)
- DBWriteContactSettingString(chg->hMeta, "ContactPhoto", "File",AI.filename);
- }
+ Meta_UpdateAvatar(chg->hMeta);
if(MetaAPI_GetForceState((WPARAM)chg->hMeta, 0) != chg->force_default)
MetaAPI_ForceDefault((WPARAM)chg->hMeta, 0);
diff --git a/metacontacts/meta_menu.c b/metacontacts/meta_menu.c
index 36caabf..e83f87f 100644
--- a/metacontacts/meta_menu.c
+++ b/metacontacts/meta_menu.c
@@ -222,18 +222,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) {
Meta_FixStatus(hMeta);
// fix avatar
- hContact = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS);
- if(hContact) {
- PROTO_AVATAR_INFORMATION AI;
-
- AI.cbSize = sizeof(AI);
- AI.hContact = hMeta;
- AI.format = PA_FORMAT_UNKNOWN;
- strcpy(AI.filename, "X");
-
- if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS)
- DBWriteContactSettingString(hMeta, "ContactPhoto", "File",AI.filename);
- }
+ Meta_UpdateAvatar(hMeta);
}
}
diff --git a/metacontacts/meta_services.c b/metacontacts/meta_services.c
index bbf9177..90e8c16 100644
--- a/metacontacts/meta_services.c
+++ b/metacontacts/meta_services.c
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "metacontacts.h"
-#define NB_SERVICES 62 //!< Number of services registered in Miranda (see Meta_CloseHandles()).
+#define NB_SERVICES 63 //!< Number of services registered in Miranda (see Meta_CloseHandles()).
#define NB_HOOKS 17 //!< Number of hooks set up (see Meta_CloseHandles()).
#define PREF_METANODB 0x2000 //!< Flag to indicate message should not be added to db by filter when sending
@@ -649,26 +649,25 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
// change avatar if the most online supporting avatars changes, or if we don't have one
most_online = Meta_GetMostOnlineSupporting(hUser, PFLAGNUM_4, PF4_AVATARS);
- //if(AI.hContact == 0 || AI.hContact != most_online) {
- if(ack->hContact == 0 || ack->hContact != most_online) {
+ if(ack->hContact == NULL || ack->hContact != most_online) {
return 0;
}
- //if(!DBGetContactSetting(AI.hContact, "ContactPhoto", "File", &dbv)) {
- if(!DBGetContactSetting(ack->hContact, "ContactPhoto", "File", &dbv)) {
- DBWriteContactSettingString(hUser, "ContactPhoto", "File", dbv.pszVal);
+ if (!DBGetContactSettingStringUtf(ack->hContact, "ContactPhoto", "File", &dbv)) {
+ DBWriteContactSettingStringUtf(hUser, "ContactPhoto", "File", dbv.pszVal);
DBFreeVariant(&dbv);
}
- if(ack->hProcess) {
- PROTO_AVATAR_INFORMATION AI;
- memcpy(&AI, (PROTO_AVATAR_INFORMATION *)ack->hProcess, sizeof(PROTO_AVATAR_INFORMATION));
- if(AI.hContact)
- AI.hContact = hUser;
+ if (ack->hProcess)
+ {
+ PROTO_AVATAR_INFORMATION *aip = (PROTO_AVATAR_INFORMATION*)ack->hProcess;
+ PROTO_AVATAR_INFORMATION *AI = (PROTO_AVATAR_INFORMATION*)alloca(aip->cbSize);
+ memcpy(AI, aip, aip->cbSize);
+ if (AI->hContact) AI->hContact = hUser;
- return ProtoBroadcastAck(META_PROTO,hUser,ack->type,ack->result, (HANDLE)&AI, ack->lParam);
+ return ProtoBroadcastAck(META_PROTO, hUser, ack->type, ack->result, AI, ack->lParam);
} else
- return ProtoBroadcastAck(META_PROTO,hUser,ack->type,ack->result, 0, ack->lParam);
+ return ProtoBroadcastAck(META_PROTO, hUser, ack->type,ack->result, NULL, ack->lParam);
}
}
@@ -882,18 +881,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
}
// most online contact with avatar support might have changed - update avatar
- most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS);
- if(most_online) {
- PROTO_AVATAR_INFORMATION AI;
-
- AI.cbSize = sizeof(AI);
- AI.hContact = hMeta;
- AI.format = PA_FORMAT_UNKNOWN;
- strcpy(AI.filename, "X");
-
- if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS)
- DBWriteContactSettingString(hMeta, "ContactPhoto", "File",AI.filename);
- }
+ Meta_UpdateAvatar(hMeta);
} else
if(strcmp(dcws->szSetting, "XStatusId") == 0 || strcmp(dcws->szSetting, "XStatusMsg") == 0 || strcmp(dcws->szSetting, "XStatusName") == 0 || strcmp(dcws->szSetting, "StatusMsg") == 0) {
@@ -1756,12 +1744,12 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) {
return 0; // fail
}
-INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
- PROTO_AVATAR_INFORMATION *AI = (PROTO_AVATAR_INFORMATION *) lParam;
- char *proto = 0;
- DWORD default_contact_number;
+INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam)
+{
+ PROTO_AVATAR_INFORMATION *AI = (PROTO_AVATAR_INFORMATION *)lParam;
+ DWORD default_contact_number = DBGetContactSettingDword(AI->hContact, META_PROTO, "Default", -1);
- if((default_contact_number = DBGetContactSettingDword(AI->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if (default_contact_number == -1)
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1770,8 +1758,43 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
else
{
HANDLE hSub, hMeta;
- char szServiceName[100];
- int result;
+ INT_PTR result;
+ char *proto;
+
+ hMeta = AI->hContact;
+ hSub = Meta_GetMostOnlineSupporting(AI->hContact, PFLAGNUM_4, PF4_AVATARS);
+
+ if(!hSub)
+ return GAIR_NOAVATAR;
+
+ proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hSub, 0);
+ if (!proto) return GAIR_NOAVATAR;
+
+ AI->hContact = hSub;
+
+ result = CallProtoService(proto, PS_GETAVATARINFO, wParam, lParam);
+ AI->hContact = hMeta;
+ if (result != CALLSERVICE_NOTFOUND) return result;
+ }
+ return GAIR_NOAVATAR; // fail
+}
+
+INT_PTR Meta_GetAvatarInfoW(WPARAM wParam, LPARAM lParam)
+{
+ PROTO_AVATAR_INFORMATIONW *AI = (PROTO_AVATAR_INFORMATIONW *)lParam;
+ DWORD default_contact_number = DBGetContactSettingDword(AI->hContact, META_PROTO, "Default", -1);
+
+ if (default_contact_number == -1)
+ {
+ // This is a simple contact
+ // (this should normally not happen, since linked contacts do not appear on the list.)
+ return 0;
+ }
+ else
+ {
+ HANDLE hSub, hMeta;
+ INT_PTR result;
+ char *proto;
hMeta = AI->hContact;
hSub = Meta_GetMostOnlineSupporting(AI->hContact, PFLAGNUM_4, PF4_AVATARS);
@@ -1780,12 +1803,11 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
return GAIR_NOAVATAR;
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hSub, 0);
- if(!proto) return GAIR_NOAVATAR;
+ if (!proto) return GAIR_NOAVATAR;
AI->hContact = hSub;
- mir_snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PS_GETAVATARINFO);
- result = CallService(szServiceName, wParam, lParam);
+ result = CallProtoService(proto, PS_GETAVATARINFOW, wParam, lParam);
AI->hContact = hMeta;
if (result != CALLSERVICE_NOTFOUND) return result;
}
@@ -1806,23 +1828,9 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) {
else
{
HANDLE most_online;
- PROTO_AVATAR_INFORMATION AI;
- char szServiceName[100];
-
- most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_4, PF4_AVATARS);
-
- if(!most_online)
- return 0;
+ INT_PTR res;
- proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
- if(!proto) return 0;
-
- AI.cbSize = sizeof(AI);
- AI.hContact = ccs->hContact;
- AI.format = PA_FORMAT_UNKNOWN;
- strcpy(AI.filename, "X");
- if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS)
- DBWriteContactSettingString(ccs->hContact, "ContactPhoto", "File",AI.filename);
+ Meta_UpdateAvatar(ccs->hContact);
most_online = Meta_GetMostOnline(ccs->hContact);
Meta_CopyContactNick(ccs->hContact, most_online);
@@ -1835,11 +1843,8 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) {
ccs->hContact = most_online;
//Meta_SetNick(proto);
- _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_GETINFO);
- if (ServiceExists(szServiceName)) {
- strncpy(szServiceName, PSS_GETINFO, sizeof(szServiceName));
- return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam));
- }
+ res = CallContactService(ccs->hContact, PSS_GETINFO, ccs->wParam, ccs->lParam);
+ if (res != CALLSERVICE_NOTFOUND) return res;
}
return 0; // fail
}
@@ -2041,6 +2046,7 @@ void Meta_InitServices()
hServices[60] = CreateServiceFunction("MetaContacts/CListMessageEvent", Meta_ClistMessageEventClicked);
hServices[61] = CreateProtoServiceFunction(META_PROTO, "/SendNudge", Meta_SendNudge);
+ hServices[62] = CreateProtoServiceFunction(META_PROTO,PS_GETAVATARINFOW,Meta_GetAvatarInfoW);
// create our hookable events
hEventDefaultChanged = CreateHookableEvent(ME_MC_DEFAULTTCHANGED);
diff --git a/metacontacts/meta_utils.c b/metacontacts/meta_utils.c
index 38a9e69..5946582 100644
--- a/metacontacts/meta_utils.c
+++ b/metacontacts/meta_utils.c
@@ -414,18 +414,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
Meta_FixStatus(dest);
// if the new contact is the most online contact with avatar support, get avatar info
- most_online = Meta_GetMostOnlineSupporting(dest, PFLAGNUM_4, PF4_AVATARS);
- if(most_online == src) {
- PROTO_AVATAR_INFORMATION AI;
-
- AI.cbSize = sizeof(AI);
- AI.hContact = dest;
- AI.format = PA_FORMAT_UNKNOWN;
- strcpy(AI.filename, "X");
-
- if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS)
- DBWriteContactSettingString(dest, "ContactPhoto", "File",AI.filename);
- }
+ Meta_UpdateAvatar(dest);
// Hide the contact
Meta_SetGroup(src);
@@ -1713,5 +1702,31 @@ INT_PTR Meta_IsEnabled() {
return DBGetContactSettingByte(0, META_PROTO, "Enabled", 1) && (meta_group_hack_disabled || DBGetContactSettingByte(NULL, "CList", "UseGroups", 1));
}
+void Meta_UpdateAvatar(HANDLE hMeta)
+{
+ HANDLE most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS);
+ if (most_online)
+ {
+ PROTO_AVATAR_INFORMATIONW AI;
+
+ AI.cbSize = sizeof(AI);
+ AI.hContact = hMeta;
+ AI.format = PA_FORMAT_UNKNOWN;
+ wcscpy(AI.filename, L"X");
+
+ if (CallProtoService(META_PROTO, PS_GETAVATARINFOW, 0, (LPARAM)&AI) == GAIR_SUCCESS)
+ DBWriteContactSettingWString(hMeta, "ContactPhoto", "File", AI.filename);
+ else
+ {
+ PROTO_AVATAR_INFORMATION AI;
+ AI.cbSize = sizeof(AI);
+ AI.hContact = hMeta;
+ AI.format = PA_FORMAT_UNKNOWN;
+ strcpy(AI.filename, "X");
+ if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS)
+ DBWriteContactSettingString(hMeta, "ContactPhoto", "File", AI.filename);
+ }
+ }
+}
diff --git a/metacontacts/metacontacts.h b/metacontacts/metacontacts.h
index c2131e4..b67f433 100644
--- a/metacontacts/metacontacts.h
+++ b/metacontacts/metacontacts.h
@@ -61,6 +61,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_icolib.h>
#include <m_langpack.h>
#include <m_popup.h>
+#include <m_avatars.h>
#include <m_cluiframes.h>
#include "../updater/m_updater.h"
@@ -125,6 +126,7 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_IsEnabled();
+void Meta_UpdateAvatar(HANDLE hContact);
int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id);
int Meta_ModifyMenu(WPARAM wParam,LPARAM lParam);
diff --git a/metacontacts/version.h b/metacontacts/version.h
index 5c5bf65..0be88cf 100644
--- a/metacontacts/version.h
+++ b/metacontacts/version.h
@@ -5,7 +5,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 14
#define __RELEASE_NUM 0
-#define __BUILD_NUM 13
+#define __BUILD_NUM 14
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM