From 30ab6ceb71842f003f649b3d62b89af010cf40d1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 20 Jun 2012 17:00:14 +0000 Subject: - direct call of MS_SKIN_ADDNEWSOUND replaced with Skin_AddSound() call; - obsolete structure SKINSOUNDDESC removed - dynamically translated hot keys; - checked correct LPGEN'ing of the sounds creation; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@500 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Omegle/chat.cpp | 12 ++++++------ protocols/Omegle/communication.cpp | 30 +++++++++++++++--------------- protocols/Omegle/connection.cpp | 6 +++--- protocols/Omegle/dialogs.cpp | 2 +- protocols/Omegle/main.cpp | 6 +++--- protocols/Omegle/messages.cpp | 2 +- protocols/Omegle/proto.cpp | 8 ++++---- protocols/Omegle/theme.cpp | 2 +- protocols/Omegle/utils.cpp | 18 +++++++++--------- 9 files changed, 43 insertions(+), 43 deletions(-) (limited to 'protocols/Omegle') diff --git a/protocols/Omegle/chat.cpp b/protocols/Omegle/chat.cpp index b69a41bf50..7b16ccdfc3 100644 --- a/protocols/Omegle/chat.cpp +++ b/protocols/Omegle/chat.cpp @@ -106,7 +106,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) if (params.empty()) { // Load last question DBVARIANT dbv; - if ( !getU8String( OMEGLE_KEY_LAST_QUESTION,&dbv ) ) { + if ( !getU8String( OMEGLE_KEY_LAST_QUESTION,&dbv )) { params = dbv.pszVal; DBFreeVariant(&dbv); } @@ -119,7 +119,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) // Save actual question as last question if (strlen(params.c_str()) >= OMEGLE_QUESTION_MIN_LENGTH) { - setU8String( OMEGLE_KEY_LAST_QUESTION, params.c_str() ); + setU8String( OMEGLE_KEY_LAST_QUESTION, params.c_str()); } } @@ -137,7 +137,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) else if (!stricmp(command.c_str(), "asl")) { DBVARIANT dbv; - if ( !getU8String( OMEGLE_KEY_ASL,&dbv ) ) { + if ( !getU8String( OMEGLE_KEY_ASL,&dbv )) { text = dbv.pszVal; DBFreeVariant(&dbv); } else { @@ -299,10 +299,10 @@ int OmegleProto::OnJoinChat(WPARAM,LPARAM suppress) gcd.iType = GC_EVENT_ADDGROUP; gce.ptszStatus = _T("Admin"); - CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce) ); + CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce)); gce.ptszStatus = _T("Normal"); - CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce) ); + CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast(&gce)); SetTopic(); @@ -367,7 +367,7 @@ void OmegleProto::SetChatStatus(int status) // Load actual name from database DBVARIANT dbv; - if ( !DBGetContactSettingTString(NULL, m_szModuleName, OMEGLE_KEY_NAME, &dbv) ) + if ( !DBGetContactSettingTString(NULL, m_szModuleName, OMEGLE_KEY_NAME, &dbv)) { facy.nick_ = mir_tstrdup(dbv.ptszVal); DBFreeVariant(&dbv); diff --git a/protocols/Omegle/communication.cpp b/protocols/Omegle/communication.cpp index fc3f12d5e0..4177eeae77 100644 --- a/protocols/Omegle/communication.cpp +++ b/protocols/Omegle/communication.cpp @@ -237,8 +237,8 @@ std::string Omegle_client::choose_action( int request_type, std::string* data, s std::string Omegle_client::choose_request_url( int request_type, std::string* data, std::string* get_data ) { std::string url = ""; - url.append( choose_server( request_type, data, get_data ) ); - url.append( choose_action( request_type, data, get_data ) ); + url.append( choose_server( request_type, data, get_data )); + url.append( choose_action( request_type, data, get_data )); return url; } @@ -263,7 +263,7 @@ NETLIBHTTPHEADER* Omegle_client::get_request_headers( int request_type, int* hea break; } - NETLIBHTTPHEADER* headers = ( NETLIBHTTPHEADER* )utils::mem::allocate( sizeof( NETLIBHTTPHEADER )*( *headers_count ) ); + NETLIBHTTPHEADER* headers = ( NETLIBHTTPHEADER* )utils::mem::allocate( sizeof( NETLIBHTTPHEADER )*( *headers_count )); switch ( request_type ) { @@ -300,7 +300,7 @@ void Omegle_client::store_headers( http::response* resp, NETLIBHTTPHEADER* heade std::string header_value = headers[i].szValue; // TODO RM: (un)comment - //parent->Log("----- Got header '%s': %s", header_name.c_str(), header_value.c_str() ); + //parent->Log("----- Got header '%s': %s", header_name.c_str(), header_value.c_str()); resp->headers[header_name] = header_value; } } @@ -330,7 +330,7 @@ bool Omegle_client::start() data += DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_REUSE_QUESTION, 0) ? "1" : "0"; } } - else if ( DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0) ) + else if ( DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0)) { DBVARIANT dbv; if (!DBGetContactSettingUTF8String(NULL, parent->m_szModuleName, OMEGLE_KEY_INTERESTS, &dbv)) @@ -404,7 +404,7 @@ bool Omegle_client::start() case HTTP_CODE_FAKE_DISCONNECTED: { // If is is only timeout error, try login once more - if ( handle_error( "start" ) ) + if ( handle_error( "start" )) return start(); else return false; @@ -429,7 +429,7 @@ bool Omegle_client::start() bool Omegle_client::stop( ) { - if ( parent->isOffline() ) + if ( parent->isOffline()) return true; handle_entry( "stop" ); @@ -498,7 +498,7 @@ bool Omegle_client::events( ) // We got info about count of connected people there pos += 9; - std::string count = utils::text::trim( resp.data.substr(pos, resp.data.find("]", pos) - pos) ); + std::string count = utils::text::trim( resp.data.substr(pos, resp.data.find("]", pos) - pos)); char str[255]; mir_snprintf(str, sizeof(str), Translate("On whole Omegle are %s strangers online now."), count.c_str()); @@ -543,7 +543,7 @@ bool Omegle_client::events( ) std::string question = utils::text::trim( utils::text::special_expressions_decode( utils::text::slashu_to_utf8( - resp.data.substr(pos, resp.data.find("\"]", pos) - pos) ) ) ); + resp.data.substr(pos, resp.data.find("\"]", pos) - pos) )) ); TCHAR *msg = mir_a2t_cp(question.c_str(),CP_UTF8); parent->SetTopic(msg); @@ -571,7 +571,7 @@ bool Omegle_client::events( ) std::string message = utils::text::trim( utils::text::special_expressions_decode( utils::text::slashu_to_utf8( - resp.data.substr(pos, resp.data.find("\"]", pos) - pos) ) ) ); + resp.data.substr(pos, resp.data.find("\"]", pos) - pos) )) ); if (state_ == STATE_ACTIVE) { TCHAR *msg = mir_a2t_cp(message.c_str(),CP_UTF8); @@ -592,7 +592,7 @@ bool Omegle_client::events( ) message = utils::text::trim( utils::text::special_expressions_decode( - utils::text::slashu_to_utf8( message ) ) ); + utils::text::slashu_to_utf8( message )) ); stranger = Translate(stranger.c_str()); @@ -623,7 +623,7 @@ bool Omegle_client::events( ) std::string stranger = utils::text::trim( utils::text::special_expressions_decode( utils::text::slashu_to_utf8( - resp.data.substr(pos, resp.data.find("\"]", pos) - pos) ) ) ); + resp.data.substr(pos, resp.data.find("\"]", pos) - pos) )) ); char str[255]; mir_snprintf(str, sizeof(str), Translate("%s disconnected."), Translate(stranger.c_str())); @@ -659,7 +659,7 @@ bool Omegle_client::events( ) std::string error = utils::text::trim( utils::text::special_expressions_decode( utils::text::slashu_to_utf8( - resp.data.substr(pos, resp.data.find("\"]", pos) - pos) ) ) ); + resp.data.substr(pos, resp.data.find("\"]", pos) - pos) )) ); error = Translate("Error: ") + error; @@ -670,9 +670,9 @@ bool Omegle_client::events( ) if (newStranger && state_ != STATE_SPY) { // We got new stranger in this event, lets say him "Hi message" if enabled - if ( DBGetContactSettingByte( NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0 ) ) { + if ( DBGetContactSettingByte( NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0 )) { DBVARIANT dbv; - if ( !DBGetContactSettingUTF8String( NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv ) ) { + if ( !DBGetContactSettingUTF8String( NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv )) { std::string *message = new std::string(dbv.pszVal); DBFreeVariant(&dbv); diff --git a/protocols/Omegle/connection.cpp b/protocols/Omegle/connection.cpp index f5c3b9d6b6..1ce07385d9 100644 --- a/protocols/Omegle/connection.cpp +++ b/protocols/Omegle/connection.cpp @@ -34,7 +34,7 @@ void OmegleProto::SignOn(void*) m_iStatus = m_iDesiredStatus; ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); - setDword( "LogonTS", (DWORD)time(NULL) ); + setDword( "LogonTS", (DWORD)time(NULL)); ClearChat(); OnJoinChat(0,false); @@ -167,9 +167,9 @@ void OmegleProto::EventsLoop(void *) time_t tim = ::time(NULL); LOG( ">>>>> Entering Omegle::EventsLoop[%d]", tim ); - while ( facy.events() ) + while ( facy.events()) { - if ( facy.state_ == STATE_INACTIVE || facy.state_ == STATE_DISCONNECTING || !isOnline() ) + if ( facy.state_ == STATE_INACTIVE || facy.state_ == STATE_DISCONNECTING || !isOnline()) break; LOG( "***** OmegleProto::EventsLoop[%d] refreshing...", tim ); } diff --git a/protocols/Omegle/dialogs.cpp b/protocols/Omegle/dialogs.cpp index c96f46dffa..8045ea2e43 100644 --- a/protocols/Omegle/dialogs.cpp +++ b/protocols/Omegle/dialogs.cpp @@ -39,7 +39,7 @@ static BOOL StoreDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const ch static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting) { DBVARIANT dbv; - if ( !DBGetContactSettingTString(NULL, ppro->m_szModuleName, szSetting, &dbv) ) + if ( !DBGetContactSettingTString(NULL, ppro->m_szModuleName, szSetting, &dbv)) { SetDlgItemText(hwnd, idCtrl, dbv.ptszVal); DBFreeVariant(&dbv); diff --git a/protocols/Omegle/main.cpp b/protocols/Omegle/main.cpp index aa34e0eeaf..14a5cb4426 100644 --- a/protocols/Omegle/main.cpp +++ b/protocols/Omegle/main.cpp @@ -97,7 +97,7 @@ static int protoUninit(PROTO_INTERFACE* proto) int OnModulesLoaded(WPARAM,LPARAM) { - if ( ServiceExists( MS_UPDATE_REGISTER ) ) + if ( ServiceExists( MS_UPDATE_REGISTER )) { Update upd = {sizeof(upd)}; char curr_version[30]; @@ -113,7 +113,7 @@ int OnModulesLoaded(WPARAM,LPARAM) #else upd.szBetaUpdateURL = "http://robyer.info/stahni/omegle.zip"; #endif - upd.pbVersion = reinterpret_cast(CreateVersionStringPluginEx(&pluginInfo,curr_version) ); + upd.pbVersion = reinterpret_cast(CreateVersionStringPluginEx(&pluginInfo,curr_version)); upd.cpbVersion = (int)strlen(reinterpret_cast(upd.pbVersion)); CallService(MS_UPDATE_REGISTER,0,(LPARAM)&upd); } @@ -132,7 +132,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) mir_getLP(&pluginInfo); pcli = reinterpret_cast( CallService( - MS_CLIST_RETRIEVE_INTERFACE,0,reinterpret_cast(g_hInstance)) ); + MS_CLIST_RETRIEVE_INTERFACE,0,reinterpret_cast(g_hInstance))); PROTOCOLDESCRIPTOR pd = { 0 }; pd.cbSize = sizeof(pd); diff --git a/protocols/Omegle/messages.cpp b/protocols/Omegle/messages.cpp index 7d2418f3e6..b90ff67579 100644 --- a/protocols/Omegle/messages.cpp +++ b/protocols/Omegle/messages.cpp @@ -86,7 +86,7 @@ int OmegleProto::SendMsg(HANDLE hContact, int flags, const char *msg) msg = mir_utf8encode(msg); facy.msgid_ = (facy.msgid_ % 1024)+1; - ForkThread( &OmegleProto::SendMsgWorker, this,new send_direct(hContact,msg,(HANDLE)facy.msgid_) ); + ForkThread( &OmegleProto::SendMsgWorker, this,new send_direct(hContact,msg,(HANDLE)facy.msgid_)); return facy.msgid_;*/ return 0; } diff --git a/protocols/Omegle/proto.cpp b/protocols/Omegle/proto.cpp index b91cc72f23..51e4bdf599 100644 --- a/protocols/Omegle/proto.cpp +++ b/protocols/Omegle/proto.cpp @@ -61,9 +61,9 @@ OmegleProto::OmegleProto(const char* proto_name, const TCHAR* username) facy.set_handle(m_hNetlibUser); - SkinAddNewSoundExT( "StrangerTyp", m_tszUserName, LPGENT( "Stranger typing" ) ); - SkinAddNewSoundExT( "StrangerTypStop", m_tszUserName, LPGENT( "Stranger stopped typing" ) ); - SkinAddNewSoundExT( "StrangerChange", m_tszUserName, LPGENT( "Changing stranger" ) ); + SkinAddNewSoundExT( "StrangerTyp", m_tszUserName, LPGENT( "Stranger typing" )); + SkinAddNewSoundExT( "StrangerTypStop", m_tszUserName, LPGENT( "Stranger stopped typing" )); + SkinAddNewSoundExT( "StrangerChange", m_tszUserName, LPGENT( "Changing stranger" )); } OmegleProto::~OmegleProto( ) @@ -245,7 +245,7 @@ int OmegleProto::OnContactDeleted(WPARAM wparam,LPARAM) /*bool OmegleProto::IsMyContact(HANDLE hContact, bool include_chat) { const char *proto = reinterpret_cast( CallService(MS_PROTO_GETCONTACTBASEPROTO, - reinterpret_cast(hContact),0) ); + reinterpret_cast(hContact),0)); if ( proto && strcmp(m_szModuleName,proto) == 0 ) { diff --git a/protocols/Omegle/theme.cpp b/protocols/Omegle/theme.cpp index 740d16277e..73ef80a46c 100644 --- a/protocols/Omegle/theme.cpp +++ b/protocols/Omegle/theme.cpp @@ -95,7 +95,7 @@ HANDLE GetIconHandle(const char* name) static OmegleProto * GetInstanceByHContact(HANDLE hContact) { char *proto = reinterpret_cast( CallService(MS_PROTO_GETCONTACTBASEPROTO, - reinterpret_cast(hContact),0) ); + reinterpret_cast(hContact),0)); if (!proto) return 0; diff --git a/protocols/Omegle/utils.cpp b/protocols/Omegle/utils.cpp index 975ab7df4c..f524dcfba1 100644 --- a/protocols/Omegle/utils.cpp +++ b/protocols/Omegle/utils.cpp @@ -25,7 +25,7 @@ along with this program. If not, see . std::string utils::url::encode(const std::string &s) { char *encoded = reinterpret_cast(CallService( MS_NETLIB_URLENCODE, - 0,reinterpret_cast(s.c_str()) )); + 0,reinterpret_cast(s.c_str()))); std::string ret = encoded; HeapFree(GetProcessHeap(),0,encoded); @@ -36,7 +36,7 @@ void utils::text::replace_first( std::string* data, std::string from, std::strin { std::string::size_type position = 0; - if ( ( position = data->find(from, position) ) != std::string::npos ) + if ( ( position = data->find(from, position)) != std::string::npos ) { data->replace( position, from.size(), to ); position++; @@ -47,7 +47,7 @@ void utils::text::replace_all( std::string* data, std::string from, std::string { std::string::size_type position = 0; - while ( ( position = data->find( from, position ) ) != std::string::npos ) + while ( ( position = data->find( from, position )) != std::string::npos ) { data->replace( position, from.size(), to ); position++; @@ -77,14 +77,14 @@ std::string utils::text::slashu_to_utf8( std::string data ) if ( udn >= 128 && udn <= 2047 ) { // U+0080 .. U+07FF - new_string += ( char )( 192 + ( udn / 64 ) ); - new_string += ( char )( 128 + ( udn % 64 ) ); + new_string += ( char )( 192 + ( udn / 64 )); + new_string += ( char )( 128 + ( udn % 64 )); } else if ( udn >= 2048 && udn <= 65535 ) { // U+0800 .. U+FFFF - new_string += ( char )( 224 + ( udn / 4096 ) ); - new_string += ( char )( 128 + ( ( udn / 64 ) % 64 ) ); - new_string += ( char )( 128 + ( udn % 64 ) ); + new_string += ( char )( 224 + ( udn / 4096 )); + new_string += ( char )( 128 + ( ( udn / 64 ) % 64 )); + new_string += ( char )( 128 + ( udn % 64 )); } else if ( udn <= 127 ) { // U+0000 .. U+007F (should not appear) @@ -115,7 +115,7 @@ int utils::debug::log(std::string file_name, std::string text) char szFile[MAX_PATH]; GetModuleFileNameA(g_hInstance, szFile, SIZEOF(szFile)); std::string path = szFile; - path = path.substr( 0, path.rfind( "\\" ) ); + path = path.substr( 0, path.rfind( "\\" )); path = path.substr( 0, path.rfind( "\\" ) + 1 ); path = path + file_name.c_str() + ".txt"; -- cgit v1.2.3