summaryrefslogtreecommitdiff
path: root/MySpace/server_con.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'MySpace/server_con.cpp')
-rw-r--r--MySpace/server_con.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp
index 07d3684..d2c5916 100644
--- a/MySpace/server_con.cpp
+++ b/MySpace/server_con.cpp
@@ -1044,13 +1044,14 @@ void __cdecl sttDownloadAvatar(void *param) {
ProtoBroadcastAck(MODULE,info->hContact,ACKTYPE_AVATAR,ACKRESULT_DATA, 0, 0);
char *ext = strrchr(info->url, '.');
+ if(ext) ext++;
// write file
int uid = DBGetContactSettingDword(info->hContact, MODULE, "UID", 0);
char fn[MAX_PATH];
char buff[128], tbuff[128];
- mir_snprintf(fn, MAX_PATH, "%s_%s.%s", _itoa(uid, buff, 10), _itoa(GetTickCount(), tbuff, 10), ext);
+ mir_snprintf(fn, MAX_PATH, "%s_%s.%s", _itoa(uid, buff, 10), _itoa(GetTickCount(), tbuff, 10), ext ? ext : "");
if(WriteData(fn, MAX_PATH, nlhrReply->pData, nlhrReply->dataLength)) {
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
@@ -1060,14 +1061,19 @@ void __cdecl sttDownloadAvatar(void *param) {
AI.cbSize = sizeof(PROTO_AVATAR_INFORMATION);
AI.hContact = info->hContact;
strncpy(AI.filename, fn, MAX_PATH);
- AI.format =
- (stricmp(ext, ".png") ? PA_FORMAT_PNG :
- (stricmp(ext, ".jpg") ? PA_FORMAT_JPEG :
- (stricmp(ext, ".jpeg") ? PA_FORMAT_JPEG :
- (stricmp(ext, ".gif") ? PA_FORMAT_GIF :
- (stricmp(ext, ".swf") ? PA_FORMAT_SWF : PA_FORMAT_UNKNOWN)))));
+ if(ext) {
+ AI.format =
+ (stricmp(ext, ".png") ? PA_FORMAT_PNG :
+ (stricmp(ext, ".jpg") ? PA_FORMAT_JPEG :
+ (stricmp(ext, ".jpeg") ? PA_FORMAT_JPEG :
+ (stricmp(ext, ".gif") ? PA_FORMAT_GIF :
+ (stricmp(ext, ".swf") ? PA_FORMAT_SWF : PA_FORMAT_UNKNOWN)))));
+ } else
+ AI.format = PA_FORMAT_UNKNOWN;
ProtoBroadcastAck(MODULE,info->hContact,ACKTYPE_AVATAR,ACKRESULT_SUCCESS,(HANDLE) &AI, 0);
+ if(!info->hContact)
+ CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)MODULE, 0);
} else
ProtoBroadcastAck(MODULE,info->hContact,ACKTYPE_AVATAR,ACKRESULT_FAILED, 0, 0);
} else