xmppc
0.0.1
XMPP Command Line Client
src
xmppc.h
1
/*
2
* @file xmppc.h
3
*
4
* vim: expandtab:ts=2:sts=2:sw=2
5
*
6
* @copyright
7
*
8
* Copyright (C) 2020 Anoxinon e.V.
9
*
10
* This file is part of xmppc.
11
*
12
* xmppc is free software: you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation, either version 3 of the License, or
15
* (at your option) any later version.
16
*
17
* xmppc is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
24
*
25
* German
26
*
27
* Diese Datei ist Teil von xmppc.
28
*
29
* xmppc ist Freie Software: Sie können es unter den Bedingungen
30
* der GNU General Public License, wie von der Free Software Foundation,
31
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
32
* veröffentlichten Version, weiter verteilen und/oder modifizieren.
33
*
34
* xmppc wird in der Hoffnung, dass es nützlich sein wird, aber
35
* OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
36
* Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
37
* Siehe die GNU General Public License für weitere Details.
38
*
39
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
40
* Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.
41
*/
42
43
#ifndef XMPPC_XMPPC_H__
44
#define XMPPC_XMPPC_H__
45
46
#include "config.h"
47
48
#include <stdarg.h>
49
#include <stdio.h>
50
#include <strophe.h>
51
#include <unistd.h>
52
53
#define ANSI_COLOR_RED "\x1b[31m"
54
#define ANSI_COLOR_GREEN "\x1b[32m"
55
#define ANSI_COLOR_YELLOW "\x1b[33m"
56
#define ANSI_COLOR_BLUE "\x1b[34m"
57
#define ANSI_COLOR_MAGENTA "\x1b[35m"
58
#define ANSI_COLOR_CYAN "\x1b[36m"
59
60
#define ANSI_COLOR_B_RED "\x1b[91m"
61
62
#define ANSI_COLOR_RESET "\x1b[m"
63
68
typedef
enum
loglevel {
69
ERROR = 0,
70
WARN = 1,
71
INFO = 2,
72
DEBUG = 3,
73
TRACE = 4
74
} loglevel_t;
75
76
typedef
enum
mode {
77
UNKOWN,
78
ACCOUNT,
79
ROSTER,
80
MESSAGE,
81
MUC,
82
OMEMO,
83
PGP,
84
OPENPGP,
85
MONITOR,
86
MAM,
87
DISCOVERY,
88
BOOKMARK
89
} xmppc_mode_t;
90
91
typedef
struct
{
93
loglevel_t
loglevel
;
94
xmpp_ctx_t *ctx;
95
xmpp_conn_t *conn;
96
xmppc_mode_t mode;
97
}
xmppc_t
;
98
99
#define INIT_XMPPC(X) xmppc_t X = {.loglevel = ERROR, .ctx = NULL, .conn = NULL, .mode = UNKOWN}
100
101
typedef
void (*ExecuteHandler)(
xmppc_t
*, int,
char
**);
102
103
void
logError
(
xmppc_t
*
xmppc_t
,
const
char
*fmt, ...);
104
105
void
logWarn(
xmppc_t
*xmppc,
const
char
*fmt, ...);
106
107
void
logInfo(
xmppc_t
*xmppc,
const
char
*fmt, ...);
108
109
void
logDebug(
xmppc_t
*xmppc,
const
char
*fmt, ...);
110
111
int
xmppc_context
(
xmppc_t
*xmppc,
int
level);
112
113
int
xmppc_connect(
xmppc_t
*_xmppc,
char
*jid,
char
*password);
114
115
#endif // XMPPC_XMPPC_H__
xmppc_t
Definition:
xmppc.h:91
logError
void logError(xmppc_t *xmppc, const char *fmt,...)
Definition:
xmppc.c:61
xmppc_t::loglevel
loglevel_t loglevel
Definition:
xmppc.h:93
xmppc_context
int xmppc_context(xmppc_t *xmppc, int level)
Setup the application context.
Definition:
xmppc.c:102
Generated by
1.8.14