diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-09-27 08:54:13 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-09-27 08:54:13 +0000 |
commit | ff29f186b04d8bbddef31411e1d6dee4b48474ab (patch) | |
tree | a41aec1e42fd819ca4898528c26526a931cceff5 /protocols | |
parent | 4a57667c0372692f38be7457a1d11346af5e17c1 (diff) |
added few code
git-svn-id: http://svn.miranda-ng.org/main/trunk@1678 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Skype/res/Resource.rc | 25 | ||||
-rw-r--r-- | protocols/Skype/src/resource.h | bin | 1352 -> 1256 bytes | |||
-rw-r--r-- | protocols/Skype/src/skype.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype.h | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_dialogs.cpp | 94 | ||||
-rw-r--r-- | protocols/Skype/src/skype_events.cpp | 17 | ||||
-rw-r--r-- | protocols/Skype/src/skype_icons.cpp | 39 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.cpp | 10 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.h | 4 |
9 files changed, 190 insertions, 3 deletions
diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc index 0c49fc03d2..1ecf45e8c9 100644 --- a/protocols/Skype/res/Resource.rc +++ b/protocols/Skype/res/Resource.rc @@ -43,6 +43,18 @@ BEGIN EDITTEXT IDC_PW,61,23,131,12,ES_PASSWORD | ES_AUTOHSCROLL
END
+IDD_OPTIONS DIALOGEX 0, 0, 305, 238
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "User Details",IDC_STATIC,7,7,291,60
+ LTEXT "Skype name:",IDC_STATIC,17,19,61,8
+ EDITTEXT IDC_SN,84,17,123,13,ES_AUTOHSCROLL
+ LTEXT "Password:",IDC_STATIC,17,35,61,8
+ EDITTEXT IDC_PW,84,33,123,13,ES_PASSWORD | ES_AUTOHSCROLL
+END
+
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -85,6 +97,19 @@ BEGIN TOPMARGIN, 7
BOTTOMMARGIN, 85
END
+
+ IDD_OPTIONS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ VERTGUIDE, 17
+ VERTGUIDE, 78
+ VERTGUIDE, 84
+ VERTGUIDE, 207
+ VERTGUIDE, 288
+ VERTGUIDE, 298
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 231
+ END
END
#endif // APSTUDIO_INVOKED
diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h Binary files differindex 15fc20a911..55bc8b8b3f 100644 --- a/protocols/Skype/src/resource.h +++ b/protocols/Skype/src/resource.h diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp index d3c28a0dbf..1f6edceb20 100644 --- a/protocols/Skype/src/skype.cpp +++ b/protocols/Skype/src/skype.cpp @@ -97,7 +97,7 @@ extern "C" int __declspec(dllexport) Load(void) g_skype->start();
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
- pd.szName = "Skype";
+ pd.szName = MODULE;
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)SkypeProtoInit;
pd.fnUninit = (pfnUninitProto)SkypeProtoUninit;
diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h index 8fd0390354..e71506b49b 100644 --- a/protocols/Skype/src/skype.h +++ b/protocols/Skype/src/skype.h @@ -42,6 +42,8 @@ #include "resource.h"
#include "version.h"
+#define MODULE "Skype"
+
extern HINSTANCE g_hInstance;
// skype
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index fea322746c..bcdf51063e 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -78,4 +78,96 @@ INT_PTR __cdecl CSkypeProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam) MAKEINTRESOURCE(IDD_SKYPEACCOUNT),
(HWND)lParam,
&CSkypeProto::SkypeAccountProc, (LPARAM)this);
-}
\ No newline at end of file +}
+
+INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam )
+{
+ CSkypeProto *proto;
+
+ switch ( message )
+ {
+
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwnd);
+
+ proto = reinterpret_cast<FacebookProto*>(lparam);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
+
+ DBVARIANT dbv;
+ if ( !DBGetContactSettingString(0, proto->ModuleName(), "SkypeName", &dbv))
+ {
+ SetDlgItemText(hwnd, IDC_SN, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
+
+ if ( !DBGetContactSettingString(0, proto->ModuleName(), "Password", &dbv))
+ {
+ CallService(
+ MS_DB_CRYPT_DECODESTRING,
+ wcslen(dbv.ptszVal) + 1,
+ reinterpret_cast<LPARAM>(dbv.ptszVal));
+ SetDlgItemText(hwnd, IDC_PW, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
+
+ if ( !proto->IsOffline())
+ {
+ SendMessage(GetDlgItem(hwnd, IDC_SN), EM_SETREADONLY, 1, 0);
+ SendMessage(GetDlgItem(hwnd, IDC_PW), EM_SETREADONLY, 1, 0);
+ }
+ }
+ return TRUE;
+
+ case WM_COMMAND: {
+ if (HIWORD(wparam) == EN_CHANGE && reinterpret_cast<HWND>(lparam) == GetFocus())
+ {
+ switch(LOWORD(wparam))
+ {
+ case IDC_SN:
+ case IDC_PW:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
+ {
+ proto = reinterpret_cast<CSkypeProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
+ TCHAR str[128];
+
+ GetDlgItemText(hwnd, IDC_SN, str, sizeof(str));
+ DBWriteContactSettingTString(0, proto->ModuleName(), "SkypeName", str);
+
+ GetDlgItemText(hwnd, IDC_PW, str, sizeof(str));
+ CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), reinterpret_cast<LPARAM>(str));
+ DBWriteContactSettingTString(0, proto->ModuleName(), "Password", str);
+
+ return TRUE;
+ }
+ break;
+
+ }
+
+ return FALSE;
+}
+
+int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = {0};
+ odp.cbSize = sizeof(odp);
+ odp.hInstance = g_hInstance;
+ odp.ptszTitle = m_tszUserName;
+ odp.dwInitParam = LPARAM(this);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+
+ odp.position = 271828;
+ odp.ptszGroup = LPGENT("Network");
+ odp.ptszTab = LPGENT("Account");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.pfnDlgProc = SkypeOptionsProc;
+ Options_AddPage(wParam, &odp);
+
+ return 0;
+}
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 159b64a666..65d33fa4c4 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -1 +1,18 @@ #include "skype_proto.h"
+
+void IconsLoad();
+
+int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
+{
+ IconsLoad();
+ HookEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit);
+
+ return 0;
+}
+
+int CSkypeProto::OnPreShutdown(WPARAM, LPARAM)
+{
+ SetStatus(ID_STATUS_OFFLINE);
+
+ return 0;
+}
diff --git a/protocols/Skype/src/skype_icons.cpp b/protocols/Skype/src/skype_icons.cpp new file mode 100644 index 0000000000..cbd893fb2d --- /dev/null +++ b/protocols/Skype/src/skype_icons.cpp @@ -0,0 +1,39 @@ +#include "skype_proto.h"
+
+struct _tag_iconList
+{
+ TCHAR* szDescr;
+ char* szName;
+ int defIconID;
+ HANDLE hIconLibItem;
+}
+
+static iconList[] =
+{
+ {LPGENT("Protocol icon"), "main", IDI_ICON},
+};
+
+void IconsLoad()
+{
+ TCHAR szFile[MAX_PATH];
+ char szSettingName[100];
+ SKINICONDESC sid = {0};
+ unsigned i;
+
+ GetModuleFileName(hInst, szFile, MAX_PATH);
+
+ sid.cbSize = sizeof(SKINICONDESC);
+ sid.flags = SIDF_ALL_TCHAR;
+ sid.ptszDefaultFile = szFile;
+ sid.pszName = szSettingName;
+ sid.ptszSection = _T(MODULE);
+
+ for (i = 0; i < SIZEOF(iconList); i++)
+ {
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, iconList[i].szName);
+
+ sid.ptszDescription = iconList[i].szDescr;
+ sid.iDefaultIndex = -iconList[i].defIconID;
+ iconList[i].hIconLibItem = Skin_AddIcon(&sid);
+ }
+}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index d9986db95c..297a372cbb 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -71,6 +71,7 @@ int __cdecl CSkypeProto::SendMsg( HANDLE hContact, int flags, const char* msg int __cdecl CSkypeProto::SendUrl( HANDLE hContact, int flags, const char* url ) { return 0; }
int __cdecl CSkypeProto::SetApparentMode( HANDLE hContact, int mode ) { return 0; }
+
int CSkypeProto::SetStatus(int new_status)
{
switch(new_status)
@@ -106,7 +107,14 @@ int __cdecl CSkypeProto::SetAwayMsg( int m_iStatus, const TCHAR* msg ) { retu int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type ) { return 0; }
-int __cdecl CSkypeProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ) { return 0; }
+int __cdecl CSkypeProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam )
+{
+ switch ( eventType ) {
+ case EV_PROTO_ONLOAD: return OnModulesLoaded( 0, 0 );
+ case EV_PROTO_ONEXIT: return OnPreShutdown( 0, 0 );
+ }
+ return 1;
+}
char* CSkypeProto::ModuleName()
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index c31b1f1afd..7d25d5dd49 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -61,6 +61,10 @@ public: virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam );
+ int __cdecl OnModulesLoaded(WPARAM, LPARAM);
+ int __cdecl OnPreShutdown(WPARAM, LPARAM);
+ int __cdecl OnOptionsInit(WPARAM, LPARAM);
+
char* ModuleName();
bool IsOffline();
|