annotate mcabber/mcabber/utils.h @ 2203:170597f5365b

Use more generic routines to convert fingerprints to/from hexadecimal This is a first step towards non-MD5 fingerprints; now we need Loudmouth support...
author Mikael Berthe <mikael@lilotux.net>
date Mon, 12 Oct 2015 17:19:19 +0200
parents 1591518a33b9
children 377b6a52b25f
rev   line source
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1611
diff changeset
1 #ifndef __MCABBER_UTILS_H__
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1611
diff changeset
2 #define __MCABBER_UTILS_H__ 1
24
e88b15cbf2de [/trunk] Changeset 40 by mikael
mikael
parents:
diff changeset
3
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1611
diff changeset
4 #include <mcabber/config.h>
803
8f8d8f8157a2 Take care of the strcasestr lacking (Cygwin)
Soren Andersen <somian@pobox.com>
parents: 727
diff changeset
5
1390
753a348c65c1 LocaleCharSet is const
Mikael Berthe <mikael@lilotux.net>
parents: 1292
diff changeset
6 extern const char *LocaleCharSet;
592
67a332121aea Try UTF8 -> locale conversion with fallback
Mikael Berthe <mikael@lilotux.net>
parents: 580
diff changeset
7
469
a926523d2392 Use UTF8 to handle resources and room nicknames
Mikael Berthe <mikael@lilotux.net>
parents: 452
diff changeset
8 #define to_utf8(s) ((s) ? g_locale_to_utf8((s), -1, NULL,NULL,NULL) : NULL)
592
67a332121aea Try UTF8 -> locale conversion with fallback
Mikael Berthe <mikael@lilotux.net>
parents: 580
diff changeset
9 #define from_utf8(s) ((s) ? g_convert_with_fallback((s), -1, LocaleCharSet, \
67a332121aea Try UTF8 -> locale conversion with fallback
Mikael Berthe <mikael@lilotux.net>
parents: 580
diff changeset
10 "UTF-8", NULL,NULL,NULL,NULL) : NULL)
469
a926523d2392 Use UTF8 to handle resources and room nicknames
Mikael Berthe <mikael@lilotux.net>
parents: 452
diff changeset
11
977
5b01de4ac5e1 Cosmetic changes
Alexis Hildebrandt <afh [at] 2drop [dot] net>
parents: 952
diff changeset
12 #define JID_RESOURCE_SEPARATOR '/'
5b01de4ac5e1 Cosmetic changes
Alexis Hildebrandt <afh [at] 2drop [dot] net>
parents: 952
diff changeset
13 #define JID_RESOURCE_SEPARATORSTR "/"
5b01de4ac5e1 Cosmetic changes
Alexis Hildebrandt <afh [at] 2drop [dot] net>
parents: 952
diff changeset
14 #define JID_DOMAIN_SEPARATOR '@'
5b01de4ac5e1 Cosmetic changes
Alexis Hildebrandt <afh [at] 2drop [dot] net>
parents: 952
diff changeset
15 #define JID_DOMAIN_SEPARATORSTR "@"
5b01de4ac5e1 Cosmetic changes
Alexis Hildebrandt <afh [at] 2drop [dot] net>
parents: 952
diff changeset
16
1598
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1440
diff changeset
17 char *jidtodisp(const char *fjid);
1611
f9bf561e54d0 Use the username for authentication, added jid_get_username() to utils.c
franky
parents: 1598
diff changeset
18 char *jid_get_username(const char *fjid);
2103
1210a22726d3 We can determine if the server supports carbons. By means of XEP-0030: Service
Roeland Jago Douma <roeland@famdouma.nl>
parents: 2050
diff changeset
19 char *get_servername(const char *username, const char *servername);
1598
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1440
diff changeset
20 char *compose_jid(const char *username, const char *servername,
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1440
diff changeset
21 const char *resource);
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1440
diff changeset
22 gboolean jid_equal(const char *jid1, const char *jid2);
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1440
diff changeset
23
2203
170597f5365b Use more generic routines to convert fingerprints to/from hexadecimal
Mikael Berthe <mikael@lilotux.net>
parents: 2198
diff changeset
24 void fingerprint_to_hex(const char *fpr, char *hex, size_t fpr_len);
170597f5365b Use more generic routines to convert fingerprints to/from hexadecimal
Mikael Berthe <mikael@lilotux.net>
parents: 2198
diff changeset
25 gboolean hex_to_fingerprint(const char *hex, char *fpr, size_t fpr_len);
1598
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1440
diff changeset
26
1780
e4378fbab5d7 Major API cleanup - bump API to 4
Mikael Berthe <mikael@lilotux.net>
parents: 1674
diff changeset
27 void ut_init_debug(void);
e4378fbab5d7 Major API cleanup - bump API to 4
Mikael Berthe <mikael@lilotux.net>
parents: 1674
diff changeset
28 void ut_write_log(unsigned int flag, const char *data);
24
e88b15cbf2de [/trunk] Changeset 40 by mikael
mikael
parents:
diff changeset
29
1167
9726c78a91f3 Allow '~' (HOME directory) in config options
Mikael Berthe <mikael@lilotux.net>
parents: 1106
diff changeset
30 char *expand_filename(const char *fname);
9726c78a91f3 Allow '~' (HOME directory) in config options
Mikael Berthe <mikael@lilotux.net>
parents: 1106
diff changeset
31
362
d8f147d6e872 Check directory and config file permissions
Mikael Berthe <mikael@lilotux.net>
parents: 281
diff changeset
32 int checkset_perm(const char *name, unsigned int setmode);
d8f147d6e872 Check directory and config file permissions
Mikael Berthe <mikael@lilotux.net>
parents: 281
diff changeset
33
524
05c0e55c4bb1 Pass message body to external command
Mikael Berthe <mikael@lilotux.net>
parents: 469
diff changeset
34 const char *ut_get_tmpdir(void);
05c0e55c4bb1 Pass message body to external command
Mikael Berthe <mikael@lilotux.net>
parents: 469
diff changeset
35
241
8584f919d9b9 [/trunk] Changeset 254 by mikael
mikael
parents: 138
diff changeset
36 int to_iso8601(char *dststr, time_t timestamp);
8584f919d9b9 [/trunk] Changeset 254 by mikael
mikael
parents: 138
diff changeset
37 time_t from_iso8601(const char *timestamp, int utc);
8584f919d9b9 [/trunk] Changeset 254 by mikael
mikael
parents: 138
diff changeset
38
1292
382ec54b584e Muc nick coloring functionality
Michal 'vorner' Vaner <vorner@ucw.cz>
parents: 1203
diff changeset
39 int check_jid_syntax(const char *fjid);
452
dfd9c62b3a39 Jabber Id syntax checks
Mikael Berthe <mikael@lilotux.net>
parents: 419
diff changeset
40
1413
f89844a0448a Remove useless inlines
Mikael Berthe <mikael@lilotux.net>
parents: 1390
diff changeset
41 void mc_strtolower(char *str);
452
dfd9c62b3a39 Jabber Id syntax checks
Mikael Berthe <mikael@lilotux.net>
parents: 419
diff changeset
42
554
2424bbf0a6db Some more work on do_room()
Mikael Berthe <mikael@lilotux.net>
parents: 551
diff changeset
43 void strip_arg_special_chars(char *s);
2424bbf0a6db Some more work on do_room()
Mikael Berthe <mikael@lilotux.net>
parents: 551
diff changeset
44 char **split_arg(const char *arg, unsigned int n, int dontstriplast);
551
c71699efa5cc Add split_arg() / free_arg_lst()
Mikael Berthe <mikael@lilotux.net>
parents: 524
diff changeset
45 void free_arg_lst(char **arglst);
c71699efa5cc Add split_arg() / free_arg_lst()
Mikael Berthe <mikael@lilotux.net>
parents: 524
diff changeset
46
655
de6837908702 Use "(...)" when cutting a multi-line status message in the log window
Mikael Berthe <mikael@lilotux.net>
parents: 592
diff changeset
47 void replace_nl_with_dots(char *bufstr);
727
1c3620668857 Expand tabs when reading history files
Mikael Berthe <mikael@lilotux.net>
parents: 655
diff changeset
48 char *ut_expand_tabs(const char *text);
2050
998feaa54ef0 Add ut_unescape_tabs_cr()
Mikael Berthe <mikael@lilotux.net>
parents: 1811
diff changeset
49 char *ut_unescape_tabs_cr(const char *text);
655
de6837908702 Use "(...)" when cutting a multi-line status message in the log window
Mikael Berthe <mikael@lilotux.net>
parents: 592
diff changeset
50
803
8f8d8f8157a2 Take care of the strcasestr lacking (Cygwin)
Soren Andersen <somian@pobox.com>
parents: 727
diff changeset
51 #if !defined (HAVE_STRCASESTR)
8f8d8f8157a2 Take care of the strcasestr lacking (Cygwin)
Soren Andersen <somian@pobox.com>
parents: 727
diff changeset
52 char *strcasestr(const char *haystack, const char *needle);
24
e88b15cbf2de [/trunk] Changeset 40 by mikael
mikael
parents:
diff changeset
53 #endif
576
8b3db0b555a1 Add Vim modelines
Mikael Berthe <mikael@lilotux.net>
parents: 554
diff changeset
54
1203
c96fef31ff96 Expand startswith()
Mikael Berthe <mikael@lilotux.net>
parents: 1192
diff changeset
55 int startswith(const char *str, const char *word, guint ignore_case);
1192
7b8765c10abb New command: /source
Mikael Berthe <mikael@lilotux.net>
parents: 1167
diff changeset
56
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1611
diff changeset
57 #endif // __MCABBER_UTILS_H__
803
8f8d8f8157a2 Take care of the strcasestr lacking (Cygwin)
Soren Andersen <somian@pobox.com>
parents: 727
diff changeset
58
1811
e6d355e50d7a Update Vim modelines
Mikael Berthe <mikael@lilotux.net>
parents: 1780
diff changeset
59 /* vim: set et cindent cinoptions=>2\:2(0 ts=2 sw=2: For Vim users... */