diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-10-17 01:13:11 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-10-17 01:13:11 +0000 |
commit | ad7c1f95b18a323357ad02cff8609ba55a72d3e3 (patch) | |
tree | 263ffb031b2f62a2f1665ba3277483fb8392bc1e /MySpace/server_con.cpp | |
parent | 3c8b6f59a6ed800740728fb10becba9ff630adb0 (diff) |
fix get avatar logic
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@368 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'MySpace/server_con.cpp')
-rw-r--r-- | MySpace/server_con.cpp | 20 |
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
|