summaryrefslogtreecommitdiff
path: root/plugins/Watrack/lastfm/i_last_opt.inc
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-10-08 18:43:29 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-10-08 18:43:29 +0000
commit864081102a5f252415f41950b3039a896b4ae9c5 (patch)
treec6b764651e9dd1f8f53b98eab05f16ba4a492a79 /plugins/Watrack/lastfm/i_last_opt.inc
parentdb5149b48346c417e18add5702a9dfe7f6e28dd0 (diff)
Awkwars's plugins - welcome to our trunk
git-svn-id: http://svn.miranda-ng.org/main/trunk@1822 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack/lastfm/i_last_opt.inc')
-rw-r--r--plugins/Watrack/lastfm/i_last_opt.inc44
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/Watrack/lastfm/i_last_opt.inc b/plugins/Watrack/lastfm/i_last_opt.inc
new file mode 100644
index 0000000000..f18b590a87
--- /dev/null
+++ b/plugins/Watrack/lastfm/i_last_opt.inc
@@ -0,0 +1,44 @@
+{}
+const
+ optLogin :pAnsiChar='lfm/login';
+ optPassword:pAnsiChar='lfm/password';
+ optTries :pAnsiChar='lfm/tries';
+ optScrobble:pAnsiChar='lfm/scrobble';
+ optLanguage:pAnsiChar='lfm/language';
+
+procedure SaveOpt;
+var
+ tmppass:array [0..255] of AnsiChar;
+begin
+ if lfm_password<>nil then
+ begin
+ StrCopy(tmppass,lfm_password);
+ CallService(MS_DB_CRYPT_ENCODESTRING,StrLen(tmppass)+1,lparam(@tmppass));
+ end;
+ DBWriteString(0,PluginShort,optPassword,tmppass);
+ DBWriteString(0,PluginShort,optLogin ,lfm_login);
+ DBWriteByte (0,PluginShort,optTries ,lfm_tries);
+ DBWriteByte (0,PluginShort,optScrobble,lfm_on and 1);
+ DBWriteWord (0,PluginShort,optLanguage,lfm_lang);
+end;
+
+procedure LoadOpt;
+begin
+ lfm_lang :=DBReadWord(0,PluginShort,optLanguage,0);
+ lfm_tries:=DBReadByte(0,PluginShort,optTries ,3);
+ lfm_on :=DBReadByte(0,PluginShort,optScrobble,0);
+ mFreeMem(lfm_login ); lfm_login :=DBReadString(0,PluginShort,optLogin);
+ mFreeMem(lfm_password); lfm_password:=DBReadString(0,PluginShort,optPassword);
+ if lfm_password<>nil then
+ CallService(MS_DB_CRYPT_DECODESTRING,StrLen(lfm_password)+1,lparam(lfm_password));
+ if (lfm_login=nil) or (lfm_password=nil) then
+ CallService(MS_POPUP_SHOWMESSAGEW,
+ wparam(TranslateW('Don''t forget to enter Login and Password to use Last.fm service')),
+ SM_WARNING);
+end;
+
+procedure FreeOpt;
+begin
+ mFreeMem(lfm_login);
+ mFreeMem(lfm_password);
+end;