From 92beff959051eec8d60e4e146aa3d8a13bee9fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 28 Nov 2014 20:39:37 +0000 Subject: XFire: Reformat sources git-svn-id: http://svn.miranda-ng.org/main/trunk@11134 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Xfire/src/processbuddyinfo.cpp | 104 +++++++++++++++---------------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'protocols/Xfire/src/processbuddyinfo.cpp') diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp index 014894cf54..68a5994d34 100644 --- a/protocols/Xfire/src/processbuddyinfo.cpp +++ b/protocols/Xfire/src/processbuddyinfo.cpp @@ -16,75 +16,75 @@ extern HANDLE XFireAvatarFolder; //vom Yahoo plugin /*int avt_hash(const char *key, DWORD ksize) { - const char *p = key; - int h = *p; - long l = 1; - - if (h) - for (p += 1; l < ksize; p++, l++) - h = (h << 5) - h + *p; - - return h; +const char *p = key; +int h = *p; +long l = 1; + +if (h) +for (p += 1; l < ksize; p++, l++) +h = (h << 5) - h + *p; + +return h; }*/ -void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,MCONTACT hcontact,char* username) { +void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, char* username) { char temp[255] = ""; char filename[1024] = ""; - BOOL dl=FALSE; + BOOL dl = FALSE; int type; //versuche doppeltes laden zuvermeiden if (hcontact) //avatar von freunden { - if (db_get_dw(hcontact, "ContactPhoto", "XFireAvatarId", 0)==buddyinfo->avatarid && - db_get_b(hcontact, "ContactPhoto", "XFireAvatarMode", 0)==buddyinfo->avatarmode) + if (db_get_dw(hcontact, "ContactPhoto", "XFireAvatarId", 0) == buddyinfo->avatarid && + db_get_b(hcontact, "ContactPhoto", "XFireAvatarMode", 0) == buddyinfo->avatarmode) return; } else //eigeneder avatar { - if (db_get_dw(hcontact, protocolname, "XFireAvatarId", 0)==buddyinfo->avatarid && - db_get_b(hcontact, protocolname, "XFireAvatarMode", 0)==buddyinfo->avatarmode) + if (db_get_dw(hcontact, protocolname, "XFireAvatarId", 0) == buddyinfo->avatarid && + db_get_b(hcontact, protocolname, "XFireAvatarMode", 0) == buddyinfo->avatarmode) return; //alten dateipfad des avatars löschen, wenn sichw as geändert hat - db_unset(NULL,protocolname, "MyAvatarFile"); + db_unset(NULL, protocolname, "MyAvatarFile"); } - strcpy(filename, XFireGetFoldersPath ("Avatar")); - - switch(buddyinfo->avatarmode) { - case 1: - strcat(filename,username); - strcat(filename,".gif"); - type=PA_FORMAT_GIF; - - mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/%03d.gif", buddyinfo->avatarid); - - dl=GetWWWContent("media.xfire.com",temp,filename,FALSE); - break; - case 2: - strcat(filename,username); - strcat(filename,".jpg"); - type=PA_FORMAT_JPEG; - - mir_snprintf(temp, SIZEOF(temp), "/avatar/100/%s.jpg?%d", username, buddyinfo->avatarid); - - dl=GetWWWContent("screenshot.xfire.com",temp,filename,FALSE); - break; - case 3: - type=PA_FORMAT_GIF; - strcat(filename,"xfire.gif"); - - mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/xfire.gif", buddyinfo->avatarid); - - dl=GetWWWContent("media.xfire.com",temp,filename,TRUE); - break; - default: - return; + strcpy(filename, XFireGetFoldersPath("Avatar")); + + switch (buddyinfo->avatarmode) { + case 1: + strcat(filename, username); + strcat(filename, ".gif"); + type = PA_FORMAT_GIF; + + mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/%03d.gif", buddyinfo->avatarid); + + dl = GetWWWContent("media.xfire.com", temp, filename, FALSE); + break; + case 2: + strcat(filename, username); + strcat(filename, ".jpg"); + type = PA_FORMAT_JPEG; + + mir_snprintf(temp, SIZEOF(temp), "/avatar/100/%s.jpg?%d", username, buddyinfo->avatarid); + + dl = GetWWWContent("screenshot.xfire.com", temp, filename, FALSE); + break; + case 3: + type = PA_FORMAT_GIF; + strcat(filename, "xfire.gif"); + + mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/xfire.gif", buddyinfo->avatarid); + + dl = GetWWWContent("media.xfire.com", temp, filename, TRUE); + break; + default: + return; } - if (dl!=FALSE) + if (dl != FALSE) { if (hcontact) //buddyavatar setzen { @@ -94,17 +94,17 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,MCONTACT hcontact,cha AI.cbSize = sizeof(AI); AI.format = type; AI.hContact = hcontact; - lstrcpy(AI.filename,_A2T(filename)); - ProtoBroadcastAck(protocolname, hcontact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS,(HANDLE) &AI, 0); + lstrcpy(AI.filename, _A2T(filename)); + ProtoBroadcastAck(protocolname, hcontact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&AI, 0); } else //eigenen avatar setzen { db_set_dw(NULL, protocolname, "XFireAvatarId", buddyinfo->avatarid); db_set_b(NULL, protocolname, "XFireAvatarMode", buddyinfo->avatarmode); //neuen avatarfilepath eintragen - db_set_s(NULL,protocolname, "MyAvatarFile",filename); + db_set_s(NULL, protocolname, "MyAvatarFile", filename); //beshceid geben, avatar hat sich geändert - CallService(MS_AV_REPORTMYAVATARCHANGED,(WPARAM)protocolname,0); + CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)protocolname, 0); } } } \ No newline at end of file -- cgit v1.2.3