summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c50
1 files changed, 17 insertions, 33 deletions
diff --git a/main.c b/main.c
index 016ea99..b86e911 100644
--- a/main.c
+++ b/main.c
@@ -5,17 +5,9 @@
#include <getopt.h>
#include "gui.h"
-#include "net.h"
+#include "xmpp.h"
-// error code definition
-typedef enum error {
- Ok = 0,
- UnknownError = 1,
- WrongArgs = 2,
- GuiError = 3,
-} Error;
-
// configuration struct for all command line options
typedef struct options {
bool unknown;
@@ -23,28 +15,6 @@ typedef struct options {
} Options;
-// prototypes
-static void get_opts(Options* opts, int argc, char* argv[]);
-static void print_help(void);
-
-
-int main(int argc, char* argv[]) {
-
- // parse command line options
- Options opts;
- get_opts(&opts, argc, argv);
-
- // handle correct use case
- if (opts.unknown || opts.help) {
- print_help();
- } else {
- net_init();
- gui_run();
- net_quit();
- }
-
-}
-
// parses all command line arguments.
static void get_opts(Options* opts, int argc, char* argv[]) {
@@ -63,9 +33,7 @@ static void get_opts(Options* opts, int argc, char* argv[]) {
default:
opts->unknown = true;
}
-
}
-
}
// prints out the help page.
@@ -81,3 +49,19 @@ static void print_help(void) {
);
}
+
+int main(int argc, char* argv[]) {
+
+ // parse command line options
+ Options opts;
+ get_opts(&opts, argc, argv);
+
+ // handle correct use case
+ if (opts.unknown || opts.help) {
+ print_help();
+ } else {
+ xmpp_connect();
+ gui_run();
+ }
+
+}