12 #include "kkstrtext.h"
14 #include "conscommon.h"
15 #include "colorschemer.h"
21 enum cicq_colorpairs
{
33 cp_main_history_incoming
,
34 cp_main_history_outgoing
,
51 cp_clist_free_for_chat
,
57 enum cicq_keybindings
{
66 key_fetch_away_message
,
70 key_contact_external_action
,
90 key_multiple_recipients
,
91 key_user_external_action
,
92 key_left_panel_move_right
,
93 key_left_panel_move_left
,
94 key_log_panel_move_up
,
95 key_log_panel_move_down
,
96 key_chat_panel_move_up
,
97 key_chat_panel_move_down
,
98 key_otr_start_session
,
104 enum regsound
{ rscard
, rsspeaker
, rsdisable
, rsdontchange
};
105 enum regcolor
{ rcdark
, rcblue
, rcdontchange
};
106 enum groupmode
{ group1
, group2
, nogroups
};
107 enum colormode
{ cmproto
, cmstatus
};
108 // leave the sort_by_nb_of_sorts as the last value
109 // do not forget to add the new sort types to the icqcontacts.cc
110 enum sortmode
{ sort_by_status_and_activity
,
111 sort_by_status_and_name
,
114 sort_by_nb_of_sorts
};
118 int port
, secureport
;
122 int section
, key
, action
;
128 imaccount(protocolname apname
);
130 string nickname
, server
, password
;
131 unsigned long uin
, port
;
133 map
<string
, string
> additional
;
135 void write(ofstream
&f
);
136 void read(const string
&spec
);
140 bool operator == (protocolname apname
) const;
141 bool operator != (protocolname apname
) const;
144 static imserver defservers
[];
146 static vector
<keybinding
> keys
;
150 icqconf(const icqconf
&);
151 icqconf
& operator=(const icqconf
&);
153 vector
<icqgroup
> groups
;
154 vector
<imaccount
> accounts
;
156 unsigned short socksport
, smtpport
, httpproxyport
;
158 int autoaway
, autona
, ptpmin
, ptpmax
;
160 bool hideoffline
, quote
, savepwd
, antispam
, screenna
, mailcheck
,
161 makelog
, fenoughdiskspace
, askaway
, bidi
, logtimestamps
,
162 logonline
, emacs
, proxyconnect
, proxyssl
, notitles
, debug
,
163 timestampstothesecond
, dropauthreq
, usingcaptcha
, askquit
,
164 showopenedchats
, vi
, autoawayx
;
166 unsigned int captchatimeout
;
170 bool chatmode
[protocolname_size
];
171 bool cpconvert
[protocolname_size
];
172 bool entersends
[protocolname_size
];
173 bool nonimonline
[protocolname_size
];
174 bool docaptcha
[protocolname_size
];
176 string sockshost
, socksuser
, sockspass
, basedir
, argv0
, smtphost
,
177 bindhost
, httpproxyhost
, httpproxyuser
, httpproxypasswd
,
178 fromcharset
, tocharset
, browser
, screensocketpath
,
179 captchagreet
, captchasuccess
, captchafailure
;
181 char *DEFAULT_TIMESTAMP_FORMAT
, *DEFAULT_LOGTIMESTAMP_FORMAT
,
182 *SECONDS_TIMESTAMP_FORMAT
, *SECONDS_LOGTIMESTAMP_FORMAT
;
184 char *timestampformat
, *logtimestampformat
;
186 map
<string
, string
> actions
;
190 groupmode fgroupmode
;
197 string defaultAuthMessage
;
199 colorschemer
<cicq_colorpairs
> schemer
;
201 void loadmainconfig();
204 void constructevent(const string
&event
, const string
&proto
,
205 const string
&dest
, const string
&number
) const;
207 void externalstatuschange(char st
, const string
&proto
) const;
208 void initmultiproto(bool p
[], string buf
, bool excludenochat
);
210 void selfsignal(int signum
) const;
214 static icqconf
* instance();
220 int getcolor(cicq_colorpairs cp
) const { return schemer
[cp
]; }
222 int getprotcolor(protocolname pname
) const;
224 int getstatuscolor(imstatus status
) const;
234 regcolor
getregcolor() const;
235 void setregcolor(regcolor c
);
237 regsound
getregsound() const;
238 void setregsound(regsound s
);
240 colormode
getcolormode() const;
241 void setcolormode(colormode c
);
243 bool getemacs() const { return emacs
; }
244 void setemacs(bool fem
);
246 bool getvi() const { return vi
; }
249 bool gethideoffline() const { return hideoffline
; }
250 void sethideoffline(bool fho
);
252 bool getantispam() const { return antispam
; }
253 void setantispam(bool fas
);
255 bool getdropauthreq() const { return dropauthreq
; }
256 void setdropauthreq(bool fas
);
258 bool getusingcaptcha() const { return usingcaptcha
; }
259 void setusingcaptcha(bool fas
);
261 bool getmailcheck() const { return mailcheck
; }
262 void setmailcheck(bool fmc
);
264 void getauto(int &away
, int &na
, bool& usex
) const;
265 void setauto(int away
, int na
, bool usex
);
267 bool getscreenna() const;
268 void setscreenna(bool screenna
);
270 string
getscreensocketpath() const;
271 void setscreensocketpath(string path
);
273 bool getquote() const { return quote
; }
274 void setquote(bool use
);
276 bool getsavepwd() const { return savepwd
; }
277 void setsavepwd(bool ssave
);
279 bool getmakelog() const { return makelog
; }
280 void setmakelog(bool slog
);
282 bool getproxyconnect() const { return proxyconnect
; }
283 void setproxyconnect(bool proxyconnect
);
285 bool getproxyssl() const { return proxyssl
; }
286 void setproxyssl(bool sproxyssl
);
288 bool getcpconvert(protocolname pname
) const;
289 void setcpconvert(protocolname pname
, bool fcpconvert
);
291 bool getbidi() const { return bidi
; }
292 void setbidi(bool fbidi
);
294 bool getaskaway() const { return askaway
; }
295 void setaskaway(bool faskaway
);
297 bool getchatmode(protocolname pname
);
298 void setchatmode(protocolname pname
, bool fchatmode
);
300 bool getaskquit() const { return askquit
; }
301 void setaskquit(bool faskquit
);
303 bool getentersends(protocolname pname
);
304 void setentersends(protocolname pname
, bool fentersends
);
306 bool getnonimonline(protocolname pname
);
307 void setnonimonline(protocolname pname
, bool fnonimonline
);
309 bool gettimestampstothesecond() const { return timestampstothesecond
; }
310 void settimestampstothesecond(bool ftimestampstothesecond
);
312 char *gettimestampformat() const { return timestampformat
; } ;
313 char *getlogtimestampformat() const { return logtimestampformat
; } ;
315 groupmode
getgroupmode() const { return fgroupmode
; }
316 void setgroupmode(groupmode amode
);
318 sortmode
getsortmode() const { return fsortmode
; }
319 void setsortmode(sortmode smode
);
321 string
getsockshost() const;
322 unsigned int getsocksport() const;
323 void setsockshost(const string
&nsockshost
);
325 string
getsmtphost() const;
326 unsigned int getsmtpport() const;
327 void setsmtphost(const string
&asmtphost
);
329 string
getbrowser() const;
330 void setbrowser(const string
&abrowser
);
332 string
gethttpproxyhost() const;
333 unsigned int gethttpproxyport() const;
334 void sethttpproxyhost(const string
&ahttpproxyhost
);
335 string
gethttpproxyuser() const;
336 string
gethttpproxypasswd() const;
338 void getsocksuser(string
&name
, string
&pass
) const;
339 void setsocksuser(const string
&name
, const string
&pass
);
341 void getpeertopeer(int &min
, int &max
) const { min
= ptpmin
; max
= ptpmax
; }
342 void setpeertopeer(int min
, int max
) { ptpmin
= min
; ptpmax
= max
; }
344 bool getshowopenedchats() const { return showopenedchats
; }
345 void setshowopenedchats(bool fsoc
);
347 string
execaction(const string
&action
, const string
¶m
= "");
349 imstatus
getstatus(protocolname pname
);
350 void savestatus(protocolname pname
, imstatus st
);
351 void setavatar(protocolname pname
, const string
&ava
);
353 string
getprotocolname(protocolname pname
) const;
354 protocolname
getprotocolbyletter(char letter
) const;
355 string
getprotocolprefix(protocolname pname
) const;
357 int getouridcount() const { return accounts
.size(); }
358 imaccount
getourid(protocolname pname
) const;
359 void setourid(const imaccount
&im
);
361 string
getawaymsg(protocolname pname
) const;
362 string
getextstatus(protocolname pname
, imstatus status
) const;
363 void setawaymsg(protocolname pname
, const string
&amsg
);
364 void setextstatus(protocolname pname
, const string
&amsg
, imstatus status
);
366 string
getdirname() const { return basedir
; }
367 string
getconfigfname(const string
&fname
) const { return getdirname() + fname
; }
369 void commandline(int argc
, char **argv
);
371 bool enoughdiskspace() const { return fenoughdiskspace
; }
372 void checkdiskspace();
374 string
getbindhost() const { return bindhost
; }
376 void getlogoptions(bool &flogtimestamps
, bool &flogonline
)
377 { flogtimestamps
= logtimestamps
, flogonline
= logonline
; }
379 void setlogoptions(bool flogtimestamps
, bool flogonline
)
380 { logtimestamps
= flogtimestamps
, logonline
= flogonline
; }
382 void setcharsets(const string
&from
, const string
&to
);
384 const char *getconvertfrom(protocolname pname
= protocolname_size
) const;
385 const char *getconvertto(protocolname pname
= protocolname_size
) const;
387 bool getxtitles() const { return !notitles
; }
388 bool getdebug() const { return debug
; }
390 int getleftpanelwidth() const { return leftpanelwidth
; }
391 void setleftpanelwidth(const int width
) { leftpanelwidth
= width
; }
392 int getlogpanelheight() const { return logpanelheight
; }
393 void setlogpanelheight(const int height
) { logpanelheight
= height
; }
394 int getchatpanelheight() const { return chatpanelheight
; }
395 void setchatpanelheight(const int height
) { chatpanelheight
= height
; }
397 string
getDefaultAuthMessage() const { return defaultAuthMessage
; }
398 void setDefaultAuthMessage(const string m
) { defaultAuthMessage
= m
; }
400 string
getcaptchagreet() const { return captchagreet
; }
401 string
getcaptchasuccess() const { return captchasuccess
; }
402 string
getcaptchafailure() const { return captchafailure
; }
403 unsigned int getcaptchatimeout() const { return captchatimeout
; }
408 static icqconf
* self
;
412 extern icqconf
* conf
;