1 /*
2 ** TleenX2 (Tlen.pl Client)
3 ** Copyright (c) 2002-2003 Hubert Soko�owski <who_ami@tlen.pl>
4 **                         Pawe� Bili�ski <rael@fr.pl>
5 **
6 ** This code is free software; you can redistribute it and/or
7 ** modify it under the terms of the GNU General Public License.
8 **
9 */
10 
11 
12 #ifndef __CONFFILE_H__
13 #define __CONFFILE_H__
14 
15 #include <gtk/gtk.h>
16 #include <time.h>
17 
18 #define MAX_SNAME 40 //maksymalna dlugosc nazwy sekcji w pliku konf
19 #define MAX_CHATBUF 10000 //maksymalna dlugosc kolejki (ilosc bajtow)
20 //wiadomosci do zapisu
21 #define MAX_VARNAME 30 //maksymalna dlugosc zmiennej w pliku preferencji
22 #define MAX_VALLEN 120 //maksymalna dlugosc zmiennej w pliku preferencji
23 #define MAX_LLEN (MAX_VARNAME+MAX_VALLEN+2) //maksymalna dlugosc linii w pliku konf razem ze znakiem
24 //konca linii
25 #define MAX_ARCH_LEN 400000 //maksymalna dlugosc pliku archiwum w bajtach
26 
27 #define PREF_NEWMAIL (1<<0)
28 #define PREF_SAVESTAT (1<<1)
29 #define PREF_BEEPONM (1<<2)//powiadomienie gdy jest nowa wiadomosc
30 #define PREF_BEEPONS (1<<3)//dostepna nowa osoba
31 #define PREF_GROUPS_NONE (1<<4)
32 #define PREF_GROUPS_TABS_UP (1<<5)
33 #define PREF_GROUPS_TABS_LEFT (1<<6)
34 #define PREF_GROUPS_LIST (1<<7)
35 #define PREF_INFO_MENU (1<<8)// tu tak naprawde chodzi o opisy na liscie
36 #define PREF_BEEPONA (1<<9)//prosba o autoryzacje
37 #define PREF_BEEPONN (1<<10)//nowa poczta
38 #define PREF_BEEPONW (1<<11)//wiadomosc wyslana z bramki
39 #define PREF_ENTERON (1<<12)//zapamietuje wcisniety enter
40 #define PREF_DEBUGON (1<<13)//wypisuje komunikaty na konsole
41 #define PREF_LIST_EXPANDED (1<<14)//domyslnie rozwija liste kontaktow
42 #define PREF_HIDE_OFFLINE (1<<15)//ukrywa niedostepnych
43 #define PREF_JABBER_CONNECT (1<<16)//laczy z serwerem jabbera przy logowaniu
44 #define PREF_HIDE_INVISIBLE (1<<17)//ukrywa niewidocznych
45 #define PREF_BEEPONT (1<<18)//powiadamiaj podczas rozmowy
46 #define PREF_LASTLOGIN (1<<19)//ustaw biezacy profil jako domyslny
47 #define PREF_AUTOAWAY (1<<20)//automatycznie zmieniaj status
48 #define PREF_XMMS_INFO (1<<21)//pobiera aktualnie grana piosenkle z xmms-info
49 
50 #define MESSAGE_FROM 0
51 #define MESSAGE_TO 1
52 
53 #define MAX_SOUNDS 6
54 enum{SOUNDM, SOUNDT, SOUNDS, SOUNDA, SOUNDN, SOUNDW};
55 
56 struct profile
57 {
58   gchar *pname;
59   //tlen
60   gchar *login;
61   gchar *password;
62   //jabber
63   gchar *jserver;
64   gchar *jlogin;
65   gchar *jpassword;
66   gchar *jresource;
67   //gg
68   gchar *ggnumber;
69   gchar *ggpassword;
70   gchar *ggserver;
71   //jid bramki sms
72   gchar *sms;
73   //id do bramki sms
74   gchar *smsid;
75   //haslo do bramki sms
76   gchar *smspassword;
77 };
78 
79 struct chat
80 {
81   gchar *jid;
82   gint from;
83   struct tm time;
84   gchar *message;
85 };
86 
87 struct contact
88 {
89   gchar *jid;
90   gchar *firstname;
91   gchar *surname;
92   gchar *phone;
93   gchar *address;
94   gchar *email;
95   gchar *birthday;
96   gchar *about;
97 };
98 
99 int create_dir();
100 int create_file();
101 void profile_jabber(const gchar *pname, const gchar *jserver,
102                     const gchar *jlogin,
103                     const gchar *jpassword,
104                     const gchar *jresource);
105 void profile_gg(const gchar *pname,
106                 const gchar *ggnumber,
107                 const gchar *ggpassword);
108 void profile_sms(const gchar *pname,
109                  const gchar *id,
110                  const gchar *password);
111 void add_profile(const gchar *pname,
112                  const gchar *login, const gchar *password);
113 void del_profile(const gchar *pname);
114 void profiles_list_clear();
115 void load_profiles();
116 struct profile *get_profile(const gchar *pname);
117 void load_combo();
118 int save_message(const gchar *jid, gchar *message, gint from);
119 void queue_chat(const gchar *jid, gchar *message, gint from);
120 int chat_list_flush();
121 int save_preferences();
122 int read_preferences();
123 gboolean arch_too_big(const gchar *filename);
124 void arch_move();
125 int read_contacts();
126 int save_contacts();
127 struct contact* get_contact(gchar *jid);
128 void contacts_list_clear();
129 void remove_contact(gchar *jid);
130 gboolean last_login();
131 
132 
133 #endif
134