Updated Changelog
[centerim.git] / src / icqface.h
blob3ba0ad1b0c83664abc66d0172c40b035b6e08557
1 #ifndef __ICQFACE_H__
2 #define __ICQFACE_H__
4 #include "icqcommon.h"
6 #include "dialogbox.h"
7 #include "textinputline.h"
8 #include "texteditor.h"
9 #include "textbrowser.h"
10 #include "fileselector.h"
12 #include "icqconf.h"
13 #include "icqcontact.h"
14 #include "icqmlist.h"
15 #include "imcontroller.h"
17 #define ASK_YES 2
18 #define ASK_NO 4
19 #define ASK_CANCEL 8
21 enum interfaceAction {
22 ACT_QUIT = -50, ACT_MSG, ACT_URL, ACT_STATUS, ACT_REMOVE, ACT_SMS,
23 ACT_CHAT, ACT_FIND, ACT_INFO, ACT_HISTORY, ACT_IGNORE, ACT_ADD,
24 ACT_MENU, ACT_IGNORELIST, ACT_DETAILS, ACT_GMENU, ACT_CONF, ACT_RENAME,
25 ACT_PING, ACT_EDITUSER, ACT_VISIBLELIST, ACT_INVISLIST, ACT_QUICKFIND,
26 ACT_FILE, ACT_GROUPMOVE, ACT_ORG_GROUPS, ACT_HIDEOFFLINE, ACT_FETCHAWAY,
27 ACT_EMAIL, ACT_AUTH, ACT_CONTACT, ACT_VERSION, ACT_JOIN, ACT_LEAVE,
28 ACT_CONFER, ACT_TRANSFERS, ACT_JOINDIALOG, ACT_EXTERN, ACT_RSS, ACT_LJ,
29 ACT_MASS_MOVE, ACT_PGPKEY, ACT_PGPSWITCH, ACT_OTR, ACT_DUMMY
32 extern class centerim cicq;
34 class icqface {
35 public:
36 enum eventviewresult {
37 ok, next, cancel, forward, reply, open, accept, reject, info,
38 add, prev, eventviewresult_size
41 enum transferstatus {
42 tsInit,
43 tsStart,
44 tsProgress,
45 tsFinish,
46 tsError,
47 tsCancel
50 enum findsubject {
51 fsuser,
52 fschannel,
53 fsrss,
54 fs_size
57 class icqprogress {
58 protected:
59 textwindow *w;
60 int curline;
62 public:
63 icqprogress();
64 ~icqprogress();
66 void log(const char *fmt, ...);
67 void show(const string &title = "");
68 void hide();
69 } progress;
71 struct { int x1, y1, x2, y2; } sizeWArea;
72 struct { int width, height; } sizeDlg, sizeBigDlg;
74 protected:
75 treeview *mcontacts;
76 textinputline input;
77 textwindow mainw;
78 fileselector selector;
79 verticalmenu mhist;
81 ofstream flog;
82 vector<string> extractedurls, lastlog, fstatus;
84 linkedlist workareas;
86 bool editdone, mainscreenblock, inited, onlinefolder,
87 dotermresize, fneedupdate, detailsfetched, inchat, doredraw;
89 int chatlines;
91 time_t chatlastread;
93 imcontact passinfo;
94 const imevent *passevent;
96 icqcontact *last_selected;
97 int find_next_action;
99 struct filetransferitem {
100 string fname;
101 int btotal, bdone;
102 transferstatus status;
103 imfile fr;
105 filetransferitem(const imfile &afr)
106 : btotal(0), bdone(0), fr(afr) { }
109 vector<filetransferitem> transfers;
111 protected:
112 static int editmsgkeys(texteditor &e, int k);
113 static int editaboutkeys(texteditor &e, int k);
114 static int contactskeys(verticalmenu &m, int k);
115 static int multiplekeys(verticalmenu &m, int k);
116 static int historykeys(dialogbox &m, int k);
117 static int userinfokeys(dialogbox &db, int k);
118 static int findreskeys(dialogbox &db, int k);
119 static int eventviewkeys(dialogbox &db, int k);
120 static int findpgpkeys(dialogbox &db, int k);
121 static int statuskeys(verticalmenu &m, int k);
122 static int fullscreenkeys(textbrowser &m, int k);
124 static void editidle(texteditor &e);
125 static void textbrowseridle(textbrowser &b);
126 static void textinputidle(textinputline &il);
127 static void freeworkareabuf(void *p);
128 static void detailsidle(dialogbox &db);
129 static void transferidle(dialogbox &db);
130 static void editchatidle(texteditor &e);
132 static const unsigned int MinPanelWidth = 4;
133 static const unsigned int MinPanelHeight = 4;
135 static void termresize(void);
137 void infoclear(dialogbox &db, icqcontact *c, const imcontact realdesc);
138 void infogeneral(dialogbox &db, icqcontact *c);
139 void infohome(dialogbox &db, icqcontact *c);
140 void infowork(dialogbox &db, icqcontact *c);
141 void infointerests(dialogbox &db, icqcontact *c);
142 void infoabout(dialogbox &db, icqcontact *c);
144 void inforss(dialogbox &db, icqcontact *c);
145 void infolivejournal(dialogbox &db, icqcontact *c);
146 void infofriends(dialogbox &db, icqcontact *c);
147 void infoljrss(dialogbox &db, icqcontact *c);
149 void gendetails(treeview *tree, icqcontact *c = 0);
151 void selectgender(imgender &f);
152 void selectcountry(unsigned short &f);
153 void selectlanguage(unsigned short &f);
154 void selectagerange(ICQ2000::AgeRange &r);
155 void selectrandomgroup(unsigned short &f);
157 enum spmode { spIMonly, spIMplusRSS, spnonIM };
158 void selectproto(bool prots[], spmode mode = spIMonly);
160 void workarealine(int l, chtype c = HLINE);
162 void showextractedurls();
163 void extracturls(const string &buf);
165 int groupmanager(const string &text, bool sel);
167 void renderchathistory();
168 bool sprofmanager(string &name, string &act);
169 void showeventbottom(const imcontact &ic);
171 void invokelist(string &s, vector<string> &v, const string &def, textwindow *w);
172 bool setljparams(imxmlevent *ev);
173 void multichange(bool conv[], bool newstate);
175 string extracttime(const imevent &ev);
176 void peerinfo(int line, const imcontact &ic);
177 void findpgpkey(dialogbox &db, const vector<string> &items);
179 string getprotocolchar(protocolname pname) const;
181 public:
182 int extk;
183 vector<imcontact> muins;
185 icqface();
186 ~icqface();
188 void init();
189 void done();
191 static void menuidle(verticalmenu &caller);
192 static void dialogidle(dialogbox &caller);
194 string getmenuitem(string mtext, int width, int key, int section);
195 string getstatkey(int key, int section) const;
197 void redraw();
199 void draw();
200 void update();
201 void showtopbar();
203 void clearworkarea();
204 void saveworkarea();
205 void restoreworkarea();
207 void relaxedupdate();
208 bool updaterequested();
210 int key2action(int k, int s);
211 string action2key(int a, int s, int n = 1) const;
213 icqcontact *find_next_chat();
214 bool next_chat(bool next = true);
216 icqcontact *mainloop(int &action);
217 void fillcontactlist();
219 void log(const string &text);
220 void log(const char *fmt, ...);
222 void status(const string &text);
223 void status(const char *fmt, ...);
225 void xtermtitle(const string &text = "");
226 void xtermtitle(const char *fmt, ...);
227 void xtermtitlereset();
229 bool changestatus(vector<protocolname> &pnames, imstatus &st);
230 int contextmenu(icqcontact *c);
231 int generalmenu();
233 void modelist(contactstatus cs);
235 bool multicontacts(const string &head = "",
236 const set<protocolname> &protos = set<protocolname>(),
237 contactstatus cs = csnone);
239 void userinfo(const imcontact &cinfo, const imcontact &realinfo);
241 bool updateconf(icqconf::regsound &s, icqconf::regcolor &c);
243 bool finddialog(imsearchparams &s, findsubject subj);
244 bool findresults(const imsearchparams &sp, bool auto = false);
245 void findready();
247 bool conferencedialog(protocolname &pname, string &name);
249 bool updatedetails(icqcontact *c = 0, protocolname upname = icq);
250 bool sendfiles(const imcontact &cinfo, string &msg, linkedlist &flist);
252 void blockmainscreen();
253 void unblockmainscreen();
255 int ask(string q, int options, int deflt = -1);
257 string inputstr(const string &q, const string &defl = "", char passwdchar = 0);
258 string inputfile(const string &q, const string &defl = "");
259 string inputdir(const string &q, const string &defl = "");
261 int getlastinputkey() const;
263 void quickfind(verticalmenu *multi = 0);
265 int selectgroup(const string &text);
267 void makeprotocolmenu(verticalmenu &m);
269 void organizegroups();
271 void histmake(const vector<imevent *> &hist);
272 bool histexec(imevent *&im);
274 bool eventedit(imevent &ev);
276 eventviewresult eventview(const imevent *ev,
277 vector<eventviewresult> abuttons = vector<eventviewresult>(),
278 bool nobuttons = false);
280 void fullscreenize(const imevent *ev);
282 bool edit(string &txt, const string &header);
283 bool chat(const imcontact &ic);
285 void transferupdate(const string &fname, const imfile &fr,
286 transferstatus st, int btotal, int bdone);
288 void transfermonitor();
289 void userinfoexternal(const imcontact &ic);
291 bool selectpgpkey(string &keyid, bool secretonly = false);
292 void leftpanelwidth_inc(const int inc);
293 void logpanelheight_inc(const int inc);
294 void chatpanelheight_inc(const int inc);
295 bool stay_in_chat ;
298 extern icqface face;
300 string getbdate(unsigned char fbday, unsigned char fbmonth, unsigned char fbyear);
302 const char *strregsound(icqconf::regsound s);
303 const char *strregcolor(icqconf::regcolor c);
304 const char *strcolormode(icqconf::colormode cm);
305 const char *strint(unsigned int i);
306 const char *strgroupmode(icqconf::groupmode gmode);
307 const char *stryesno(bool b);
308 const char *strgender(imgender g);
309 const char *seteventviewresult(icqface::eventviewresult r);
311 #endif