mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Usage of gboolean in command.c
This commit is contained in:
parent
44266b19a1
commit
04e021eb36
48
command.c
48
command.c
@ -22,6 +22,9 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "command.h"
|
||||
#include "contact_list.h"
|
||||
#include "history.h"
|
||||
@ -29,19 +32,20 @@
|
||||
#include "windows.h"
|
||||
#include "util.h"
|
||||
|
||||
static int _handle_command(const char * const command, const char * const inp);
|
||||
static int _cmd_quit(void);
|
||||
static int _cmd_help(void);
|
||||
static int _cmd_who(void);
|
||||
static int _cmd_ros(void);
|
||||
static int _cmd_connect(const char * const inp);
|
||||
static int _cmd_msg(const char * const inp);
|
||||
static int _cmd_close(const char * const inp);
|
||||
static int _cmd_default(const char * const inp);
|
||||
static gboolean _handle_command(const char * const command,
|
||||
const char * const inp);
|
||||
static gboolean _cmd_quit(void);
|
||||
static gboolean _cmd_help(void);
|
||||
static gboolean _cmd_who(void);
|
||||
static gboolean _cmd_ros(void);
|
||||
static gboolean _cmd_connect(const char * const inp);
|
||||
static gboolean _cmd_msg(const char * const inp);
|
||||
static gboolean _cmd_close(const char * const inp);
|
||||
static gboolean _cmd_default(const char * const inp);
|
||||
|
||||
int process_input(char *inp)
|
||||
gboolean process_input(char *inp)
|
||||
{
|
||||
int result = FALSE;
|
||||
gboolean result = FALSE;
|
||||
|
||||
if (strlen(inp) > 0)
|
||||
history_append(inp);
|
||||
@ -65,9 +69,9 @@ int process_input(char *inp)
|
||||
return result;
|
||||
}
|
||||
|
||||
static int _handle_command(const char * const command, const char * const inp)
|
||||
static gboolean _handle_command(const char * const command, const char * const inp)
|
||||
{
|
||||
int result = FALSE;
|
||||
gboolean result = FALSE;
|
||||
|
||||
if (strcmp(command, "/quit") == 0) {
|
||||
result = _cmd_quit();
|
||||
@ -90,9 +94,9 @@ static int _handle_command(const char * const command, const char * const inp)
|
||||
return result;
|
||||
}
|
||||
|
||||
static int _cmd_connect(const char * const inp)
|
||||
static gboolean _cmd_connect(const char * const inp)
|
||||
{
|
||||
int result = FALSE;
|
||||
gboolean result = FALSE;
|
||||
jabber_status_t conn_status = jabber_connection_status();
|
||||
|
||||
if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) {
|
||||
@ -123,19 +127,19 @@ static int _cmd_connect(const char * const inp)
|
||||
return result;
|
||||
}
|
||||
|
||||
static int _cmd_quit(void)
|
||||
static gboolean _cmd_quit(void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int _cmd_help(void)
|
||||
static gboolean _cmd_help(void)
|
||||
{
|
||||
cons_help();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int _cmd_ros(void)
|
||||
static gboolean _cmd_ros(void)
|
||||
{
|
||||
jabber_status_t conn_status = jabber_connection_status();
|
||||
|
||||
@ -147,7 +151,7 @@ static int _cmd_ros(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int _cmd_who(void)
|
||||
static gboolean _cmd_who(void)
|
||||
{
|
||||
jabber_status_t conn_status = jabber_connection_status();
|
||||
|
||||
@ -161,7 +165,7 @@ static int _cmd_who(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int _cmd_msg(const char * const inp)
|
||||
static gboolean _cmd_msg(const char * const inp)
|
||||
{
|
||||
char *usr = NULL;
|
||||
char *msg = NULL;
|
||||
@ -195,7 +199,7 @@ static int _cmd_msg(const char * const inp)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int _cmd_close(const char * const inp)
|
||||
static gboolean _cmd_close(const char * const inp)
|
||||
{
|
||||
if (!win_close_win())
|
||||
cons_bad_command(inp);
|
||||
@ -203,7 +207,7 @@ static int _cmd_close(const char * const inp)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int _cmd_default(const char * const inp)
|
||||
static gboolean _cmd_default(const char * const inp)
|
||||
{
|
||||
if (win_in_chat()) {
|
||||
char *recipient = win_get_recipient();
|
||||
|
@ -24,6 +24,6 @@
|
||||
#define COMMAND_H
|
||||
|
||||
void cmd_init(void);
|
||||
int process_input(char *inp);
|
||||
gboolean process_input(char *inp);
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "profanity.h"
|
||||
#include "log.h"
|
||||
@ -34,7 +35,7 @@ static void _profanity_shutdown(void);
|
||||
|
||||
void profanity_run(void)
|
||||
{
|
||||
int cmd_result = TRUE;
|
||||
gboolean cmd_result = TRUE;
|
||||
|
||||
inp_non_block();
|
||||
while(cmd_result == TRUE) {
|
||||
|
Loading…
Reference in New Issue
Block a user