mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-15 19:38:07 -04:00
Tidied initialisation
This commit is contained in:
parent
0dac914813
commit
723a99540d
12
main.c
12
main.c
@ -23,8 +23,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "windows.h"
|
||||
#include "profanity.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -47,13 +45,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
log_init();
|
||||
gui_init();
|
||||
|
||||
profanity_main(disable_tls);
|
||||
|
||||
gui_close();
|
||||
log_close();
|
||||
profanity_init(disable_tls);
|
||||
profanity_run();
|
||||
profanity_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
19
profanity.c
19
profanity.c
@ -32,15 +32,12 @@
|
||||
#include "command.h"
|
||||
#include "history.h"
|
||||
|
||||
static void _profanity_init(int disable_tls);
|
||||
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;
|
||||
|
||||
_profanity_init(disable_tls);
|
||||
|
||||
inp_non_block();
|
||||
while(cmd_result == TRUE) {
|
||||
int ch = ERR;
|
||||
@ -54,15 +51,23 @@ void profanity_main(int disable_tls)
|
||||
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);
|
||||
history_init();
|
||||
}
|
||||
|
||||
void profanity_shutdown(void)
|
||||
{
|
||||
jabber_disconnect();
|
||||
gui_close();
|
||||
log_close();
|
||||
}
|
||||
|
||||
static void _profanity_event_loop(int *ch, char *cmd, int *size)
|
||||
{
|
||||
usleep(1);
|
||||
@ -70,4 +75,4 @@ static void _profanity_event_loop(int *ch, char *cmd, int *size)
|
||||
jabber_process_events();
|
||||
win_handle_switch(ch);
|
||||
inp_poll_char(ch, cmd, size);
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,8 @@
|
||||
#ifndef 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
|
||||
|
Loading…
Reference in New Issue
Block a user