summaryrefslogtreecommitdiff
path: root/protocols/Skype/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-04-25 07:02:52 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-04-25 07:02:52 +0000
commitdd0192c8e5c6916fd16623322bd45ba5152d7b6c (patch)
tree2a5bd952365207fe98882898d5e268c0ac6d0a3d /protocols/Skype/src
parent6e0844cc399384a786171bfb98025aae84e44e15 (diff)
try to add default group for contacts
git-svn-id: http://svn.miranda-ng.org/main/trunk@4528 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src')
-rw-r--r--protocols/Skype/src/resource.h4
-rw-r--r--protocols/Skype/src/skype.h2
-rw-r--r--protocols/Skype/src/skype_account.cpp8
-rw-r--r--protocols/Skype/src/skype_contacts.cpp6
-rw-r--r--protocols/Skype/src/skype_dialogs.cpp24
5 files changed, 43 insertions, 1 deletions
diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h
index c6c95bbde4..312ced9d5e 100644
--- a/protocols/Skype/src/resource.h
+++ b/protocols/Skype/src/resource.h
@@ -45,6 +45,8 @@
#define IDC_USE_ALT_PORTS 1017
#define IDC_REGISTER 1018
#define IDC_CHANGE_PWD 1019
+#define IDC_DEFAULT_GROUP 1020
+#define IDC_GROUP 1021
// Next default values for new objects
//
@@ -52,7 +54,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1020
+#define _APS_NEXT_CONTROL_VALUE 1022
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h
index 0a8d5a9f50..6bd9995032 100644
--- a/protocols/Skype/src/skype.h
+++ b/protocols/Skype/src/skype.h
@@ -57,10 +57,12 @@
#define MODULE "Skype"
#define SKYPE_SID_LIMIT 128
#define SKYPE_PASSWORD_LIMIT 128
+#define SKYPE_GROUP_NAME_LIMIT 100
#define SKYPE_SETTINGS_STATUS "Status"
#define SKYPE_SETTINGS_LOGIN "sid"
#define SKYPE_SETTINGS_PASSWORD "Password"
+#define SKYPE_SETTINGS_DEF_GROUP "DefaultGroup"
#define SKYPE_SEARCH_BYSID 1001
#define SKYPE_SEARCH_BYEMAIL 1002
diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp
index 1f7ca50541..ac7149a945 100644
--- a/protocols/Skype/src/skype_account.cpp
+++ b/protocols/Skype/src/skype_account.cpp
@@ -185,6 +185,14 @@ void CSkypeProto::SetAccountSettings()
int port = this->GetSettingWord("Port", rand() % 10000 + 10000);
g_skype->SetInt(SETUPKEY_PORT, port);
g_skype->SetInt(SETUPKEY_DISABLE_PORT80, (int)!this->GetSettingByte("UseAlternativePorts", 1));
+
+ // Create default group for new contacts
+ DBVARIANT dbv = {0};
+ if (!db_get_ts(NULL, m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, &dbv) && lstrlen(dbv.ptszVal) > 0)
+ {
+ CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)dbv.ptszVal);
+ db_free(&dbv);
+ }
}
bool CSkypeProto::IsAvatarChanged(const SEBinary &avatar)
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp
index 68546d252b..17707ce680 100644
--- a/protocols/Skype/src/skype_contacts.cpp
+++ b/protocols/Skype/src/skype_contacts.cpp
@@ -224,6 +224,12 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact)
::db_set_ws(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN, sid);
::db_set_ws(hContact, this->m_szModuleName, "Nick", nick);
+ DBVARIANT dbv;
+ if(!db_get_ts(NULL, m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, &dbv))
+ {
+ db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
+ db_free(&dbv);
+ }
::mir_free(nick);
}
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp
index d08131a3d7..584bdf91d2 100644
--- a/protocols/Skype/src/skype_dialogs.cpp
+++ b/protocols/Skype/src/skype_dialogs.cpp
@@ -52,6 +52,12 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR
{
EnableWindow(GetDlgItem(hwnd, IDC_REGISTER), FALSE);
}
+
+ SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, SKYPE_GROUP_NAME_LIMIT, 0);
+
+ wchar_t *defgroup = db_get_wsa(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP);
+ SetDlgItemText(hwnd, IDC_GROUP, defgroup);
+ ::mir_free(defgroup);
}
return TRUE;
@@ -86,6 +92,14 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR
}
break;
+ case IDC_GROUP:
+ {
+ if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
+ return 0;
+ else
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+
case IDC_PORT:
case IDC_USE_ALT_PORTS:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
@@ -155,6 +169,16 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR
proto->SetSettingByte("UseAlternativePorts", (BYTE)IsDlgButtonChecked(hwnd, IDC_USE_ALT_PORTS));
}
+ wchar_t tstr[128];
+ GetDlgItemText(hwnd, IDC_GROUP, tstr, SIZEOF(tstr));
+ if (lstrlen(tstr) > 0)
+ {
+ db_set_ts(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, tstr);
+ CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)tstr);
+ }
+ else
+ db_unset(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP);
+
return TRUE;
}
break;