summaryrefslogtreecommitdiff
path: root/protocols/Omegle
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
commit007b4c7301f0d26a72f89f74e9929f42e24eb3e6 (patch)
treeb1ee30b70c6e36d1a06aed6885cb80dc560a68ca /protocols/Omegle
parentf4a1bbc6ba4b8137cb868639ac146aa97e97e9df (diff)
- rest of menus cleared;
- old database macroses wiped out from all plugins (left in m_database.h for compatibility) git-svn-id: http://svn.miranda-ng.org/main/trunk@4324 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Omegle')
-rw-r--r--protocols/Omegle/src/chat.cpp10
-rw-r--r--protocols/Omegle/src/communication.cpp20
-rw-r--r--protocols/Omegle/src/db.h22
-rw-r--r--protocols/Omegle/src/dialogs.cpp20
-rw-r--r--protocols/Omegle/src/proto.cpp2
-rw-r--r--protocols/Omegle/src/utils.cpp2
6 files changed, 38 insertions, 38 deletions
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index 7b16ccdfc3..647f012b40 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -108,7 +108,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
if ( !getU8String( OMEGLE_KEY_LAST_QUESTION,&dbv )) {
params = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (params.empty()) {
@@ -139,7 +139,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
if ( !getU8String( OMEGLE_KEY_ASL,&dbv )) {
text = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
UpdateChat(NULL, TranslateT("Your '/asl' setting is empty."), false);
break;
@@ -367,13 +367,13 @@ void OmegleProto::SetChatStatus(int status)
// Load actual name from database
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, m_szModuleName, OMEGLE_KEY_NAME, &dbv))
+ if ( !db_get_ts(NULL, m_szModuleName, OMEGLE_KEY_NAME, &dbv))
{
facy.nick_ = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
facy.nick_ = mir_tstrdup(TranslateT("You"));
- DBWriteContactSettingTString(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_);
+ db_set_ts(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_);
}
// Add self contact
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp
index 047e6177a3..ea4604b167 100644
--- a/protocols/Omegle/src/communication.cpp
+++ b/protocols/Omegle/src/communication.cpp
@@ -117,7 +117,7 @@ bool Omegle_client::handle_error( std::string method, bool force_disconnect )
if ( force_disconnect )
result = false;
- else if ( error_count_ <= (UINT)DBGetContactSettingByte(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;
@@ -138,7 +138,7 @@ std::string Omegle_client::get_server( bool not_last )
{
BYTE q = not_last ? 1 : 0;
- BYTE server = DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
+ BYTE server = db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
if (server < 0 || server >= (SIZEOF(servers)-q))
server = 0;
@@ -327,10 +327,10 @@ bool Omegle_client::start()
} else {
data = "&ask=" + utils::url::encode(this->question_);
data += "&cansavequestion=";
- data += DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_REUSE_QUESTION, 0) ? "1" : "0";
+ data += db_get_b(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 ( db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0))
{
DBVARIANT dbv;
if (!DBGetContactSettingUTF8String(NULL, parent->m_szModuleName, OMEGLE_KEY_INTERESTS, &dbv))
@@ -338,7 +338,7 @@ bool Omegle_client::start()
std::string topics = dbv.pszVal;
std::string topic;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
std::string::size_type pos = 0;
std::string::size_type pos2 = 0;
@@ -376,7 +376,7 @@ bool Omegle_client::start()
}
}
- if (DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER_INFO, 0))
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER_INFO, 0))
{
std::string count = get_page( OMEGLE_REQUEST_COUNT );
if (!count.empty()) {
@@ -608,7 +608,7 @@ bool Omegle_client::events( )
if ( resp.data.find( "[\"strangerDisconnected\"]" ) != std::string::npos ) {
// Stranger disconnected
- if (DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
{
SkinPlaySound( "StrangerChange" );
parent->NewChat();
@@ -633,7 +633,7 @@ bool Omegle_client::events( )
mir_free(msg);
// Stranger disconnected
- if (DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
{
SkinPlaySound( "StrangerChange" );
parent->NewChat();
@@ -670,11 +670,11 @@ 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 ( db_get_b( NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0 )) {
DBVARIANT dbv;
if ( !DBGetContactSettingUTF8String( NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv )) {
std::string *message = new std::string(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
parent->Log("**Chat - saying Hi! message");
ForkThread(&OmegleProto::SendMsgWorker, parent, (void*)message);
diff --git a/protocols/Omegle/src/db.h b/protocols/Omegle/src/db.h
index ea80a53d48..6543b9f2d8 100644
--- a/protocols/Omegle/src/db.h
+++ b/protocols/Omegle/src/db.h
@@ -23,19 +23,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
// DB macros
-#define getByte( setting, error ) DBGetContactSettingByte( NULL, m_szModuleName, setting, error )
-#define setByte( setting, value ) DBWriteContactSettingByte( NULL, m_szModuleName, setting, value )
-#define getWord( setting, error ) DBGetContactSettingWord( NULL, m_szModuleName, setting, error )
-#define setWord( setting, value ) DBWriteContactSettingWord( NULL, m_szModuleName, setting, value )
-#define getDword( setting, error ) DBGetContactSettingDword( NULL, m_szModuleName, setting, error )
-#define setDword( setting, value ) DBWriteContactSettingDword( NULL, m_szModuleName, setting, value )
-#define getString( setting, dest ) DBGetContactSettingString( NULL, m_szModuleName, setting, dest )
-#define setString( setting, value ) DBWriteContactSettingString( NULL, m_szModuleName, setting, value )
-#define getTString( setting, dest ) DBGetContactSettingTString( NULL, m_szModuleName, setting, dest )
-#define setTString( setting, value ) DBWriteContactSettingTString( NULL, m_szModuleName, setting, value )
+#define getByte( setting, error ) db_get_b( NULL, m_szModuleName, setting, error )
+#define setByte( setting, value ) db_set_b( NULL, m_szModuleName, setting, value )
+#define getWord( setting, error ) db_get_w( NULL, m_szModuleName, setting, error )
+#define setWord( setting, value ) db_set_w( NULL, m_szModuleName, setting, value )
+#define getDword( setting, error ) db_get_dw( NULL, m_szModuleName, setting, error )
+#define setDword( setting, value ) db_set_dw( NULL, m_szModuleName, setting, value )
+#define getString( setting, dest ) db_get_s( NULL, m_szModuleName, setting, dest )
+#define setString( setting, value ) db_set_s( NULL, m_szModuleName, setting, value )
+#define getTString( setting, dest ) db_get_ts( NULL, m_szModuleName, setting, dest )
+#define setTString( setting, value ) db_set_ts( NULL, m_szModuleName, setting, value )
#define getU8String( setting, dest ) DBGetContactSettingUTF8String( NULL, m_szModuleName, setting, dest )
#define setU8String( setting, value ) DBWriteContactSettingUTF8String( NULL, m_szModuleName, setting, value )
-#define deleteSetting( setting ) DBDeleteContactSetting( NULL, m_szModuleName, setting )
+#define deleteSetting( setting ) db_unset( NULL, m_szModuleName, setting )
// DB settings
#define OMEGLE_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN]
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp
index 19f9fde011..a3dff58abc 100644
--- a/protocols/Omegle/src/dialogs.cpp
+++ b/protocols/Omegle/src/dialogs.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static BOOL LoadDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting, BYTE bDef = 0)
{
- BOOL state = DBGetContactSettingByte(NULL, ppro->m_szModuleName, szSetting, bDef);
+ BOOL state = db_get_b(NULL, ppro->m_szModuleName, szSetting, bDef);
CheckDlgButton(hwnd, idCtrl, state);
return state;
}
@@ -32,17 +32,17 @@ static BOOL LoadDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const cha
static BOOL StoreDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
BOOL state = IsDlgButtonChecked(hwnd, idCtrl);
- DBWriteContactSettingByte(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
+ db_set_b(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
return state;
}
static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, ppro->m_szModuleName, szSetting, &dbv))
+ if ( !db_get_ts(NULL, ppro->m_szModuleName, szSetting, &dbv))
{
SetDlgItemText(hwnd, idCtrl, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -52,9 +52,9 @@ static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* sz
GetDlgItemText(hwnd, idCtrl, tstr, sizeof(tstr));
if ( _tcsclen( tstr ) > 0 ) {
- DBWriteContactSettingTString(NULL, ppro->m_szModuleName, szSetting, tstr);
+ db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr);
} else {
- DBDeleteContactSetting(NULL, ppro->m_szModuleName, szSetting);
+ db_unset(NULL, ppro->m_szModuleName, szSetting);
}
}
@@ -80,7 +80,7 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
{
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
}
- SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, DBGetContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
+ SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
LoadDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
@@ -114,7 +114,7 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
{
proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
StoreDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
StoreDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
@@ -152,7 +152,7 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
{
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
}
- SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, DBGetContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
+ SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
LoadDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
@@ -208,7 +208,7 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
{
proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
StoreDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
StoreDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp
index 2380eb48ec..ad5229f13d 100644
--- a/protocols/Omegle/src/proto.cpp
+++ b/protocols/Omegle/src/proto.cpp
@@ -236,7 +236,7 @@ int OmegleProto::OnContactDeleted(WPARAM wparam,LPARAM)
if ( include_chat )
return true;
else
- return DBGetContactSettingByte(hContact,m_szModuleName,"ChatRoom",0) == 0;
+ return db_get_b(hContact,m_szModuleName,"ChatRoom",0) == 0;
} else {
return false;
}
diff --git a/protocols/Omegle/src/utils.cpp b/protocols/Omegle/src/utils.cpp
index 09b6eed036..b259fa5933 100644
--- a/protocols/Omegle/src/utils.cpp
+++ b/protocols/Omegle/src/utils.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
std::string utils::url::encode(const std::string &s)
{
- return mir_ptr<char>( mir_urlEncode( s.c_str()));
+ return (char*)mir_ptr<char>( mir_urlEncode( s.c_str()));
}
void utils::text::replace_first( std::string* data, std::string from, std::string to )