summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-04-30 12:34:33 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-04-30 12:34:33 +0000
commit444f4637b88efa00c4cdfcc92e1d157bd6fe4008 (patch)
tree827554621142740c26a57c5cf17339d0ab88ff13
parent3828ee35499c53c7d53a88c6551a2a828ab8b7cf (diff)
preparing for saving own info in db and on server
git-svn-id: http://svn.miranda-ng.org/main/trunk@4574 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Skype/src/skype_dialogs.cpp103
-rw-r--r--protocols/Skype/src/skype_proto.h10
2 files changed, 107 insertions, 6 deletions
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp
index 00145dbce4..3d0801b76f 100644
--- a/protocols/Skype/src/skype_dialogs.cpp
+++ b/protocols/Skype/src/skype_dialogs.cpp
@@ -419,6 +419,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
static INT_PTR CALLBACK PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ const unsigned long iPageId = 0;
CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
@@ -515,6 +516,7 @@ static INT_PTR CALLBACK PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
(HWND)lParam==GetDlgItem(hwndDlg, IDC_BIRTH_MONTH) || (HWND)lParam==GetDlgItem(hwndDlg, IDC_BIRTH_YEAR) ||
(HWND)lParam==GetDlgItem(hwndDlg, IDC_LANGUAGE)) && (HIWORD(wParam)==CBN_EDITCHANGE||HIWORD(wParam)==CBN_SELCHANGE)))
{
+ ppro->NeedUpdate = 1;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
@@ -526,9 +528,13 @@ static INT_PTR CALLBACK PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam);
break;
case PSN_APPLY:
- //ppro->SaveVcardToDB(hwndDlg, iPageId);
- //if ( !ppro->m_vCardUpdates)
- // ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
+ if (ppro->IsOnline() && ppro->NeedUpdate)
+ {
+ ppro->SaveToDB(hwndDlg, iPageId);
+ ppro->SaveToServer();
+ }
+ else if ( !ppro->IsOnline())
+ ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server."));
break;
}
}
@@ -539,6 +545,7 @@ static INT_PTR CALLBACK PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
static INT_PTR CALLBACK ContactSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ const unsigned long iPageId = 1;
CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
@@ -596,7 +603,10 @@ static INT_PTR CALLBACK ContactSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
case WM_COMMAND:
if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE)
+ {
+ ppro->NeedUpdate = 1;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
break;
case WM_NOTIFY:
@@ -619,6 +629,7 @@ static INT_PTR CALLBACK ContactSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
static INT_PTR CALLBACK HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ const unsigned long iPageId = 2;
CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
@@ -667,7 +678,10 @@ static INT_PTR CALLBACK HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_COMMAND:
if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE)
+ {
+ ppro->NeedUpdate = 1;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
break;
case WM_NOTIFY:
@@ -710,6 +724,7 @@ int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
UserInfo_AddPage(wParam, &odp);
}
} else {
+ NeedUpdate = 0;
odp.pfnDlgProc = ContactSkypeDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_CONTACT);
odp.ptszTab = LPGENT("Contacts");
@@ -874,4 +889,86 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP
break;
}
return FALSE;
+}
+
+void CSkypeProto::SaveToDB(HWND hwndPage, int iPage)
+{
+ TCHAR text[2048];
+
+ switch (iPage) {
+ // Page 0: Personal
+ case 0:
+ /*GetDlgItemText(hwndPage, IDC_FULLNAME, text, SIZEOF(text));
+ JSetStringT(NULL, "FullName", text);
+ GetDlgItemText(hwndPage, IDC_NICKNAME, text, SIZEOF(text));
+ JSetStringT(NULL, "Nick", text);
+ GetDlgItemText(hwndPage, IDC_FIRSTNAME, text, SIZEOF(text));
+ JSetStringT(NULL, "FirstName", text);
+ GetDlgItemText(hwndPage, IDC_MIDDLE, text, SIZEOF(text));
+ JSetStringT(NULL, "MiddleName", text);
+ GetDlgItemText(hwndPage, IDC_LASTNAME, text, SIZEOF(text));
+ JSetStringT(NULL, "LastName", text);
+ GetDlgItemText(hwndPage, IDC_BIRTH, text, SIZEOF(text));
+ JSetStringT(NULL, "BirthDate", text);
+ switch(SendMessage(GetDlgItem(hwndPage, IDC_GENDER), CB_GETCURSEL, 0, 0)) {
+ case 0: JSetString(NULL, "GenderString", "Male"); break;
+ case 1: JSetString(NULL, "GenderString", "Female"); break;
+ default: JSetString(NULL, "GenderString", ""); break;
+ }
+ GetDlgItemText(hwndPage, IDC_OCCUPATION, text, SIZEOF(text));
+ JSetStringT(NULL, "Role", text);
+ GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, SIZEOF(text));
+ JSetStringT(NULL, "Homepage", text);*/
+ break;
+
+ // Page 1: Contacts
+ case 1:
+ /*GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text));
+ JSetStringT(NULL, "Street", text);
+ GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text));
+ JSetStringT(NULL, "Street2", text);
+ GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
+ JSetStringT(NULL, "City", text);
+ GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
+ JSetStringT(NULL, "State", text);
+ GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text));
+ JSetStringT(NULL, "ZIP", text);
+ {
+ int i = SendMessage(GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETCURSEL, 0, 0);
+ TCHAR *country = mir_a2t((i) ? g_countries[i+2].szName : g_countries[1].szName);
+ JSetStringT(NULL, "Country", country);
+ mir_free(country);
+ }*/
+ break;
+
+ // Page 2: Home
+ case 2:
+ /*GetDlgItemText(hwndPage, IDC_COMPANY, text, SIZEOF(text));
+ JSetStringT(NULL, "Company", text);
+ GetDlgItemText(hwndPage, IDC_DEPARTMENT, text, SIZEOF(text));
+ JSetStringT(NULL, "CompanyDepartment", text);
+ GetDlgItemText(hwndPage, IDC_TITLE, text, SIZEOF(text));
+ JSetStringT(NULL, "CompanyPosition", text);
+ GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text));
+ JSetStringT(NULL, "CompanyStreet", text);
+ GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text));
+ JSetStringT(NULL, "CompanyStreet2", text);
+ GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
+ JSetStringT(NULL, "CompanyCity", text);
+ GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
+ JSetStringT(NULL, "CompanyState", text);
+ GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text));
+ JSetStringT(NULL, "CompanyZIP", text);
+ {
+ int i = SendMessage(GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETCURSEL, 0, 0);
+ TCHAR *country = mir_a2t((i) ? g_countries[i+2].szName : g_countries[1].szName);
+ JSetStringT(NULL, "CompanyCountry", country);
+ mir_free(country);
+ }*/
+ break;
+ }
+}
+
+void CSkypeProto::SaveToServer()
+{
} \ No newline at end of file
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h
index 15d1b57b25..d123f04d43 100644
--- a/protocols/Skype/src/skype_proto.h
+++ b/protocols/Skype/src/skype_proto.h
@@ -181,6 +181,13 @@ public:
bool IsOnline();
static std::map<std::wstring, std::wstring> languages;
+ BYTE NeedUpdate;
+ void SaveToDB(HWND hwndPage, int iPage);
+ void SaveToServer();
+
+ static void ShowNotification(const wchar_t *message, int flags = 0, HANDLE hContact = NULL);
+ static void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, HANDLE hContact = NULL);
+
protected:
CAccount::Ref account;
CContact::Refs contactList;
@@ -340,9 +347,6 @@ protected:
int SkypeToMirandaLoginError(CAccount::LOGOUTREASON logoutReason);
- static void ShowNotification(const wchar_t *message, int flags = 0, HANDLE hContact = NULL);
- static void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, HANDLE hContact = NULL);
-
static char *RemoveHtml(const char *data);
void SetServerStatus(int iStatus);