summaryrefslogtreecommitdiff
path: root/plugins/Watrack/lastfm/i_last_opt.inc
blob: 9628dcf1632f11ca5df342883685e9e6f72831ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{}
const
  optLogin   :pAnsiChar='lfm/login';
  optPassword:pAnsiChar='lfm/password';
  optTries   :pAnsiChar='lfm/tries';
  optScrobble:pAnsiChar='lfm/scrobble';
  optLanguage:pAnsiChar='lfm/language';

procedure SaveOpt;
begin
  DBWriteString(0,PluginShort,optPassword,lfm_password);
  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_login=nil) or (lfm_password=nil) then
    PUShowMessageW(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;