From 5ac51b720b75894d9ffd25795663e85cbce0dc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 18 Oct 2013 17:50:26 +0000 Subject: XFire: utf8 fixes and remove option for that (always use it) git-svn-id: http://svn.miranda-ng.org/main/trunk@6519 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Xfire/src/main.cpp | 72 ++++++++--------------------------------- protocols/Xfire/src/options.cpp | 1 - 2 files changed, 14 insertions(+), 59 deletions(-) diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index c8970dafbc..ec05d07a2d 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -211,7 +211,6 @@ class XFireClient : public PacketListener { public: Client* client; Xfire_avatar_loader* avatarloader; - BOOL useutf8; XFireClient(string username, string password,char protover,int useproxy=0,string proxyip="",int proxyport=0); ~XFireClient(); @@ -278,12 +277,9 @@ void XFireClient::handlingBuddy(HANDLE handle){ void XFireClient::setNick(char*nnick) { /*if(strlen(nnick)==0) return;*/ - SendNickChangePacket nick; - if(this->useutf8) - nick.nick = ( char* )nnick; - else - nick.nick = mir_utf8encode(( char* )nnick); - client->send( &nick ); + SendNickChangePacket nick; + nick.nick = nnick; + client->send( &nick ); } @@ -305,7 +301,6 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { this->useproxy=useproxy; this->proxyip=proxyip; this->proxyport=proxyport; - useutf8=FALSE; avatarloader=new Xfire_avatar_loader(client); @@ -339,11 +334,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { SendStatusMessagePacket *packet = new SendStatusMessagePacket(); - if(myClient->useutf8) - packet->awaymsg = s.c_str(); - else - packet->awaymsg = mir_utf8encode(s.c_str()); - + packet->awaymsg = s.c_str(); client->send( packet ); delete packet; } @@ -728,11 +719,8 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { PROTORECVEVENT pre = { 0 }; pre.timestamp = time(NULL); - if (this->useutf8) { - pre.szMessage = (char*)str.c_str(); - pre.flags = PREF_UTF; - } - else pre.szMessage = (char*)mir_utf8decode((char*)str.c_str(),NULL); + pre.szMessage = (char*)str.c_str(); + pre.flags = PREF_UTF; CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)entry->hcontact,PROTOTYPE_CONTACTTYPING_OFF); ProtoChainRecvMsg(entry->hcontact, &pre); @@ -1392,11 +1380,7 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) if(myClient!=NULL) if(myClient->client->connected&&db_get_w(ccs->hContact, protocolname, "Status", -1)!=ID_STATUS_OFFLINE) { - /*if(myClient->useutf8) - myClient->sendmsg(dbv.pszVal, ( char* )ccs->lParam); - else*/ - myClient->sendmsg(dbv.pszVal, mir_utf8encode(( char* )ccs->lParam)); - + myClient->sendmsg(dbv.pszVal, ( char* )ccs->lParam); mir_forkthread(SendAck,ccs->hContact); sended=1; } @@ -1557,13 +1541,6 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) else */ myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0)); - //prüfe ob utf8 option aktiv, dann schlater auf true - if(db_get_b(NULL,protocolname,"useutf8",0)) - { - myClient->useutf8=TRUE; - } - - //verbindung als thread bpStatus = ID_STATUS_CONNECTING; ProtoBroadcastAck(protocolname,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)oldStatus,ID_STATUS_CONNECTING); @@ -1678,15 +1655,11 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan) db_set_b(hContact, "CList", "NotOnList", 1); db_unset(hContact, "CList", "Hidden"); - if(strlen(xfc.nick)>0) - { - if(myClient->useutf8) - db_set_utf(hContact, protocolname, "Nick", xfc.nick); - else - db_set_s(hContact, protocolname, "Nick", mir_utf8decode(( char* )xfc.nick,NULL)); - } - else if(strlen(xfc.username)>0) + if(strlen(xfc.nick)>0) { + db_set_utf(hContact, protocolname, "Nick", xfc.nick); + } else if(strlen(xfc.username)>0) { db_set_s(hContact, protocolname, "Nick", xfc.username); + } db_set_s(hContact, protocolname, "Username", xfc.username); @@ -2802,27 +2775,10 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) if (hContact!=0) { if (!entry->nick.empty() && db_get_b(NULL, protocolname, "shownicks", 1)) { - char*nick=NULL; - - if (myClient->useutf8) - nick = ( char* )entry->nick.c_str(); - else - nick = mir_utf8decode(( char* )entry->nick.c_str(),NULL); - - if(nick) - { - if(myClient->useutf8) - db_set_utf(hContact, protocolname, "Nick", nick); - else - db_set_s(hContact, protocolname, "Nick", nick); - } - else - db_set_s(hContact, protocolname, "Nick", entry->username.c_str()); - - //db_set_utf(hContact, protocolname, "Nick", entry->nick.c_str()); - //db_set_utf(hContact, protocolname, "Nick", ( char* )entry->nick.c_str()); - } else + db_set_utf(hContact, protocolname, "Nick", entry->nick.c_str()); + } else { db_set_s(hContact, protocolname, "Nick", entry->username.c_str()); + } if(!entry->isOnline()) { diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index b52d8258b6..40e0758395 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -71,7 +71,6 @@ static mytreeitem mytree[] = { {LPGENT("Don't download avatars of clan members"),"noclanavatars",0,0}, {LPGENT("Use alternate way for Avatar download"),"specialavatarload",0,0}, {LPGENT("General"),"",1,0}, - {LPGENT("Use UTF8 for messaging and nick's (beta)"),"useutf8",0,0}, {LPGENT("Automatically reconnect on protocol version changes"),"recprotoverchg",0,0}, {LPGENT("No Ip/Port in StatusMsg"),"noipportinstatus",0,0}, {LPGENT("Use Online status for unsupported global statuses"),"oninsteadafk",0,0}, -- cgit v1.2.3