gitignore file / doc files
This commit is contained in:
parent
9c64ba40de
commit
5b81fbb586
117
.gitignore
vendored
Normal file
117
.gitignore
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
# ---> Autotools
|
||||
# http://www.gnu.org/software/automake
|
||||
|
||||
Makefile.in
|
||||
/ar-lib
|
||||
/mdate-sh
|
||||
/py-compile
|
||||
/test-driver
|
||||
/ylwrap
|
||||
|
||||
# http://www.gnu.org/software/autoconf
|
||||
|
||||
autom4te.cache
|
||||
/autoscan.log
|
||||
/autoscan-*.log
|
||||
/aclocal.m4
|
||||
/compile
|
||||
/config.guess
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/configure.scan
|
||||
/depcomp
|
||||
/install-sh
|
||||
/missing
|
||||
/stamp-h1
|
||||
|
||||
# https://www.gnu.org/software/libtool/
|
||||
|
||||
/ltmain.sh
|
||||
|
||||
# http://www.gnu.org/software/texinfo
|
||||
|
||||
/texinfo.tex
|
||||
|
||||
# http://www.gnu.org/software/m4/
|
||||
|
||||
m4/libtool.m4
|
||||
m4/ltoptions.m4
|
||||
m4/ltsugar.m4
|
||||
m4/ltversion.m4
|
||||
m4/lt~obsolete.m4
|
||||
|
||||
# Generated Makefile
|
||||
# (meta build system like autotools,
|
||||
# can automatically generate from config.status script
|
||||
# (which is called by configure script))
|
||||
Makefile
|
||||
|
||||
|
||||
# ---> C
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
|
||||
build-aux/
|
||||
libtool
|
||||
src/.deps/
|
||||
src/.dirstamp
|
||||
src/config.h
|
||||
src/config.h.in
|
||||
src/stamp-h1
|
||||
xmppc
|
||||
|
||||
doc/doxygen/
|
0
bootstrap.sh
Normal file → Executable file
0
bootstrap.sh
Normal file → Executable file
2494
doc/Doxyfile
Normal file
2494
doc/Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
3
doc/Makefile
Normal file
3
doc/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
all:
|
||||
doxygen Doxyfile
|
||||
|
68
doc/xmppc.1
Normal file
68
doc/xmppc.1
Normal file
@ -0,0 +1,68 @@
|
||||
'\" t
|
||||
.\"
|
||||
.TH xmppc 1 "2020-04-10" Linux "User Manuals"
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.SH NAME
|
||||
.\" ---------------------------------------------------------------------------
|
||||
xmppc \- XMPP Command Line Client
|
||||
.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.SH SYNTAX
|
||||
.SY xmppc
|
||||
.OP \-v [vvv]
|
||||
.BR \-j " <XMPP-ID>"
|
||||
.BR \-p " <password>"
|
||||
.BR \-m " <mode>"
|
||||
.BR command
|
||||
.OP args
|
||||
.
|
||||
.SY xmppc
|
||||
.BR \-h
|
||||
.
|
||||
.SY xmppc
|
||||
.BR \-v
|
||||
.YS
|
||||
.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
xmppc is a XMPP command line client.
|
||||
.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B --jid jid
|
||||
.TQ
|
||||
.B -j jid
|
||||
XMPP ID of the XMPP account.
|
||||
.
|
||||
.TP
|
||||
.B --pwd password
|
||||
.TQ
|
||||
.B -p password
|
||||
Password of the XMPP account.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.SH COMMANDS
|
||||
.SS Message
|
||||
.TP
|
||||
.B chat <jid> <message>
|
||||
Send a message to jid
|
||||
.
|
||||
.SS OMEMO
|
||||
.TP
|
||||
.B list
|
||||
Device IDs and Fingerprints
|
||||
.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.SH ENVIRONMENT
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.SH FILES
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.SH BUGS
|
||||
.PP
|
||||
Issue tracker:
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.SH SEE ALSO
|
||||
.PP
|
||||
.BR gnupg (1)
|
||||
|
142
src/xmpp.c
142
src/xmpp.c
@ -1,142 +0,0 @@
|
||||
/*
|
||||
* @file xmppc.c
|
||||
*
|
||||
* vim: expandtab:ts=2:sts=2:sw=2
|
||||
*
|
||||
* @copyright
|
||||
*
|
||||
* Copyright (C) 2020 Anoxinon e.V.
|
||||
*
|
||||
* This file is part of xmppc.
|
||||
*
|
||||
* xmppc is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* xmppc is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* German
|
||||
*
|
||||
* Diese Datei ist Teil von xmppc.
|
||||
*
|
||||
* xmppc ist Freie Software: Sie können es unter den Bedingungen
|
||||
* der GNU General Public License, wie von der Free Software Foundation,
|
||||
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
|
||||
* veröffentlichten Version, weiter verteilen und/oder modifizieren.
|
||||
*
|
||||
* xmppc wird in der Hoffnung, dass es nützlich sein wird, aber
|
||||
* OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
|
||||
* Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
|
||||
* Siehe die GNU General Public License für weitere Details.
|
||||
*
|
||||
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
|
||||
* Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "xmppc.h"
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*! @file xmppc.c
|
||||
*
|
||||
* xmppc
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Error logging
|
||||
*
|
||||
* \param xmppc the xmppc context structure
|
||||
* \param fmt format of message
|
||||
*
|
||||
*/
|
||||
void logError(xmppc_t *xmppc, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void logWarn(xmppc_t *xmppc, const char *fmt, ...) {
|
||||
if (xmppc->loglevel) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
void logInfo(xmppc_t *xmppc, const char *fmt, ...) {
|
||||
if (xmppc->loglevel) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
void logDebug(xmppc_t *xmppc, const char *fmt, ...) {
|
||||
if (xmppc->loglevel) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Setup the application context.
|
||||
*
|
||||
* \param xmppc
|
||||
* \return 0 - ok
|
||||
*
|
||||
**/
|
||||
int xmppc_context(xmppc_t *xmppc, int level) {
|
||||
assert(xmppc != NULL);
|
||||
assert(xmppc->ctx == NULL);
|
||||
xmpp_log_t *log = NULL;
|
||||
|
||||
if (level > TRACE) {
|
||||
logError(xmppc, "Log level %d not supported. Max: %d.\n", level, TRACE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
xmppc->loglevel = level;
|
||||
|
||||
if (level == ERROR) {
|
||||
log = xmpp_get_default_logger(XMPP_LEVEL_ERROR);
|
||||
} else if (level == WARN) {
|
||||
log = xmpp_get_default_logger(XMPP_LEVEL_WARN);
|
||||
} else if (level == INFO) {
|
||||
log = xmpp_get_default_logger(XMPP_LEVEL_INFO);
|
||||
} else if (level == DEBUG) {
|
||||
log = xmpp_get_default_logger(XMPP_LEVEL_DEBUG);
|
||||
} else if (level == TRACE) {
|
||||
log = xmpp_get_default_logger(XMPP_LEVEL_DEBUG);
|
||||
}
|
||||
|
||||
xmpp_ctx_t *ctx = xmpp_ctx_new(NULL, log);
|
||||
xmppc->ctx = ctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xmppc_connect(xmppc_t *xmppc, char *jid, char *password) {
|
||||
assert(xmppc != NULL);
|
||||
assert(jid != NULL);
|
||||
assert(password != NULL);
|
||||
xmpp_conn_t *conn = xmpp_conn_new(xmppc->ctx);
|
||||
assert(conn != NULL);
|
||||
|
||||
xmpp_conn_set_jid(conn, jid);
|
||||
xmpp_conn_set_pass(conn, password);
|
||||
xmppc->conn = conn;
|
||||
return 0;
|
||||
}
|
100
src/xmpp.h
100
src/xmpp.h
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* @file xmppc.h
|
||||
*
|
||||
* vim: expandtab:ts=2:sts=2:sw=2
|
||||
*
|
||||
* @copyright
|
||||
*
|
||||
* Copyright (C) 2020 Anoxinon e.V.
|
||||
*
|
||||
* This file is part of xmppc.
|
||||
*
|
||||
* xmppc is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* xmppc is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* German
|
||||
*
|
||||
* Diese Datei ist Teil von xmppc.
|
||||
*
|
||||
* xmppc ist Freie Software: Sie können es unter den Bedingungen
|
||||
* der GNU General Public License, wie von der Free Software Foundation,
|
||||
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
|
||||
* veröffentlichten Version, weiter verteilen und/oder modifizieren.
|
||||
*
|
||||
* xmppc wird in der Hoffnung, dass es nützlich sein wird, aber
|
||||
* OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
|
||||
* Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
|
||||
* Siehe die GNU General Public License für weitere Details.
|
||||
*
|
||||
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
|
||||
* Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMPPC_XMPPC_H__
|
||||
#define XMPPC_XMPPC_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <strophe.h>
|
||||
|
||||
#define ANSI_COLOR_RED "\x1b[31m"
|
||||
#define ANSI_COLOR_GREEN "\x1b[32m"
|
||||
#define ANSI_COLOR_YELLOW "\x1b[33m"
|
||||
#define ANSI_COLOR_BLUE "\x1b[34m"
|
||||
#define ANSI_COLOR_MAGENTA "\x1b[35m"
|
||||
#define ANSI_COLOR_CYAN "\x1b[36m"
|
||||
|
||||
#define ANSI_COLOR_B_RED "\x1b[91m"
|
||||
|
||||
|
||||
/**
|
||||
* XMPPC Level of Logging
|
||||
*
|
||||
*/
|
||||
typedef enum loglevel {
|
||||
ERROR = 0,
|
||||
WARN = 1,
|
||||
INFO = 2,
|
||||
DEBUG = 3,
|
||||
TRACE = 4
|
||||
} loglevel_t;
|
||||
|
||||
typedef enum mode { UNKOWN, ACCOUNT, ROSTER, MESSAGE, MUC, OMEMO, PGP, OPENPGP, MONITOR } xmppc_mode_t;
|
||||
|
||||
typedef struct {
|
||||
/** log level **/
|
||||
loglevel_t loglevel;
|
||||
xmpp_ctx_t *ctx;
|
||||
xmpp_conn_t *conn;
|
||||
xmppc_mode_t mode;
|
||||
} xmppc_t;
|
||||
|
||||
#define INIT_XMPPC(X) xmppc_t X = {.loglevel = ERROR, .ctx = NULL, .conn = NULL, .mode = UNKOWN}
|
||||
|
||||
typedef void (*ExecuteHandler)(xmppc_t *, int, char **);
|
||||
|
||||
void logError(xmppc_t *xmppc_t, const char *fmt, ...);
|
||||
|
||||
void logWarn(xmppc_t *xmppc, const char *fmt, ...);
|
||||
|
||||
void logInfo(xmppc_t *xmppc, const char *fmt, ...);
|
||||
|
||||
void logDebug(xmppc_t *xmppc, const char *fmt, ...);
|
||||
|
||||
int xmppc_context(xmppc_t *xmppc, int level);
|
||||
|
||||
int xmppc_connect(xmppc_t *_xmppc, char *jid, char *password);
|
||||
|
||||
#endif // XMPPC_XMPPC_H__
|
Loading…
Reference in New Issue
Block a user