mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 07:36:21 +00:00
Tidied initialisation
This commit is contained in:
12
main.c
12
main.c
@@ -23,8 +23,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
#include "windows.h"
|
|
||||||
#include "profanity.h"
|
#include "profanity.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@@ -47,13 +45,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log_init();
|
profanity_init(disable_tls);
|
||||||
gui_init();
|
profanity_run();
|
||||||
|
profanity_shutdown();
|
||||||
profanity_main(disable_tls);
|
|
||||||
|
|
||||||
gui_close();
|
|
||||||
log_close();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
17
profanity.c
17
profanity.c
@@ -32,15 +32,12 @@
|
|||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
|
|
||||||
static void _profanity_init(int disable_tls);
|
|
||||||
static void _profanity_event_loop(int *ch, char *cmd, int *size);
|
static void _profanity_event_loop(int *ch, char *cmd, int *size);
|
||||||
|
|
||||||
void profanity_main(int disable_tls)
|
void profanity_run(void)
|
||||||
{
|
{
|
||||||
int cmd_result = TRUE;
|
int cmd_result = TRUE;
|
||||||
|
|
||||||
_profanity_init(disable_tls);
|
|
||||||
|
|
||||||
inp_non_block();
|
inp_non_block();
|
||||||
while(cmd_result == TRUE) {
|
while(cmd_result == TRUE) {
|
||||||
int ch = ERR;
|
int ch = ERR;
|
||||||
@@ -54,15 +51,23 @@ void profanity_main(int disable_tls)
|
|||||||
cmd_result = process_input(inp);
|
cmd_result = process_input(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
jabber_disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _profanity_init(int disable_tls)
|
void profanity_init(int disable_tls)
|
||||||
{
|
{
|
||||||
|
log_init();
|
||||||
|
gui_init();
|
||||||
jabber_init(disable_tls);
|
jabber_init(disable_tls);
|
||||||
history_init();
|
history_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void profanity_shutdown(void)
|
||||||
|
{
|
||||||
|
jabber_disconnect();
|
||||||
|
gui_close();
|
||||||
|
log_close();
|
||||||
|
}
|
||||||
|
|
||||||
static void _profanity_event_loop(int *ch, char *cmd, int *size)
|
static void _profanity_event_loop(int *ch, char *cmd, int *size)
|
||||||
{
|
{
|
||||||
usleep(1);
|
usleep(1);
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
#ifndef PROFANITY_H
|
#ifndef PROFANITY_H
|
||||||
#define PROFANITY_H
|
#define PROFANITY_H
|
||||||
|
|
||||||
void profanity_main(int disable_tls);
|
void profanity_init(int disable_tls);
|
||||||
|
void profanity_run(void);
|
||||||
|
void profanity_shutdown(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user