summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-10-20 10:13:30 +0000
committerRobert Pösel <robyer@seznam.cz>2015-10-20 10:13:30 +0000
commitbdbdf8d3391d2da3df0d4eeabac41fa73aa821fa (patch)
tree366121a22bc6eef039eacb0aafff85c03e4dd605 /protocols
parentd49489f3467a02953b77cd5869bec5c061b63aa1 (diff)
Omegle: Format sources
git-svn-id: http://svn.miranda-ng.org/main/trunk@15579 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Omegle/src/chat.cpp148
-rw-r--r--protocols/Omegle/src/client.h10
-rw-r--r--protocols/Omegle/src/communication.cpp325
-rw-r--r--protocols/Omegle/src/connection.cpp49
-rw-r--r--protocols/Omegle/src/constants.h146
-rw-r--r--protocols/Omegle/src/dialogs.cpp137
-rw-r--r--protocols/Omegle/src/dialogs.h4
-rw-r--r--protocols/Omegle/src/main.cpp28
-rw-r--r--protocols/Omegle/src/messages.cpp8
-rw-r--r--protocols/Omegle/src/proto.cpp2
-rw-r--r--protocols/Omegle/src/proto.h42
-rw-r--r--protocols/Omegle/src/stdafx.h4
-rw-r--r--protocols/Omegle/src/theme.cpp4
13 files changed, 462 insertions, 445 deletions
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index 2bd16d8d14..1bd515667e 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -40,25 +40,25 @@ void OmegleProto::UpdateChat(const TCHAR *name, const TCHAR *message, bool addto
else gce.bIsMe = !mir_tstrcmp(name, this->facy.nick_);
if (addtolog)
- gce.dwFlags |= GCEF_ADDTOLOG;
+ gce.dwFlags |= GCEF_ADDTOLOG;
gce.ptszNick = name;
- gce.ptszUID = gce.ptszNick;
- CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
+ gce.ptszUID = gce.ptszNick;
+ CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
{
GCHOOK *hook = reinterpret_cast<GCHOOK*>(lParam);
- if(mir_strcmp(hook->pDest->pszModule,m_szModuleName))
+ if (mir_strcmp(hook->pDest->pszModule, m_szModuleName))
return 0;
- switch(hook->pDest->iType)
+ switch (hook->pDest->iType)
{
case GC_USER_MESSAGE:
- {
- std::string text = mir_t2a_cp(hook->ptszText,CP_UTF8);
+ {
+ std::string text = mir_t2a_cp(hook->ptszText, CP_UTF8);
// replace %% back to %, because chat automatically does this to sent messages
utils::text::replace_all(&text, "%%", "%");
@@ -66,17 +66,18 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
if (text.empty())
break;
- if (text.substr(0,1) == "/")
+ if (text.substr(0, 1) == "/")
{ // Process commands
-
+
std::string command = "";
- std::string params = "";
+ std::string params = "";
std::string::size_type pos = 0;
if ((pos = text.find(" ")) != std::string::npos) {
- command = text.substr(1, pos-1);
- params = text.substr(pos+1);
- } else {
+ command = text.substr(1, pos - 1);
+ params = text.substr(pos + 1);
+ }
+ else {
command = text.substr(1);
}
@@ -97,29 +98,30 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
{
facy.spy_mode_ = true;
facy.question_.clear();
-
+
ForkThread(&OmegleProto::NewChatWorker, NULL);
break;
}
else if (!mir_strcmpi(command.c_str(), "ask"))
- {
+ {
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;
db_free(&dbv);
}
-
+
if (params.empty()) {
UpdateChat(NULL, TranslateT("Last question is empty."), false);
break;
}
- } else {
+ }
+ else {
// Save actual question as last question
if (params.length() >= OMEGLE_QUESTION_MIN_LENGTH)
{
- setU8String( OMEGLE_KEY_LAST_QUESTION, params.c_str());
+ setU8String(OMEGLE_KEY_LAST_QUESTION, params.c_str());
}
}
@@ -137,12 +139,13 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
else if (!mir_strcmpi(command.c_str(), "asl"))
{
DBVARIANT dbv;
- if ( !getU8String( OMEGLE_KEY_ASL,&dbv )) {
+ if (!getU8String(OMEGLE_KEY_ASL, &dbv)) {
text = dbv.pszVal;
db_free(&dbv);
SendChatMessage(text);
- } else {
+ }
+ else {
UpdateChat(NULL, TranslateT("Your '/asl' setting is empty."), false);
break;
}
@@ -150,22 +153,22 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
else if (!mir_strcmpi(command.c_str(), "help"))
{
UpdateChat(NULL, TranslateT("There are three different modes of chatting:\
-\n1) Standard mode\t - You chat with random stranger privately\
-\n2) Question mode\t - You ask two strangers a question and see how they discuss it (you can't join their conversation, only watch)\
-\n3) Spy mode\t - You and stranger got a question to discuss from third stranger (he can't join your conversation, only watch)\
-\n\nSend '/commands' for available commands."), false);
+ \n1) Standard mode\t - You chat with random stranger privately\
+ \n2) Question mode\t - You ask two strangers a question and see how they discuss it (you can't join their conversation, only watch)\
+ \n3) Spy mode\t - You and stranger got a question to discuss from third stranger (he can't join your conversation, only watch)\
+ \n\nSend '/commands' for available commands."), false);
}
else if (!mir_strcmpi(command.c_str(), "commands"))
{
UpdateChat(NULL, TranslateT("You can use different commands:\
-\n/help\t - show info about chat modes\
-\n/new\t - start standard mode\
-\n/ask <question> - start question mode with your question\
-\n/ask\t - start question mode with your last asked question\
-\n/spy\t - start spy mode\
-\n/quit\t - disconnect from stranger or stop connecting\
-\n/asl\t - send your predefined ASL message\
-\n\nNote: You can reconnect to different stranger without disconnecting from current one."), false);
+ \n/help\t - show info about chat modes\
+ \n/new\t - start standard mode\
+ \n/ask <question> - start question mode with your question\
+ \n/ask\t - start question mode with your last asked question\
+ \n/spy\t - start spy mode\
+ \n/quit\t - disconnect from stranger or stop connecting\
+ \n/asl\t - send your predefined ASL message\
+ \n\nNote: You can reconnect to different stranger without disconnecting from current one."), false);
break;
}
else
@@ -174,11 +177,12 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
break;
}
- } else {
+ }
+ else {
// Outgoing message
SendChatMessage(text);
}
-
+
break;
}
@@ -208,8 +212,8 @@ void OmegleProto::SendChatMessage(std::string text)
UpdateChat(NULL, TranslateT("You can't send messages in question mode."), false);
break;
- //case STATE_WAITING:
- //case STATE_DISCONNECTING:
+ //case STATE_WAITING:
+ //case STATE_DISCONNECTING:
default:
break;
}
@@ -217,13 +221,13 @@ void OmegleProto::SendChatMessage(std::string text)
/*void OmegleProto::SendChatEvent(int type)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT,WINDOW_CLEARLOG,reinterpret_cast<LPARAM>(&gce));
+GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
+GCEVENT gce = { sizeof(gce), &gcd };
+CallServiceSync(MS_GC_EVENT,WINDOW_CLEARLOG,reinterpret_cast<LPARAM>(&gce));
}*/
void OmegleProto::AddChatContact(const TCHAR *name)
-{
+{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = DWORD(time(0));
@@ -233,7 +237,7 @@ void OmegleProto::AddChatContact(const TCHAR *name)
if (name == NULL)
gce.bIsMe = false;
- else
+ else
gce.bIsMe = mir_tstrcmp(name, this->facy.nick_);
if (gce.bIsMe)
@@ -241,7 +245,7 @@ void OmegleProto::AddChatContact(const TCHAR *name)
else
gce.ptszStatus = _T("Normal");
- CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
+ CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
void OmegleProto::DeleteChatContact(const TCHAR *name)
@@ -254,37 +258,37 @@ void OmegleProto::DeleteChatContact(const TCHAR *name)
gce.time = DWORD(time(0));
if (name == NULL)
gce.bIsMe = false;
- else
+ else
gce.bIsMe = mir_tstrcmp(name, this->facy.nick_);
- CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
+ CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
-INT_PTR OmegleProto::OnJoinChat(WPARAM,LPARAM suppress)
-{
+INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
+{
// Create the group chat session
- GCSESSION gcw = {sizeof(gcw)};
+ GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_PRIVMESS;
gcw.ptszID = m_tszUserName;
gcw.ptszName = m_tszUserName;
gcw.pszModule = m_szModuleName;
CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
- if(m_iStatus == ID_STATUS_OFFLINE)
+ if (m_iStatus == ID_STATUS_OFFLINE)
return 0;
// Create a group
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
-
+
gce.ptszStatus = _T("Admin");
- CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
-
+ CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+
gce.ptszStatus = _T("Normal");
- CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
SetTopic();
-
+
// Note: Initialization will finish up in SetChatStatus, called separately
if (!suppress)
SetChatStatus(m_iStatus);
@@ -293,7 +297,7 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM,LPARAM suppress)
}
void OmegleProto::SetTopic(const TCHAR *topic)
-{
+{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
@@ -303,17 +307,17 @@ void OmegleProto::SetTopic(const TCHAR *topic)
else
gce.ptszText = topic;
- CallServiceSync(MS_GC_EVENT,0, reinterpret_cast<LPARAM>(&gce));
+ CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
-INT_PTR OmegleProto::OnLeaveChat(WPARAM,LPARAM)
+INT_PTR OmegleProto::OnLeaveChat(WPARAM, LPARAM)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
- CallServiceSync(MS_GC_EVENT,SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT,SESSION_TERMINATE,reinterpret_cast<LPARAM>(&gce));
+ CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
+ CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast<LPARAM>(&gce));
return 0;
}
@@ -323,9 +327,9 @@ void OmegleProto::SetChatStatus(int status)
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
-
- if(status == ID_STATUS_ONLINE)
- {
+
+ if (status == ID_STATUS_ONLINE)
+ {
// Load actual name from database
facy.nick_ = db_get_tsa(NULL, m_szModuleName, OMEGLE_KEY_NAME);
if (facy.nick_ == NULL) {
@@ -336,12 +340,12 @@ void OmegleProto::SetChatStatus(int status)
// Add self contact
AddChatContact(facy.nick_);
- CallServiceSync(MS_GC_EVENT,SESSION_INITDONE,reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT,SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce));
+ CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, reinterpret_cast<LPARAM>(&gce));
+ CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce));
}
else
{
- CallServiceSync(MS_GC_EVENT,SESSION_OFFLINE,reinterpret_cast<LPARAM>(&gce));
+ CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
}
}
@@ -361,17 +365,17 @@ MCONTACT OmegleProto::GetChatHandle()
/*if (facy.chatHandle_ != NULL)
return facy.chatHandle_;
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) > 0) {
- ptrA id = db_get_sa(hContact, m_szModuleName, "ChatRoomId");
- if (id != NULL && !mir_strcmp(id, m_szModuleName))
- return hContact;
+ ptrA id = db_get_sa(hContact, m_szModuleName, "ChatRoomId");
+ if (id != NULL && !mir_strcmp(id, m_szModuleName))
+ return hContact;
+ }
}
- }
- return NULL;*/
+ return NULL;*/
- GC_INFO gci = {0};
+ GC_INFO gci = { 0 };
gci.Flags = GCF_HCONTACT;
gci.pszModule = m_szModuleName;
gci.pszID = m_tszUserName;
diff --git a/protocols/Omegle/src/client.h b/protocols/Omegle/src/client.h
index b33c05350c..5847877133 100644
--- a/protocols/Omegle/src/client.h
+++ b/protocols/Omegle/src/client.h
@@ -70,7 +70,7 @@ public:
HANDLE send_message_lock_;
//int msgid_;
-
+
// State of client
int state_;
bool typing_;
@@ -78,7 +78,7 @@ public:
// Data storage
void store_headers(http::response *resp, NETLIBHTTPHEADER *headers, int headers_count);
-
+
std::string get_server(bool not_last = false);
std::string get_language();
@@ -90,8 +90,8 @@ public:
bool handle_error(const std::string &method, bool force_disconnect = false);
void __inline increment_error() { error_count_++; }
- void __inline decrement_error() { if ( error_count_ > 0 ) error_count_--; }
- void __inline reset_error() { error_count_ = 0; }
+ void __inline decrement_error() { if (error_count_ > 0) error_count_--; }
+ void __inline reset_error() { error_count_ = 0; }
bool start();
bool stop();
@@ -102,7 +102,7 @@ public:
bool recaptcha();
std::string get_page(int);
-
+
bool send_message(const std::string &message_text);
// HTTP communication
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp
index 3170b934c0..149d2ad413 100644
--- a/protocols/Omegle/src/communication.cpp
+++ b/protocols/Omegle/src/communication.cpp
@@ -84,7 +84,7 @@ http::response Omegle_client::flap(const int request_type, std::string *post_dat
mir_free(nlhr.headers);
// Remember the persistent connection handle (or not)
- switch ( request_type )
+ switch (request_type)
{
case OMEGLE_REQUEST_HOME:
break;
@@ -110,7 +110,8 @@ http::response Omegle_client::flap(const int request_type, std::string *post_dat
parent->debugLogA("&&&&& Got response: %s", resp.data.c_str());
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pnlhr);
- } else {
+ }
+ else {
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
@@ -119,33 +120,33 @@ http::response Omegle_client::flap(const int request_type, std::string *post_dat
return resp;
}
-bool Omegle_client::handle_entry(const std::string &method )
+bool Omegle_client::handle_entry(const std::string &method)
{
parent->debugLogA(" >> Entering %s()", method.c_str());
return true;
}
-bool Omegle_client::handle_success(const std::string &method )
+bool Omegle_client::handle_success(const std::string &method)
{
parent->debugLogA(" << Quitting %s()", method.c_str());
reset_error();
return true;
}
-bool Omegle_client::handle_error(const std::string &method, bool force_disconnect )
+bool Omegle_client::handle_error(const std::string &method, bool force_disconnect)
{
bool result;
increment_error();
parent->debugLogA("!!!!! %s(): Something with Omegle went wrong", method.c_str());
- if ( force_disconnect )
+ if (force_disconnect)
result = false;
- else if ( error_count_ <= (UINT)db_get_b(NULL,parent->m_szModuleName,OMEGLE_KEY_TIMEOUTS_LIMIT,OMEGLE_TIMEOUTS_LIMIT))
+ else if (error_count_ <= (UINT)db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_TIMEOUTS_LIMIT, OMEGLE_TIMEOUTS_LIMIT))
result = true;
else
result = false;
- if ( result == false )
+ if (result == false)
{
reset_error();
parent->UpdateChat(NULL, TranslateT("Connection error."));
@@ -157,17 +158,17 @@ bool Omegle_client::handle_error(const std::string &method, bool force_disconnec
//////////////////////////////////////////////////////////////////////////////
-std::string Omegle_client::get_server( bool not_last )
+std::string Omegle_client::get_server(bool not_last)
{
- int q = not_last ? 1 : 0;
+ int q = not_last ? 1 : 0;
int server = db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
- if (server < 0 || server >= (int)(_countof(servers)-q))
+ if (server < 0 || server >= (int)(_countof(servers) - q))
server = 0;
if (server == 0) {
srand(::time(NULL));
- server = (rand() % (_countof(servers)-1-q))+1;
+ server = (rand() % (_countof(servers) - 1 - q)) + 1;
}
return servers[server];
@@ -184,39 +185,39 @@ std::string Omegle_client::get_language()
std::string Omegle_client::choose_server(int request_type)
{
- switch ( request_type )
+ switch (request_type)
{
case OMEGLE_REQUEST_HOME:
return OMEGLE_SERVER_REGULAR;
-
-/* case OMEGLE_REQUEST_START:
- case OMEGLE_REQUEST_STOP:
- case OMEGLE_REQUEST_SEND:
- case OMEGLE_REQUEST_EVENTS:
- case OMEGLE_REQUEST_TYPING_START:
- case OMEGLE_REQUEST_TYPING_STOP:
- case OMEGLE_REQUEST_RECAPTCHA:
- case OMEGLE_REQUEST_COUNT:
-*/ default:
- std::string server = OMEGLE_SERVER_CHAT;
- utils::text::replace_first( &server, "%s", this->server_ );
- return server;
+
+ /* case OMEGLE_REQUEST_START:
+ case OMEGLE_REQUEST_STOP:
+ case OMEGLE_REQUEST_SEND:
+ case OMEGLE_REQUEST_EVENTS:
+ case OMEGLE_REQUEST_TYPING_START:
+ case OMEGLE_REQUEST_TYPING_STOP:
+ case OMEGLE_REQUEST_RECAPTCHA:
+ case OMEGLE_REQUEST_COUNT:
+ */ default:
+ std::string server = OMEGLE_SERVER_CHAT;
+ utils::text::replace_first(&server, "%s", this->server_);
+ return server;
}
}
std::string Omegle_client::choose_action(int request_type, std::string* get_data)
{
- switch ( request_type )
+ switch (request_type)
{
case OMEGLE_REQUEST_START:
- {
- std::string action = "/start?rcs=1&spid=&lang=";
- action += get_language();
- if (get_data != NULL)
- action += (*get_data);
+ {
+ std::string action = "/start?rcs=1&spid=&lang=";
+ action += get_language();
+ if (get_data != NULL)
+ action += (*get_data);
- return action;
- }
+ return action;
+ }
case OMEGLE_REQUEST_STOP:
return "/disconnect";
@@ -239,16 +240,16 @@ std::string Omegle_client::choose_action(int request_type, std::string* get_data
case OMEGLE_REQUEST_COUNT:
return "/count";
- // "/stoplookingforcommonlikes"
+ // "/stoplookingforcommonlikes"
-/* case OMEGLE_REQUEST_HOME:
-*/ default:
- return "/";
+ /* case OMEGLE_REQUEST_HOME:
+ */ default:
+ return "/";
}
}
-NETLIBHTTPHEADER* Omegle_client::get_request_headers( int request_type, int* headers_count )
+NETLIBHTTPHEADER* Omegle_client::get_request_headers(int request_type, int* headers_count)
{
if (request_type == REQUEST_POST)
*headers_count = 4;
@@ -272,9 +273,9 @@ NETLIBHTTPHEADER* Omegle_client::get_request_headers( int request_type, int* hea
return headers;
}
-void Omegle_client::store_headers( http::response* resp, NETLIBHTTPHEADER* headers, int headersCount )
+void Omegle_client::store_headers(http::response* resp, NETLIBHTTPHEADER* headers, int headersCount)
{
- for ( size_t i = 0; i < (size_t)headersCount; i++ )
+ for (size_t i = 0; i < (size_t)headersCount; i++)
{
std::string header_name = headers[i].szName;
std::string header_value = headers[i].szValue;
@@ -289,7 +290,7 @@ void Omegle_client::store_headers( http::response* resp, NETLIBHTTPHEADER* heade
bool Omegle_client::start()
{
- handle_entry( "start" );
+ handle_entry("start");
this->server_ = get_server();
//parent->debugLogA("Chosing server %s", this->server_.c_str());
@@ -304,20 +305,21 @@ bool Omegle_client::start()
if (this->question_.empty()) {
data = "&wantsspy=1";
- } else {
+ }
+ else {
data = "&ask=" + utils::url::encode(this->question_);
data += "&cansavequestion=";
data += db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_REUSE_QUESTION, 0) ? "1" : "0";
}
}
- else if ( db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0))
+ else if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0))
{
DBVARIANT dbv;
if (!db_get_utf(NULL, parent->m_szModuleName, OMEGLE_KEY_INTERESTS, &dbv))
{
std::string topics = dbv.pszVal;
std::string topic;
-
+
db_free(&dbv);
std::string::size_type pos = 0;
@@ -335,13 +337,13 @@ bool Omegle_client::start()
pos = pos2 + 1;
}
-
+
topic = topics.substr(pos);
topic = utils::text::trim(topic);
- if (!topic.empty()) {
+ if (!topic.empty()) {
if (pos > 0)
data += ",";
- data += "\"" + topic + "\"";
+ data += "\"" + topic + "\"";
}
parent->debugLogA("TOPICS: %s", data.c_str());
@@ -358,7 +360,7 @@ bool Omegle_client::start()
if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER_INFO, 0))
{
- std::string count = get_page( OMEGLE_REQUEST_COUNT );
+ std::string count = get_page(OMEGLE_REQUEST_COUNT);
if (!count.empty()) {
char str[255];
mir_snprintf(str, Translate("Connected to server %s. There are %s users online now."), server_.c_str(), count.c_str());
@@ -367,7 +369,8 @@ bool Omegle_client::start()
parent->UpdateChat(NULL, msg);
mir_free(msg);
}
- } else {
+ }
+ else {
char str[255];
mir_snprintf(str, Translate("Connected to server %s."), server_.c_str());
@@ -377,46 +380,47 @@ bool Omegle_client::start()
}
// Send validation
- http::response resp = flap( OMEGLE_REQUEST_START, NULL, &data );
+ http::response resp = flap(OMEGLE_REQUEST_START, NULL, &data);
- switch ( resp.code )
+ switch (resp.code)
{
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;
}
case HTTP_CODE_OK:
- {
+ {
if (!resp.data.empty()) {
- this->chat_id_ = resp.data.substr(1,resp.data.length()-2);
+ this->chat_id_ = resp.data.substr(1, resp.data.length() - 2);
this->state_ = STATE_WAITING;
- return handle_success( "start" );
- } else {
- return handle_error( "start", FORCE_DISCONNECT );
+ return handle_success("start");
+ }
+ else {
+ return handle_error("start", FORCE_DISCONNECT);
}
}
default:
- return handle_error( "start", FORCE_DISCONNECT );
+ return handle_error("start", FORCE_DISCONNECT);
}
}
bool Omegle_client::stop()
{
- if ( parent->isOffline())
+ if (parent->isOffline())
return true;
- handle_entry( "stop" );
+ handle_entry("stop");
std::string data = "id=" + this->chat_id_;
- http::response resp = flap( OMEGLE_REQUEST_STOP, &data );
+ http::response resp = flap(OMEGLE_REQUEST_STOP, &data);
if (hConnection)
Netlib_CloseHandle(hConnection);
@@ -427,49 +431,51 @@ bool Omegle_client::stop()
hEventsConnection = NULL;
if (resp.data == "win") {
- return handle_success( "stop" );
- } else {
- return handle_error( "stop" );
+ return handle_success("stop");
+ }
+ else {
+ return handle_error("stop");
}
-/* switch ( resp.code )
- {
- case HTTP_CODE_OK:
- case HTTP_CODE_FOUND:
+ /* switch ( resp.code )
+ {
+ case HTTP_CODE_OK:
+ case HTTP_CODE_FOUND:
- default:
-
- }*/
+ default:
+
+ }*/
}
bool Omegle_client::events()
{
- handle_entry( "events" );
+ handle_entry("events");
std::string data = "id=" + this->chat_id_;
// Get update
- http::response resp = flap( OMEGLE_REQUEST_EVENTS, &data );
+ http::response resp = flap(OMEGLE_REQUEST_EVENTS, &data);
// Return
- switch ( resp.code )
+ switch (resp.code)
{
case HTTP_CODE_OK:
{
- if ( resp.data == "null" ) {
+ if (resp.data == "null") {
// Everything is OK, no new message received -- OR it is a problem
// TODO: if we are waiting for Stranger with common likes, then we should try standard Stranger if this takes too long
- return handle_error( "events" );
- } else if ( resp.data == "fail" ) {
+ return handle_error("events");
+ }
+ else if (resp.data == "fail") {
// Something went wrong
- return handle_error( "events" );
+ return handle_error("events");
}
-
+
std::string::size_type pos = 0;
bool newStranger = false;
bool waiting = false;
-
- if ( resp.data.find( "[\"waiting\"]" ) != std::string::npos ) {
+
+ if (resp.data.find("[\"waiting\"]") != std::string::npos) {
// We are just waiting for new Stranger
waiting = true;
}
@@ -482,29 +488,30 @@ bool Omegle_client::events()
char str[255];
mir_snprintf(str, Translate("On whole Omegle are %s strangers online now."), count.c_str());
-
+
TCHAR *msg = mir_a2t_cp(str,CP_UTF8);
parent->UpdateChat(NULL, msg);
mir_free(msg);
- }*/
+ }*/
- if ( (pos = resp.data.find( "[\"serverMessage\"," )) != std::string::npos ) {
+ if ((pos = resp.data.find("[\"serverMessage\",")) != std::string::npos) {
// We got server message
pos += 18;
- std::string message = utils::text::trim( resp.data.substr(pos, resp.data.find("\"]", pos) - pos));
+ std::string message = utils::text::trim(resp.data.substr(pos, resp.data.find("\"]", pos) - pos));
TCHAR *tstr = Langpack_PcharToTchar(message.c_str());
parent->UpdateChat(NULL, tstr);
mir_free(tstr);
}
- if ( resp.data.find( "[\"connected\"]" ) != std::string::npos ) {
+ if (resp.data.find("[\"connected\"]") != std::string::npos) {
// Stranger connected
if (this->spy_mode_ && !this->question_.empty()) {
parent->AddChatContact(TranslateT("Stranger 1"));
parent->AddChatContact(TranslateT("Stranger 2"));
this->state_ = STATE_SPY;
- } else {
+ }
+ else {
parent->AddChatContact(TranslateT("Stranger"));
this->state_ = STATE_ACTIVE;
}
@@ -513,7 +520,7 @@ bool Omegle_client::events()
waiting = false;
}
- if ( (pos = resp.data.find( "[\"commonLikes\"," )) != std::string::npos ) {
+ if ((pos = resp.data.find("[\"commonLikes\",")) != std::string::npos) {
pos += 17;
std::string like = resp.data.substr(pos, resp.data.find("\"]", pos) - pos);
utils::text::replace_all(&like, "\", \"", ", ");
@@ -527,26 +534,26 @@ bool Omegle_client::events()
mir_free(msg);
}
- if ( (pos = resp.data.find( "[\"question\"," )) != std::string::npos ) {
+ if ((pos = resp.data.find("[\"question\",")) != std::string::npos) {
pos += 13;
std::string question = utils::text::trim(
utils::text::html_entities_decode(
- utils::text::slashu_to_utf8(
- resp.data.substr(pos, resp.data.find("\"]", pos) - pos) )) );
+ utils::text::slashu_to_utf8(
+ resp.data.substr(pos, resp.data.find("\"]", pos) - pos))));
- TCHAR *msg = mir_a2t_cp(question.c_str(),CP_UTF8);
+ TCHAR *msg = mir_a2t_cp(question.c_str(), CP_UTF8);
parent->SetTopic(msg);
mir_free(msg);
}
- if ( resp.data.find( "[\"typing\"]" ) != std::string::npos
- || resp.data.find( "[\"spyTyping\"," ) != std::string::npos )
+ if (resp.data.find("[\"typing\"]") != std::string::npos
+ || resp.data.find("[\"spyTyping\",") != std::string::npos)
{
// Stranger is typing, not supported by chat module yet
- SkinPlaySound( "StrangerTyp" );
-
-
+ SkinPlaySound("StrangerTyp");
+
+
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
// st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on")); // TODO: typing icon
@@ -556,12 +563,12 @@ bool Omegle_client::events()
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st);
}
- if ( resp.data.find( "[\"stoppedTyping\"]" ) != std::string::npos
- || resp.data.find( "[\"spyStoppedTyping\"," ) != std::string::npos )
+ if (resp.data.find("[\"stoppedTyping\"]") != std::string::npos
+ || resp.data.find("[\"spyStoppedTyping\",") != std::string::npos)
{
// Stranger stopped typing, not supported by chat module yet
- SkinPlaySound( "StrangerTypStop" );
-
+ SkinPlaySound("StrangerTypStop");
+
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
// st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off")); // TODO: typing icon
@@ -572,7 +579,7 @@ bool Omegle_client::events()
}
pos = 0;
- while ( (pos = resp.data.find( "[\"gotMessage\",", pos )) != std::string::npos ) {
+ while ((pos = resp.data.find("[\"gotMessage\",", pos)) != std::string::npos) {
// Play sound as we received message
SkinPlaySound("StrangerMessage");
@@ -580,11 +587,11 @@ bool Omegle_client::events()
std::string message = utils::text::trim(
utils::text::html_entities_decode(
- utils::text::slashu_to_utf8(
- resp.data.substr(pos, resp.data.find("\"]", pos) - pos) )) );
-
+ utils::text::slashu_to_utf8(
+ resp.data.substr(pos, resp.data.find("\"]", pos) - pos))));
+
if (state_ == STATE_ACTIVE) {
- TCHAR *msg = mir_a2t_cp(message.c_str(),CP_UTF8);
+ TCHAR *msg = mir_a2t_cp(message.c_str(), CP_UTF8);
parent->UpdateChat(TranslateT("Stranger"), msg);
mir_free(msg);
}
@@ -593,25 +600,25 @@ bool Omegle_client::events()
}
pos = 0;
- while ( (pos = resp.data.find( "[\"spyMessage\",", pos )) != std::string::npos ) {
+ while ((pos = resp.data.find("[\"spyMessage\",", pos)) != std::string::npos) {
// Play sound as we received message
SkinPlaySound("StrangerMessage");
pos += 15;
std::string message = resp.data.substr(pos, resp.data.find("\"]", pos) - pos);
-
+
if (state_ == STATE_SPY) {
std::string stranger = message.substr(0, message.find("\""));
message = message.substr(stranger.length() + 4);
message = utils::text::trim(
- utils::text::html_entities_decode(
- utils::text::slashu_to_utf8( message )) );
-
+ utils::text::html_entities_decode(
+ utils::text::slashu_to_utf8(message)));
+
stranger = Translate(stranger.c_str());
-
- TCHAR *str = mir_a2t_cp(stranger.c_str(), CP_UTF8);
+
+ TCHAR *str = mir_a2t_cp(stranger.c_str(), CP_UTF8);
TCHAR *msg = mir_a2t_cp(message.c_str(), CP_UTF8);
parent->UpdateChat(str, msg);
@@ -621,30 +628,30 @@ bool Omegle_client::events()
}
}
- if ( resp.data.find( "[\"strangerDisconnected\"]" ) != std::string::npos ) {
+ if (resp.data.find("[\"strangerDisconnected\"]") != std::string::npos) {
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL);
// Stranger disconnected
if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
{
- SkinPlaySound( "StrangerChange" );
+ SkinPlaySound("StrangerChange");
parent->NewChat();
}
- else
+ else
parent->StopChat(false);
}
- if ( (pos = resp.data.find( "[\"spyDisconnected\"," )) != std::string::npos ) {
+ if ((pos = resp.data.find("[\"spyDisconnected\",")) != std::string::npos) {
pos += 20;
std::string stranger = utils::text::trim(
utils::text::html_entities_decode(
- utils::text::slashu_to_utf8(
- resp.data.substr(pos, resp.data.find("\"]", pos) - pos) )) );
+ utils::text::slashu_to_utf8(
+ resp.data.substr(pos, resp.data.find("\"]", pos) - pos))));
char str[255];
mir_snprintf(str, Translate("%s disconnected."), Translate(stranger.c_str()));
-
+
TCHAR *msg = mir_a2t(str);
parent->UpdateChat(NULL, msg);
mir_free(msg);
@@ -652,31 +659,31 @@ bool Omegle_client::events()
// Stranger disconnected
if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
{
- SkinPlaySound( "StrangerChange" );
+ SkinPlaySound("StrangerChange");
parent->NewChat();
}
else
parent->StopChat(false);
}
- if ( resp.data.find( "[\"recaptchaRequired\"" ) != std::string::npos ) {
+ if (resp.data.find("[\"recaptchaRequired\"") != std::string::npos) {
// Nothing to do with recaptcha
parent->UpdateChat(NULL, TranslateT("Recaptcha is required.\nOpen http://omegle.com , solve Recaptcha and try again."));
parent->StopChat(false);
}
- if ( resp.data.find( "[\"recaptchaRejected\"]" ) != std::string::npos ) {
+ if (resp.data.find("[\"recaptchaRejected\"]") != std::string::npos) {
// Nothing to do with recaptcha
parent->StopChat(false);
}
- if ( (pos = resp.data.find( "[\"error\"," )) != std::string::npos ) {
+ if ((pos = resp.data.find("[\"error\",")) != std::string::npos) {
pos += 10;
std::string error = utils::text::trim(
utils::text::html_entities_decode(
- utils::text::slashu_to_utf8(
- resp.data.substr(pos, resp.data.find("\"]", pos) - pos) )) );
+ utils::text::slashu_to_utf8(
+ resp.data.substr(pos, resp.data.find("\"]", pos) - pos))));
error = Translate("Error: ") + error;
@@ -684,19 +691,19 @@ bool Omegle_client::events()
parent->UpdateChat(NULL, msg);
mir_free(msg);
}
-
+
if (newStranger && state_ != STATE_SPY) {
// We got new stranger in this event, lets say him "Hi message" if enabled
- if ( db_get_b( NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0 )) {
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0)) {
DBVARIANT dbv;
- if ( !db_get_utf( NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv )) {
+ if (!db_get_utf(NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv)) {
std::vector<std::string> messages;
utils::text::explode(std::string(dbv.pszVal), "\r\n", &messages);
db_free(&dbv);
int pos = rand() % messages.size();
std::string *message = new std::string(messages.at(pos));
-
+
parent->debugLogA("**Chat - saying Hi! message");
parent->ForkThread(&OmegleProto::SendMsgWorker, message);
}
@@ -709,83 +716,83 @@ bool Omegle_client::events()
parent->UpdateChat(NULL, TranslateT("We are still waiting..."));
}
- return handle_success( "events" );
+ return handle_success("events");
}
case HTTP_CODE_FAKE_DISCONNECTED:
// timeout
- return handle_success( "events" );
+ return handle_success("events");
case HTTP_CODE_FAKE_ERROR:
default:
- return handle_error( "events" );
+ return handle_error("events");
}
}
-bool Omegle_client::send_message(const std::string &message_text )
+bool Omegle_client::send_message(const std::string &message_text)
{
- handle_entry( "send_message" );
+ handle_entry("send_message");
- std::string data = "msg=" + utils::url::encode( message_text );
+ std::string data = "msg=" + utils::url::encode(message_text);
data += "&id=" + this->chat_id_;
- http::response resp = flap( OMEGLE_REQUEST_SEND, &data );
+ http::response resp = flap(OMEGLE_REQUEST_SEND, &data);
- switch ( resp.code )
+ switch (resp.code)
{
case HTTP_CODE_OK:
if (resp.data == "win") {
- return handle_success( "send_message" );
+ return handle_success("send_message");
}
case HTTP_CODE_FAKE_ERROR:
case HTTP_CODE_FAKE_DISCONNECTED:
default:
- return handle_error( "send_message" );
+ return handle_error("send_message");
}
}
bool Omegle_client::typing_start()
{
- handle_entry( "typing_start" );
+ handle_entry("typing_start");
std::string data = "id=" + this->chat_id_;
- http::response resp = flap( OMEGLE_REQUEST_TYPING_START, &data );
+ http::response resp = flap(OMEGLE_REQUEST_TYPING_START, &data);
- switch ( resp.code )
+ switch (resp.code)
{
case HTTP_CODE_OK:
if (resp.data == "win") {
- return handle_success( "typing_start" );
+ return handle_success("typing_start");
}
case HTTP_CODE_FAKE_ERROR:
case HTTP_CODE_FAKE_DISCONNECTED:
default:
- return handle_error( "typing_start" );
+ return handle_error("typing_start");
}
}
bool Omegle_client::typing_stop()
{
- handle_entry( "typing_stop" );
+ handle_entry("typing_stop");
std::string data = "id=" + this->chat_id_;
- http::response resp = flap( OMEGLE_REQUEST_TYPING_STOP, &data );
+ http::response resp = flap(OMEGLE_REQUEST_TYPING_STOP, &data);
- switch ( resp.code )
+ switch (resp.code)
{
case HTTP_CODE_OK:
if (resp.data == "win") {
- return handle_success( "typing_stop" );
+ return handle_success("typing_stop");
}
case HTTP_CODE_FAKE_ERROR:
case HTTP_CODE_FAKE_DISCONNECTED:
default:
- return handle_error( "typing_stop" );
+ return handle_error("typing_stop");
}
}
@@ -793,24 +800,24 @@ bool Omegle_client::recaptcha()
{
// TODO: Implement!
- handle_entry( "recaptcha" );
+ handle_entry("recaptcha");
// data:{id:this.clientID,challenge:b,response:a}}
//std::string data = "?id=...&challenge= ..., &response= ...";
- http::response resp = flap( OMEGLE_REQUEST_RECAPTCHA );
+ http::response resp = flap(OMEGLE_REQUEST_RECAPTCHA);
- switch ( resp.code )
+ switch (resp.code)
{
case HTTP_CODE_OK:
-/* if (resp.data == "win") {
- return handle_success( "typing_start" );
- }*/
+ /* if (resp.data == "win") {
+ return handle_success( "typing_start" );
+ }*/
case HTTP_CODE_FAKE_ERROR:
case HTTP_CODE_FAKE_DISCONNECTED:
default:
- return handle_error( "typing_start" );
+ return handle_error("typing_start");
}
}
@@ -820,7 +827,7 @@ std::string Omegle_client::get_page(const int request_type)
http::response resp = flap(request_type);
- switch ( resp.code )
+ switch (resp.code)
{
case HTTP_CODE_OK:
handle_success("get_page");
diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp
index 12d8c3337c..870c8ea905 100644
--- a/protocols/Omegle/src/connection.cpp
+++ b/protocols/Omegle/src/connection.cpp
@@ -25,18 +25,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void OmegleProto::SignOn(void*)
{
SYSTEMTIME t;
- GetLocalTime( &t );
+ GetLocalTime(&t);
debugLogA("[%d.%d.%d] Using Omegle Protocol %s", t.wDay, t.wMonth, t.wYear, __VERSION_STRING_DOTS);
-
+
ScopedLock s(signon_lock_);
int old_status = m_iStatus;
m_iStatus = m_iDesiredStatus;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- setDword( "LogonTS", (DWORD)time(NULL));
+ setDword("LogonTS", (DWORD)time(NULL));
ClearChat();
- OnJoinChat(0,false);
+ OnJoinChat(0, false);
if (getByte(OMEGLE_KEY_AUTO_CONNECT, 0))
NewChat();
@@ -57,7 +57,7 @@ void OmegleProto::SignOff(void*)
delSetting("LogonTS");
- ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus);
+ ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
//SetAllContactStatuses( ID_STATUS_OFFLINE );
//ToggleStatusMenuItems(false);
@@ -70,8 +70,9 @@ void OmegleProto::SignOff(void*)
void OmegleProto::StopChat(bool disconnect)
{
if (facy.state_ == STATE_WAITING) {
- UpdateChat(NULL, TranslateT("Connecting canceled."), false);
- } else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY) {
+ UpdateChat(NULL, TranslateT("Connecting canceled."), false);
+ }
+ else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY) {
bool spy = facy.state_ == STATE_SPY;
if (disconnect)
@@ -82,13 +83,14 @@ void OmegleProto::StopChat(bool disconnect)
if (facy.stop())
debugLogA("***** Disconnected from stranger %s", facy.chat_id_.c_str());
else
- debugLogA("***** 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) {
DeleteChatContact(TranslateT("Stranger 1"));
DeleteChatContact(TranslateT("Stranger 2"));
- } else {
+ }
+ else {
DeleteChatContact(TranslateT("Stranger"));
}
@@ -111,7 +113,7 @@ void OmegleProto::NewChat()
return;
}
else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY)
- {
+ {
UpdateChat(NULL, TranslateT("Disconnecting..."), true);
if (facy.stop())
@@ -121,21 +123,22 @@ void OmegleProto::NewChat()
if (facy.state_ == STATE_SPY) {
DeleteChatContact(TranslateT("Stranger 1"));
- DeleteChatContact(TranslateT("Stranger 2"));
- } else {
+ DeleteChatContact(TranslateT("Stranger 2"));
+ }
+ else {
DeleteChatContact(TranslateT("Stranger"));
}
SetTopic(); // reset topic content
ClearChat();
-
+
UpdateChat(NULL, TranslateT("Connecting..."), true);
facy.state_ = STATE_WAITING;
if (facy.start())
- {
+ {
UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true);
debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());
}
@@ -153,14 +156,14 @@ void OmegleProto::NewChat()
facy.state_ = STATE_WAITING;
if (facy.start())
- {
+ {
UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true);
debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());
- ForkThread( &OmegleProto::EventsLoop, this );
+ ForkThread(&OmegleProto::EventsLoop, this);
}
}
-
+
}
void OmegleProto::EventsLoop(void *)
@@ -168,15 +171,15 @@ void OmegleProto::EventsLoop(void *)
ScopedLock s(events_loop_lock_);
time_t tim = ::time(NULL);
- debugLogA( ">>>>> Entering Omegle::EventsLoop[%d]", tim );
+ debugLogA(">>>>> 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;
- debugLogA( "***** OmegleProto::EventsLoop[%d] refreshing...", tim );
+ debugLogA("***** OmegleProto::EventsLoop[%d] refreshing...", tim);
}
ResetEvent(events_loop_lock_);
- debugLogA( "<<<<< Exiting OmegleProto::EventsLoop[%d]", tim );
+ debugLogA("<<<<< Exiting OmegleProto::EventsLoop[%d]", tim);
}
diff --git a/protocols/Omegle/src/constants.h b/protocols/Omegle/src/constants.h
index 53e9a41670..5ee273d363 100644
--- a/protocols/Omegle/src/constants.h
+++ b/protocols/Omegle/src/constants.h
@@ -48,84 +48,84 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Servers list
//static const char *servers[] = {"Random", "bajor", "cardassia", "promenade", "odo-bucket", "ferengi", "quilt", "empok-nor", "quibbler"};
-static const char *servers[] = {LPGEN("Random"), "front1", "front2", "front3", "front4", "front5", "front6", "front7", "front8", "front9"};
+static const char *servers[] = { LPGEN("Random"), "front1", "front2", "front3", "front4", "front5", "front6", "front7", "front8", "front9" };
static const struct {
const char *id;
const char *lang;
} languages[] = {
- {"en", "English"},
- {"af", "Afrikaans"},
- {"sq", "Albanian"},
- {"ar", "Arabic"},
- {"hy", "Armenian"},
- {"az", "Azerbaijani"},
- {"eu", "Basque"},
- {"be", "Belarusian"},
- {"bn", "Bengali"},
- {"bs", "Bosnian"},
- {"bg", "Bulgarian"},
- {"ceb", "Cebuanese"},
- {"cs", "Czech"},
- {"zh-CN", "Chinese (simplified)"},
- {"zh-TW", "Chinese (traditional)"},
- {"da", "Danish"},
- {"eo", "Esperanto"},
- {"et", "Estonian"},
- {"tl", "Philipino"},
- {"fi", "Finnish"},
- {"fr", "French"},
- {"gl", "Galician"},
- {"ka", "Georgian"},
- {"gu", "Gujarati"},
- {"ht", "Haitian Creole"},
- {"iw", "Hebrew"},
- {"hi", "Hindi"},
- {"hmn", "Hmong"},
- {"nl", "Dutch"},
- {"hr", "Croat"},
- {"id", "Indonesian"},
- {"ga", "Irish"},
- {"is", "Icelandic"},
- {"it", "Italian"},
- {"ja", "Japanese"},
- {"jw", "Javanese"},
- {"yi", "Yiddish"},
- {"kn", "Kannada"},
- {"ca", "Catalan"},
- {"km", "Khmer"},
- {"ko", "Korean"},
- {"lo", "Lao"},
- {"la", "Latina"},
- {"lt", "Lithuanian"},
- {"lv", "Latvian"},
- {"hu", "Hungarian"},
- {"mk", "Macedonian"},
- {"ms", "Malay"},
- {"mt", "Maltese"},
- {"mr", "Marathi"},
- {"de", "German"},
- {"no", "Norwegian"},
- {"fa", "Persian"},
- {"pl", "Polish"},
- {"pt", "Portugese"},
- {"ro", "Romañian"},
- {"ru", "Russian"},
- {"el", "Greek"},
- {"sk", "Slovak"},
- {"sl", "Slovenian"},
- {"sr", "Serbian"},
- {"sw", "Swahili"},
- {"es", "Spanish"},
- {"sv", "Swedish"},
- {"ta", "Tamil"},
- {"te", "Telugu"},
- {"th", "Thai"},
- {"tr", "Turkish"},
- {"uk", "Ukrainian"},
- {"ur", "Urdu"},
- {"cy", "Welsh"},
- {"vi", "Vietnamese"}
+ { "en", "English" },
+ { "af", "Afrikaans" },
+ { "sq", "Albanian" },
+ { "ar", "Arabic" },
+ { "hy", "Armenian" },
+ { "az", "Azerbaijani" },
+ { "eu", "Basque" },
+ { "be", "Belarusian" },
+ { "bn", "Bengali" },
+ { "bs", "Bosnian" },
+ { "bg", "Bulgarian" },
+ { "ceb", "Cebuanese" },
+ { "cs", "Czech" },
+ { "zh-CN", "Chinese (simplified)" },
+ { "zh-TW", "Chinese (traditional)" },
+ { "da", "Danish" },
+ { "eo", "Esperanto" },
+ { "et", "Estonian" },
+ { "tl", "Philipino" },
+ { "fi", "Finnish" },
+ { "fr", "French" },
+ { "gl", "Galician" },
+ { "ka", "Georgian" },
+ { "gu", "Gujarati" },
+ { "ht", "Haitian Creole" },
+ { "iw", "Hebrew" },
+ { "hi", "Hindi" },
+ { "hmn", "Hmong" },
+ { "nl", "Dutch" },
+ { "hr", "Croat" },
+ { "id", "Indonesian" },
+ { "ga", "Irish" },
+ { "is", "Icelandic" },
+ { "it", "Italian" },
+ { "ja", "Japanese" },
+ { "jw", "Javanese" },
+ { "yi", "Yiddish" },
+ { "kn", "Kannada" },
+ { "ca", "Catalan" },
+ { "km", "Khmer" },
+ { "ko", "Korean" },
+ { "lo", "Lao" },
+ { "la", "Latina" },
+ { "lt", "Lithuanian" },
+ { "lv", "Latvian" },
+ { "hu", "Hungarian" },
+ { "mk", "Macedonian" },
+ { "ms", "Malay" },
+ { "mt", "Maltese" },
+ { "mr", "Marathi" },
+ { "de", "German" },
+ { "no", "Norwegian" },
+ { "fa", "Persian" },
+ { "pl", "Polish" },
+ { "pt", "Portugese" },
+ { "ro", "Romañian" },
+ { "ru", "Russian" },
+ { "el", "Greek" },
+ { "sk", "Slovak" },
+ { "sl", "Slovenian" },
+ { "sr", "Serbian" },
+ { "sw", "Swahili" },
+ { "es", "Spanish" },
+ { "sv", "Swedish" },
+ { "ta", "Tamil" },
+ { "te", "Telugu" },
+ { "th", "Thai" },
+ { "tr", "Turkish" },
+ { "uk", "Ukrainian" },
+ { "ur", "Urdu" },
+ { "cy", "Welsh" },
+ { "vi", "Vietnamese" }
};
// Known server messages, only to inform lpgen
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp
index 7d5754e8a3..555a665a26 100644
--- a/protocols/Omegle/src/dialogs.cpp
+++ b/protocols/Omegle/src/dialogs.cpp
@@ -38,47 +38,48 @@ static BOOL StoreDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const ch
static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
- ptrT tstr( db_get_tsa(NULL, ppro->m_szModuleName, szSetting));
+ ptrT tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting));
if (tstr)
SetDlgItemText(hwnd, idCtrl, tstr);
}
static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
- TCHAR tstr[250+1];
+ TCHAR tstr[250 + 1];
GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr));
if (tstr[0] != '\0') {
db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr);
- } else {
+ }
+ else {
db_unset(NULL, ppro->m_szModuleName, szSetting);
}
}
-INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam )
+INT_PTR CALLBACK OmegleAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
OmegleProto *proto;
- switch ( message )
+ switch (message)
{
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<OmegleProto*>(lparam);
- SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
- SendDlgItemMessage(hwnd,IDC_INTERESTS, EM_LIMITTEXT, 512, 0);
+ SendDlgItemMessage(hwnd, IDC_INTERESTS, EM_LIMITTEXT, 512, 0);
// Server
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, 0, reinterpret_cast<LPARAM>(Translate(servers[0])));
- for(size_t i=1; i<_countof(servers); i++)
+ for (size_t i = 1; i < _countof(servers); i++)
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
// Language
- for(size_t i=0; i<_countof(languages); i++)
+ for (size_t i = 0; i < _countof(languages); i++)
SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(languages[i].lang)));
SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0);
@@ -89,31 +90,32 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
return TRUE;
case WM_COMMAND:
- switch(LOWORD(wparam))
+ switch (LOWORD(wparam))
{
- case IDC_LANGUAGE:
- case IDC_SERVER:
- if (HIWORD(wparam) == CBN_SELCHANGE) {
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
- case IDC_NAME:
- case IDC_INTERESTS:
- if (HIWORD(wparam) != EN_CHANGE || (HWND) lparam != GetFocus()) {
- return TRUE;
- } else {
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
- case IDC_MEET_COMMON:
- if (HIWORD(wparam) == BN_CLICKED) {
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
+ case IDC_LANGUAGE:
+ case IDC_SERVER:
+ if (HIWORD(wparam) == CBN_SELCHANGE) {
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ } break;
+ case IDC_NAME:
+ case IDC_INTERESTS:
+ if (HIWORD(wparam) != EN_CHANGE || (HWND)lparam != GetFocus()) {
+ return TRUE;
+ }
+ else {
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ } break;
+ case IDC_MEET_COMMON:
+ if (HIWORD(wparam) == BN_CLICKED) {
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ } break;
}
break;
case WM_NOTIFY:
- if ( reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY )
+ if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
- proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
+ proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_GETCURSEL, 0, 0));
@@ -130,11 +132,11 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
return FALSE;
}
-INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam )
+INT_PTR CALLBACK OmegleOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
- OmegleProto *proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
+ OmegleProto *proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
- switch ( message )
+ switch (message)
{
case WM_INITDIALOG:
@@ -142,20 +144,20 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<OmegleProto*>(lparam);
- SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
- SendDlgItemMessage(hwnd,IDC_INTERESTS, EM_LIMITTEXT, 250, 0);
- SendDlgItemMessage(hwnd,IDC_HI_MESSAGE, EM_LIMITTEXT, 250, 0);
- SendDlgItemMessage(hwnd,IDC_ASL_MESSAGE, EM_LIMITTEXT, 250, 0);
+ SendDlgItemMessage(hwnd, IDC_INTERESTS, EM_LIMITTEXT, 250, 0);
+ SendDlgItemMessage(hwnd, IDC_HI_MESSAGE, EM_LIMITTEXT, 250, 0);
+ SendDlgItemMessage(hwnd, IDC_ASL_MESSAGE, EM_LIMITTEXT, 250, 0);
// Server
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, 0, reinterpret_cast<LPARAM>(Translate(servers[0])));
- for(size_t i=1; i<_countof(servers); i++)
+ for (size_t i = 1; i < _countof(servers); i++)
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
// Language
- for(size_t i=0; i<_countof(languages); i++)
+ for (size_t i = 0; i < _countof(languages); i++)
SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(languages[i].lang)));
SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0);
@@ -171,46 +173,47 @@ 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_AUTO_CONNECT, OMEGLE_KEY_AUTO_CONNECT);
+ LoadDBCheckState(proto, hwnd, IDC_AUTO_CONNECT, OMEGLE_KEY_AUTO_CONNECT);
} return TRUE;
case WM_COMMAND: {
- switch(LOWORD(wparam))
+ switch (LOWORD(wparam))
{
- case IDC_SERVER:
- case IDC_LANGUAGE:
- if (HIWORD(wparam) == CBN_SELCHANGE) {
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
- case IDC_NAME:
- case IDC_INTERESTS:
- case IDC_HI_MESSAGE:
- case IDC_ASL_MESSAGE:
- if (HIWORD(wparam) != EN_CHANGE || (HWND) lparam != GetFocus()) {
- return TRUE;
- } else {
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
- case IDC_MEET_COMMON:
- case IDC_HI_ENABLED:
- case IDC_NOCLEAR:
- case IDC_DONTSTOP:
- case IDC_REUSE_QUESTIONS:
- case IDC_SERVER_INFO:
- case IDC_AUTO_CONNECT:
- if (HIWORD(wparam) == BN_CLICKED) {
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
+ case IDC_SERVER:
+ case IDC_LANGUAGE:
+ if (HIWORD(wparam) == CBN_SELCHANGE) {
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ } break;
+ case IDC_NAME:
+ case IDC_INTERESTS:
+ case IDC_HI_MESSAGE:
+ case IDC_ASL_MESSAGE:
+ if (HIWORD(wparam) != EN_CHANGE || (HWND)lparam != GetFocus()) {
+ return TRUE;
+ }
+ else {
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ } break;
+ case IDC_MEET_COMMON:
+ case IDC_HI_ENABLED:
+ case IDC_NOCLEAR:
+ case IDC_DONTSTOP:
+ case IDC_REUSE_QUESTIONS:
+ case IDC_SERVER_INFO:
+ case IDC_AUTO_CONNECT:
+ if (HIWORD(wparam) == BN_CLICKED) {
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ } break;
}
} break;
case WM_NOTIFY:
- if ( reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY )
+ if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
- proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
+ proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_GETCURSEL, 0, 0));
@@ -227,12 +230,12 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
StoreDBCheckState(proto, hwnd, IDC_REUSE_QUESTIONS, OMEGLE_KEY_REUSE_QUESTION);
StoreDBCheckState(proto, hwnd, IDC_SERVER_INFO, OMEGLE_KEY_SERVER_INFO);
StoreDBCheckState(proto, hwnd, IDC_AUTO_CONNECT, OMEGLE_KEY_AUTO_CONNECT);
-
+
return TRUE;
}
break;
}
-
+
return FALSE;
}
diff --git a/protocols/Omegle/src/dialogs.h b/protocols/Omegle/src/dialogs.h
index 120df44b73..0a82e5b92e 100644
--- a/protocols/Omegle/src/dialogs.h
+++ b/protocols/Omegle/src/dialogs.h
@@ -22,5 +22,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
-INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam );
-INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam );
+INT_PTR CALLBACK OmegleAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+INT_PTR CALLBACK OmegleOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp
index be47e64da6..445e15ca0d 100644
--- a/protocols/Omegle/src/main.cpp
+++ b/protocols/Omegle/src/main.cpp
@@ -54,7 +54,7 @@ static int compare_protos(const OmegleProto *p1, const OmegleProto *p2)
OBJLIST<OmegleProto> g_Instances(1, compare_protos);
-DWORD WINAPI DllMain(HINSTANCE hInstance,DWORD,LPVOID)
+DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
{
g_hInstance = hInstance;
return TRUE;
@@ -69,12 +69,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
/////////////////////////////////////////////////////////////////////////////////////////
// Interface information
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char *proto_name,const TCHAR *username )
+static PROTO_INTERFACE* protoInit(const char *proto_name, const TCHAR *username)
{
OmegleProto *proto = new OmegleProto(proto_name, username);
g_Instances.insert(proto);
@@ -83,7 +83,7 @@ static PROTO_INTERFACE* protoInit(const char *proto_name,const TCHAR *username )
static int protoUninit(PROTO_INTERFACE* proto)
{
- g_Instances.remove(( OmegleProto* )proto);
+ g_Instances.remove((OmegleProto*)proto);
return EXIT_SUCCESS;
}
@@ -109,23 +109,23 @@ extern "C" int __declspec(dllexport) Load(void)
{
std::stringstream agent;
agent << "Miranda NG/";
- agent << (( g_mirandaVersion >> 24) & 0xFF);
+ agent << ((g_mirandaVersion >> 24) & 0xFF);
agent << ".";
- agent << (( g_mirandaVersion >> 16) & 0xFF);
+ agent << ((g_mirandaVersion >> 16) & 0xFF);
agent << ".";
- agent << (( g_mirandaVersion >> 8) & 0xFF);
+ agent << ((g_mirandaVersion >> 8) & 0xFF);
agent << ".";
- agent << (( g_mirandaVersion ) & 0xFF);
- #ifdef _WIN64
+ agent << ((g_mirandaVersion)& 0xFF);
+#ifdef _WIN64
agent << " Omegle Protocol x64/";
- #else
+#else
agent << " Omegle Protocol/";
- #endif
+#endif
agent << __VERSION_STRING_DOTS;
- g_strUserAgent = agent.str( );
+ g_strUserAgent = agent.str();
}
- return 0;
+ return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -134,7 +134,7 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
//UninitContactMenus();
- for(size_t i=0; i<_countof(g_hEvents); i++)
+ for (size_t i = 0; i < _countof(g_hEvents); i++)
UnhookEvent(g_hEvents[i]);
return 0;
diff --git a/protocols/Omegle/src/messages.cpp b/protocols/Omegle/src/messages.cpp
index 666229ebfd..3981da3635 100644
--- a/protocols/Omegle/src/messages.cpp
+++ b/protocols/Omegle/src/messages.cpp
@@ -24,17 +24,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void OmegleProto::SendMsgWorker(void *p)
{
- if(p == NULL)
+ if (p == NULL)
return;
-
- ScopedLock s( facy.send_message_lock_ );
+
+ ScopedLock s(facy.send_message_lock_);
std::string data = *(std::string*)p;
delete (std::string*)p;
data = utils::text::trim(data);
- if (facy.state_ == STATE_ACTIVE && data.length() && facy.send_message( data ))
+ if (facy.state_ == STATE_ACTIVE && data.length() && facy.send_message(data))
{
TCHAR *msg = mir_a2t_cp(data.c_str(), CP_UTF8);
UpdateChat(facy.nick_, msg);
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp
index 22061ba1bb..4222f1bce1 100644
--- a/protocols/Omegle/src/proto.cpp
+++ b/protocols/Omegle/src/proto.cpp
@@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
OmegleProto::OmegleProto(const char* proto_name, const TCHAR* username) :
- PROTO<OmegleProto>(proto_name, username)
+PROTO<OmegleProto>(proto_name, username)
{
this->facy.parent = this;
diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h
index 6af68ff566..d84b25e142 100644
--- a/protocols/Omegle/src/proto.h
+++ b/protocols/Omegle/src/proto.h
@@ -22,52 +22,52 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
-class OmegleProto : public PROTO<OmegleProto>
+class OmegleProto : public PROTO < OmegleProto >
{
public:
- OmegleProto( const char *proto_name, const TCHAR *username );
- ~OmegleProto( );
+ OmegleProto(const char *proto_name, const TCHAR *username);
+ ~OmegleProto();
- inline const char* ModuleName( ) const
+ inline const char* ModuleName() const
{
return m_szModuleName;
}
- inline bool isOnline( )
+ inline bool isOnline()
{
- return ( m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING );
+ return (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING);
}
- inline bool isOffline( )
+ inline bool isOffline()
{
- return ( m_iStatus == ID_STATUS_OFFLINE );
+ return (m_iStatus == ID_STATUS_OFFLINE);
}
// PROTO_INTERFACE
- virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL );
+ virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
- virtual int __cdecl SetStatus( int iNewStatus );
+ virtual int __cdecl SetStatus(int iNewStatus);
- virtual int __cdecl UserIsTyping( MCONTACT hContact, int type );
+ virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
- virtual int __cdecl OnEvent( PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam );
+ virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
// Services
- INT_PTR __cdecl SvcCreateAccMgrUI( WPARAM, LPARAM );
+ INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM);
// Events
int __cdecl OnModulesLoaded(WPARAM, LPARAM);
int __cdecl OnOptionsInit(WPARAM, LPARAM);
- int __cdecl OnContactDeleted(WPARAM,LPARAM);
- int __cdecl OnPreShutdown(WPARAM,LPARAM);
- int __cdecl OnPrebuildContactMenu(WPARAM,LPARAM);
+ int __cdecl OnContactDeleted(WPARAM, LPARAM);
+ int __cdecl OnPreShutdown(WPARAM, LPARAM);
+ int __cdecl OnPrebuildContactMenu(WPARAM, LPARAM);
// Chat handling
- int __cdecl OnChatEvent(WPARAM,LPARAM);
- INT_PTR __cdecl OnJoinChat(WPARAM,LPARAM);
- INT_PTR __cdecl OnLeaveChat(WPARAM,LPARAM);
-
+ int __cdecl OnChatEvent(WPARAM, LPARAM);
+ INT_PTR __cdecl OnJoinChat(WPARAM, LPARAM);
+ INT_PTR __cdecl OnLeaveChat(WPARAM, LPARAM);
+
// Loops
void __cdecl EventsLoop(void*);
@@ -88,7 +88,7 @@ public:
//bool IsMyContact(HANDLE, bool include_chat = false);
// Chat handling
- void AddChat(const TCHAR *id,const TCHAR *name);
+ void AddChat(const TCHAR *id, const TCHAR *name);
void UpdateChat(const TCHAR *name, const TCHAR *message, bool addtochat = true);
void SendChatMessage(std::string message);
void AddChatContact(const TCHAR *nick);
diff --git a/protocols/Omegle/src/stdafx.h b/protocols/Omegle/src/stdafx.h
index 69ea6c6e9c..96315bdf40 100644
--- a/protocols/Omegle/src/stdafx.h
+++ b/protocols/Omegle/src/stdafx.h
@@ -84,11 +84,11 @@ class ScopedLock
public:
ScopedLock(HANDLE h) : handle_(h)
{
- WaitForSingleObject(handle_,INFINITE);
+ WaitForSingleObject(handle_, INFINITE);
}
~ScopedLock()
{
- if(handle_)
+ if (handle_)
ReleaseMutex(handle_);
}
void Unlock()
diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp
index 48f61ba93a..aa794eb8f1 100644
--- a/protocols/Omegle/src/theme.cpp
+++ b/protocols/Omegle/src/theme.cpp
@@ -38,9 +38,9 @@ void InitIcons(void)
HANDLE GetIconHandle(const char* name)
{
- for(size_t i=0; i<_countof(icons); i++)
+ for (size_t i = 0; i < _countof(icons); i++)
{
- if(mir_strcmp(icons[i].szName, name) == 0)
+ if (mir_strcmp(icons[i].szName, name) == 0)
return hIconLibItem[i];
}
return 0;