diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-10-12 18:02:05 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-10-12 18:02:05 +0000 |
commit | 6773fe45457b8ef6e87efa0b5aecc0899877b247 (patch) | |
tree | 7908ff2f6eda5c31b184015c7dc5a394686232a5 /protocols/Omegle/src | |
parent | 75815d4ab9a4b54cea03a97277f4d0892f2bdb6b (diff) |
Use protocol Logging API in Omegle
git-svn-id: http://svn.miranda-ng.org/main/trunk@6458 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Omegle/src')
-rw-r--r-- | protocols/Omegle/src/chat.cpp | 2 | ||||
-rw-r--r-- | protocols/Omegle/src/common.h | 3 | ||||
-rw-r--r-- | protocols/Omegle/src/communication.cpp | 26 | ||||
-rw-r--r-- | protocols/Omegle/src/connection.cpp | 20 | ||||
-rw-r--r-- | protocols/Omegle/src/db.h | 1 | ||||
-rw-r--r-- | protocols/Omegle/src/dialogs.cpp | 3 | ||||
-rw-r--r-- | protocols/Omegle/src/events.cpp | 39 | ||||
-rw-r--r-- | protocols/Omegle/src/proto.h | 3 | ||||
-rw-r--r-- | protocols/Omegle/src/resource.h | 3 |
9 files changed, 25 insertions, 75 deletions
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index c6681c051f..39ad7925e5 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -176,7 +176,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) // Outgoing message
case STATE_ACTIVE:
- LOG("**Chat - Outgoing message: %s", text.c_str());
+ debugLogA("**Chat - Outgoing message: %s", text.c_str());
ForkThread(&OmegleProto::SendMsgWorker, new std::string(text));
break;
diff --git a/protocols/Omegle/src/common.h b/protocols/Omegle/src/common.h index ac446b59c9..25f088b66a 100644 --- a/protocols/Omegle/src/common.h +++ b/protocols/Omegle/src/common.h @@ -54,7 +54,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <m_protocols.h>
#include <m_protosvc.h>
#include <m_protoint.h>
-#include <m_protomod.h>
#include <m_skin.h>
#include <statusmodes.h>
#include <m_icolib.h>
@@ -67,8 +66,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class OmegleProto;
-#define LOG Log
-
#include "http.h"
#include "utils.h"
#include "client.h"
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index bfad43d05d..d10f335b29 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -37,7 +37,7 @@ http::response Omegle_client::flap( const int request_type, std::string* request nlhr.dataLength = (int)request_data->length( );
}
- parent->Log("@@@@@ Sending request to '%s'", nlhr.szUrl);
+ parent->debugLogA("@@@@@ Sending request to '%s'", nlhr.szUrl);
switch ( request_type )
{
@@ -78,16 +78,16 @@ http::response Omegle_client::flap( const int request_type, std::string* request if ( pnlhr != NULL )
{
- parent->Log("@@@@@ Got response with code %d", pnlhr->resultCode);
+ parent->debugLogA("@@@@@ Got response with code %d", pnlhr->resultCode);
store_headers( &resp, pnlhr->headers, pnlhr->headersCount );
resp.code = pnlhr->resultCode;
resp.data = pnlhr->pData ? pnlhr->pData : "";
- parent->Log("&&&&& Got response: %s", resp.data.c_str());
+ parent->debugLogA("&&&&& Got response: %s", resp.data.c_str());
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pnlhr);
} else {
- parent->Log("!!!!! No response from server (time-out)");
+ parent->debugLogA("!!!!! No response from server (time-out)");
resp.code = HTTP_CODE_FAKE_DISCONNECTED;
// Better to have something set explicitely as this value
// is compaired in all communication requests
@@ -98,13 +98,13 @@ http::response Omegle_client::flap( const int request_type, std::string* request bool Omegle_client::handle_entry( std::string method )
{
- parent->Log(" >> Entering %s()", method.c_str());
+ parent->debugLogA(" >> Entering %s()", method.c_str());
return true;
}
bool Omegle_client::handle_success( std::string method )
{
- parent->Log(" << Quitting %s()", method.c_str());
+ parent->debugLogA(" << Quitting %s()", method.c_str());
reset_error();
return true;
}
@@ -113,7 +113,7 @@ bool Omegle_client::handle_error( std::string method, bool force_disconnect ) {
bool result;
increment_error();
- parent->Log("!!!!! %s(): Something with Omegle went wrong", method.c_str());
+ parent->debugLogA("!!!!! %s(): Something with Omegle went wrong", method.c_str());
if ( force_disconnect )
result = false;
@@ -310,7 +310,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->debugLogA("----- Got header '%s': %s", header_name.c_str(), header_value.c_str());
resp->headers[header_name] = header_value;
}
}
@@ -322,7 +322,7 @@ bool Omegle_client::start() handle_entry( "start" );
this->server_ = get_server();
- //parent->Log("Chosing server %s", this->server_.c_str());
+ //parent->debugLogA("Chosing server %s", this->server_.c_str());
//std::string log = Translate("Chosing server: ") + this->server_;
//parent->UpdateChat(NULL, log.c_str());
@@ -374,7 +374,7 @@ bool Omegle_client::start() data += "\"" + topic + "\"";
}
- parent->Log("TOPICS: %s", data.c_str());
+ parent->debugLogA("TOPICS: %s", data.c_str());
if (!data.empty()) {
data = "[" + data + "]";
@@ -548,7 +548,7 @@ bool Omegle_client::events( ) std::string like = resp.data.substr(pos, resp.data.find("\"]", pos) - pos);
utils::text::replace_all(&like, "\", \"", ", ");
- parent->Log("Got common likes: '%s'", like.c_str());
+ parent->debugLogA("Got common likes: '%s'", like.c_str());
like = Translate("You and the Stranger both like: ") + like;
@@ -700,10 +700,10 @@ bool Omegle_client::events( ) std::string *message = new std::string(dbv.pszVal);
db_free(&dbv);
- parent->Log("**Chat - saying Hi! message");
+ parent->debugLogA("**Chat - saying Hi! message");
parent->ForkThread(&OmegleProto::SendMsgWorker, message);
}
- else parent->Log("**Chat - Hi message is enabled but not used");
+ else parent->debugLogA("**Chat - Hi message is enabled but not used");
}
}
diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp index 36deff4f6a..2e760b810e 100644 --- a/protocols/Omegle/src/connection.cpp +++ b/protocols/Omegle/src/connection.cpp @@ -26,7 +26,7 @@ void OmegleProto::SignOn(void*) {
SYSTEMTIME t;
GetLocalTime( &t );
- Log("[%d.%d.%d] Using Omegle Protocol %s", t.wDay, t.wMonth, t.wYear, __VERSION_STRING);
+ debugLogA("[%d.%d.%d] Using Omegle Protocol %s", t.wDay, t.wMonth, t.wYear, __VERSION_STRING);
ScopedLock s(signon_lock_);
@@ -80,9 +80,9 @@ void OmegleProto::StopChat(bool disconnect) UpdateChat(NULL, TranslateT("Disconnecting..."), true);
if (facy.stop())
- LOG("***** Disconnected from stranger %s", facy.chat_id_.c_str());
+ debugLogA("***** Disconnected from stranger %s", facy.chat_id_.c_str());
else
- LOG("***** Error in disconnecting from stranger %s", facy.chat_id_.c_str());
+ debugLogA("***** Error in disconnecting from stranger %s", facy.chat_id_.c_str());
}
if (spy) {
@@ -115,9 +115,9 @@ void OmegleProto::NewChat() UpdateChat(NULL, TranslateT("Disconnecting..."), true);
if (facy.stop())
- LOG("***** Disconnected from stranger %s", facy.chat_id_.c_str());
+ debugLogA("***** Disconnected from stranger %s", facy.chat_id_.c_str());
else
- LOG("***** Error in disconnecting from stranger %s", facy.chat_id_.c_str());
+ debugLogA("***** Error in disconnecting from stranger %s", facy.chat_id_.c_str());
if (facy.state_ == STATE_SPY) {
DeleteChatContact(TranslateT("Stranger 1"));
@@ -137,7 +137,7 @@ void OmegleProto::NewChat() if (facy.start())
{
UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true);
- LOG("***** Waiting for stranger %s", facy.chat_id_.c_str());
+ debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());
}
}
else if (facy.state_ == STATE_DISCONNECTING)
@@ -155,7 +155,7 @@ void OmegleProto::NewChat() if (facy.start())
{
UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true);
- LOG("***** Waiting for stranger %s", facy.chat_id_.c_str());
+ debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());
ForkThread( &OmegleProto::EventsLoop, this );
}
@@ -168,15 +168,15 @@ void OmegleProto::EventsLoop(void *) ScopedLock s(events_loop_lock_);
time_t tim = ::time(NULL);
- LOG( ">>>>> Entering Omegle::EventsLoop[%d]", tim );
+ debugLogA( ">>>>> Entering Omegle::EventsLoop[%d]", tim );
while ( facy.events())
{
if ( facy.state_ == STATE_INACTIVE || facy.state_ == STATE_DISCONNECTING || !isOnline())
break;
- LOG( "***** OmegleProto::EventsLoop[%d] refreshing...", tim );
+ debugLogA( "***** OmegleProto::EventsLoop[%d] refreshing...", tim );
}
ResetEvent(events_loop_lock_);
- LOG( "<<<<< Exiting OmegleProto::EventsLoop[%d]", tim );
+ debugLogA( "<<<<< Exiting OmegleProto::EventsLoop[%d]", tim );
}
diff --git a/protocols/Omegle/src/db.h b/protocols/Omegle/src/db.h index 2604b70c43..fc1b8d890f 100644 --- a/protocols/Omegle/src/db.h +++ b/protocols/Omegle/src/db.h @@ -39,7 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define OMEGLE_KEY_REUSE_QUESTION "ReuseQuestion"
#define OMEGLE_KEY_SERVER "Server"
#define OMEGLE_KEY_LANGUAGE "Language"
-#define OMEGLE_KEY_LOGGING "EnableLogging"
#define OMEGLE_KEY_SERVER_INFO "GetServerInfo"
#define OMEGLE_KEY_LAST_QUESTION "LastQuestion"
#define OMEGLE_KEY_AUTO_CONNECT "AutoConnect"
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index 057a43955f..b531e58b45 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -174,7 +174,6 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR LoadDBCheckState(proto, hwnd, IDC_DONTSTOP, OMEGLE_KEY_DONT_STOP);
LoadDBCheckState(proto, hwnd, IDC_REUSE_QUESTIONS, OMEGLE_KEY_REUSE_QUESTION);
LoadDBCheckState(proto, hwnd, IDC_SERVER_INFO, OMEGLE_KEY_SERVER_INFO);
- LoadDBCheckState(proto, hwnd, IDC_LOGGING, OMEGLE_KEY_LOGGING);
LoadDBCheckState(proto, hwnd, IDC_AUTO_CONNECT, OMEGLE_KEY_AUTO_CONNECT);
} return TRUE;
@@ -203,7 +202,6 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR case IDC_DONTSTOP:
case IDC_REUSE_QUESTIONS:
case IDC_SERVER_INFO:
- case IDC_LOGGING:
case IDC_AUTO_CONNECT:
if (HIWORD(wparam) == BN_CLICKED) {
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
@@ -231,7 +229,6 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR StoreDBCheckState(proto, hwnd, IDC_DONTSTOP, OMEGLE_KEY_DONT_STOP);
StoreDBCheckState(proto, hwnd, IDC_REUSE_QUESTIONS, OMEGLE_KEY_REUSE_QUESTION);
StoreDBCheckState(proto, hwnd, IDC_SERVER_INFO, OMEGLE_KEY_SERVER_INFO);
- StoreDBCheckState(proto, hwnd, IDC_LOGGING, OMEGLE_KEY_LOGGING);
StoreDBCheckState(proto, hwnd, IDC_AUTO_CONNECT, OMEGLE_KEY_AUTO_CONNECT);
return TRUE;
diff --git a/protocols/Omegle/src/events.cpp b/protocols/Omegle/src/events.cpp deleted file mode 100644 index b5f29b13ef..0000000000 --- a/protocols/Omegle/src/events.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/*
-
-Omegle plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-13 Robert Pösel
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "common.h"
-
-int OmegleProto::Log(const char *fmt,...)
-{
- if (!getByte(OMEGLE_KEY_LOGGING, 0))
- return EXIT_SUCCESS;
-
- va_list va;
- char text[65535];
- ScopedLock s(log_lock_);
-
- va_start(va,fmt);
- mir_vsnprintf(text,sizeof(text),fmt,va);
- va_end(va);
-
- return utils::debug::log( m_szModuleName, text );
-}
diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 5f376e680d..a27e8f24b9 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -141,7 +141,4 @@ public: HANDLE events_loop_lock_;
static void CALLBACK APC_callback(ULONG_PTR p);
-
- // Logging
- int Log(const char *fmt,...);
};
diff --git a/protocols/Omegle/src/resource.h b/protocols/Omegle/src/resource.h index e34fac5b93..8d59696e1c 100644 --- a/protocols/Omegle/src/resource.h +++ b/protocols/Omegle/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by D:\Development\Miranda NG\protocols\Omegle\res\omegle.rc
+// Used by ..\res\omegle.rc
//
#define IDI_OMEGLE 101
#define IDD_OmegleACCOUNT 111
@@ -18,7 +18,6 @@ #define IDC_NOCLEAR 1213
#define IDC_DONTSTOP 1214
#define IDC_REUSE_QUESTIONS 1215
-#define IDC_LOGGING 1216
#define IDC_SERVER_INFO 1217
#define IDC_AUTO_CONNECT 1219
|