summaryrefslogtreecommitdiff
path: root/plugins/AVS/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-23 20:29:14 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-23 20:29:14 +0000
commitb9eed106e74a7725f57b8175bc580a1520e1fe24 (patch)
tree916b5aab16e50ad2a968d0b5145fc9c3447a57f1 /plugins/AVS/src
parent77ece3939612fb0133d20815883e4ed50a10230e (diff)
patch for avatars reading optimization (by wsx22)
git-svn-id: http://svn.miranda-ng.org/main/trunk@7843 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AVS/src')
-rw-r--r--plugins/AVS/src/poll.cpp7
-rw-r--r--plugins/AVS/src/utils.cpp12
2 files changed, 14 insertions, 5 deletions
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp
index 840c3d78b9..beefe4e8ee 100644
--- a/plugins/AVS/src/poll.cpp
+++ b/plugins/AVS/src/poll.cpp
@@ -48,7 +48,8 @@ extern HANDLE hShutdownEvent;
extern int DeleteAvatar(HANDLE hContact);
extern void MakePathRelative(HANDLE hContact, TCHAR *path);
int Proto_GetDelayAfterFail(const char *proto);
-BOOL Proto_IsFetchingAlwaysAllowed(const char *proto);
+BOOL Proto_IsFetchingWhenProtoNotVisibleAllowed(const char *proto);
+BOOL Proto_IsFetchingWhenContactOfflineAllowed(const char *proto);
#ifdef _DEBUG
int _DebugTrace(const char *fmt, ...);
@@ -89,7 +90,7 @@ static BOOL PollProtocolCanHaveAvatar(const char *szProto)
int status = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
return (pCaps & PF4_AVATARS)
&& (g_szMetaName == NULL || strcmp(g_szMetaName, szProto))
- && ((status > ID_STATUS_OFFLINE && status != ID_STATUS_INVISIBLE) || Proto_IsFetchingAlwaysAllowed(szProto));
+ && ((status > ID_STATUS_OFFLINE && status != ID_STATUS_INVISIBLE) || Proto_IsFetchingWhenProtoNotVisibleAllowed(szProto));
}
// Return true if this protocol has to be checked
@@ -102,7 +103,7 @@ static BOOL PollCheckProtocol(const char *szProto)
static BOOL PollContactCanHaveAvatar(HANDLE hContact, const char *szProto)
{
int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- return (Proto_IsFetchingAlwaysAllowed(szProto) || status != ID_STATUS_OFFLINE)
+ return (Proto_IsFetchingWhenContactOfflineAllowed(szProto) || status != ID_STATUS_OFFLINE)
&& !db_get_b(hContact, "CList", "NotOnList", 0) && db_get_b(hContact, "CList", "ApparentMode", 0) != ID_STATUS_OFFLINE;
}
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp
index ab79fc7b85..e72921dc62 100644
--- a/plugins/AVS/src/utils.cpp
+++ b/plugins/AVS/src/utils.cpp
@@ -475,10 +475,18 @@ int Proto_GetDelayAfterFail(const char *proto)
return 0;
}
-BOOL Proto_IsFetchingAlwaysAllowed(const char *proto)
+BOOL Proto_IsFetchingWhenProtoNotVisibleAllowed(const char *proto)
{
if ( ProtoServiceExists(proto, PS_GETAVATARCAPS))
- return CallProtoService(proto, PS_GETAVATARCAPS, AF_FETCHALWAYS, 0);
+ return CallProtoService(proto, PS_GETAVATARCAPS, AF_FETCHIFPROTONOTVISIBLE, 0);
+
+ return FALSE;
+}
+
+BOOL Proto_IsFetchingWhenContactOfflineAllowed(const char *proto)
+{
+ if ( ProtoServiceExists(proto, PS_GETAVATARCAPS))
+ return CallProtoService(proto, PS_GETAVATARCAPS, AF_FETCHIFCONTACTOFFLINE, 0);
return FALSE;
}