1
0
Fork 0

Function signatures across lines

This commit is contained in:
James Booth 2012-07-24 23:19:48 +01:00
parent 6bbad269db
commit 279737bada
18 changed files with 393 additions and 203 deletions

View File

@ -34,13 +34,15 @@ static GTimeZone *tz;
static void _close_file(gpointer key, gpointer value, gpointer user_data);
void chat_log_init(void)
void
chat_log_init(void)
{
tz = g_time_zone_new_local();
logs = g_hash_table_new(NULL, (GEqualFunc) g_strcmp0);
}
void chat_log_chat(const char * const login, char *other,
void
chat_log_chat(const char * const login, char *other,
const char * const msg, chat_log_direction_t direction)
{
gpointer logpp = g_hash_table_lookup(logs, other);
@ -81,13 +83,15 @@ void chat_log_chat(const char * const login, char *other,
g_date_time_unref(dt);
}
void chat_log_close(void)
void
chat_log_close(void)
{
g_hash_table_foreach(logs, (GHFunc) _close_file, NULL);
g_time_zone_unref(tz);
}
static void _close_file(gpointer key, gpointer value, gpointer user_data)
static void
_close_file(gpointer key, gpointer value, gpointer user_data)
{
fclose(value);
}

View File

@ -88,7 +88,8 @@ static struct cmd_t commands[] = {
static const int num_cmds = 17;
gboolean process_input(char *inp)
gboolean
process_input(char *inp)
{
gboolean result = FALSE;
@ -115,7 +116,8 @@ gboolean process_input(char *inp)
return result;
}
void command_init(void)
void
command_init(void)
{
commands_ac = p_autocomplete_new();
@ -128,17 +130,20 @@ void command_init(void)
history_init();
}
char * cmd_complete(char *inp)
char *
cmd_complete(char *inp)
{
return p_autocomplete_complete(commands_ac, inp);
}
void reset_command_completer(void)
void
reset_command_completer(void)
{
p_autocomplete_reset(commands_ac);
}
static gboolean _handle_command(const char * const command, const char * const inp)
static gboolean
_handle_command(const char * const command, const char * const inp)
{
int i;
for (i = 0; i < num_cmds; i++) {
@ -151,7 +156,8 @@ static gboolean _handle_command(const char * const command, const char * const i
return _cmd_default(inp);
}
static gboolean _cmd_connect(const char * const inp)
static gboolean
_cmd_connect(const char * const inp)
{
gboolean result = FALSE;
jabber_conn_status_t conn_status = jabber_connection_status();
@ -186,26 +192,30 @@ static gboolean _cmd_connect(const char * const inp)
return result;
}
static gboolean _cmd_quit(const char * const inp)
static gboolean
_cmd_quit(const char * const inp)
{
return FALSE;
}
static gboolean _cmd_help(const char * const inp)
static gboolean
_cmd_help(const char * const inp)
{
cons_help();
return TRUE;
}
static gboolean _cmd_prefs(const char * const inp)
static gboolean
_cmd_prefs(const char * const inp)
{
cons_prefs();
return TRUE;
}
static gboolean _cmd_ros(const char * const inp)
static gboolean
_cmd_ros(const char * const inp)
{
jabber_conn_status_t conn_status = jabber_connection_status();
@ -217,7 +227,8 @@ static gboolean _cmd_ros(const char * const inp)
return TRUE;
}
static gboolean _cmd_who(const char * const inp)
static gboolean
_cmd_who(const char * const inp)
{
jabber_conn_status_t conn_status = jabber_connection_status();
@ -231,7 +242,8 @@ static gboolean _cmd_who(const char * const inp)
return TRUE;
}
static gboolean _cmd_msg(const char * const inp)
static gboolean
_cmd_msg(const char * const inp)
{
char *usr = NULL;
char *msg = NULL;
@ -265,7 +277,8 @@ static gboolean _cmd_msg(const char * const inp)
return TRUE;
}
static gboolean _cmd_close(const char * const inp)
static gboolean
_cmd_close(const char * const inp)
{
if (!win_close_win())
cons_bad_command(inp);
@ -273,7 +286,8 @@ static gboolean _cmd_close(const char * const inp)
return TRUE;
}
static gboolean _cmd_set_beep(const char * const inp)
static gboolean
_cmd_set_beep(const char * const inp)
{
if (strcmp(inp, "/beep on") == 0) {
cons_show("Sound enabled.");
@ -288,7 +302,8 @@ static gboolean _cmd_set_beep(const char * const inp)
return TRUE;
}
static gboolean _cmd_set_notify(const char * const inp)
static gboolean
_cmd_set_notify(const char * const inp)
{
if (strcmp(inp, "/notify on") == 0) {
cons_show("Desktop notifications enabled.");
@ -303,7 +318,8 @@ static gboolean _cmd_set_notify(const char * const inp)
return TRUE;
}
static gboolean _cmd_set_flash(const char * const inp)
static gboolean
_cmd_set_flash(const char * const inp)
{
if (strcmp(inp, "/flash on") == 0) {
cons_show("Screen flash enabled.");
@ -318,7 +334,8 @@ static gboolean _cmd_set_flash(const char * const inp)
return TRUE;
}
static gboolean _cmd_set_showsplash(const char * const inp)
static gboolean
_cmd_set_showsplash(const char * const inp)
{
if (strcmp(inp, "/showsplash on") == 0) {
cons_show("Splash screen enabled.");
@ -333,7 +350,8 @@ static gboolean _cmd_set_showsplash(const char * const inp)
return TRUE;
}
static gboolean _cmd_set_chlog(const char * const inp)
static gboolean
_cmd_set_chlog(const char * const inp)
{
if (strcmp(inp, "/chlog on") == 0) {
cons_show("Chat logging enabled.");
@ -348,37 +366,43 @@ static gboolean _cmd_set_chlog(const char * const inp)
return TRUE;
}
static gboolean _cmd_away(const char * const inp)
static gboolean
_cmd_away(const char * const inp)
{
_update_presence(PRESENCE_AWAY, "away", inp);
return TRUE;
}
static gboolean _cmd_online(const char * const inp)
static gboolean
_cmd_online(const char * const inp)
{
_update_presence(PRESENCE_ONLINE, "online", inp);
return TRUE;
}
static gboolean _cmd_dnd(const char * const inp)
static gboolean
_cmd_dnd(const char * const inp)
{
_update_presence(PRESENCE_DND, "dnd", inp);
return TRUE;
}
static gboolean _cmd_chat(const char * const inp)
static gboolean
_cmd_chat(const char * const inp)
{
_update_presence(PRESENCE_CHAT, "chat", inp);
return TRUE;
}
static gboolean _cmd_xa(const char * const inp)
static gboolean
_cmd_xa(const char * const inp)
{
_update_presence(PRESENCE_XA, "xa", inp);
return TRUE;
}
static gboolean _cmd_default(const char * const inp)
static gboolean
_cmd_default(const char * const inp)
{
if (win_in_chat()) {
char *recipient = win_get_recipient();
@ -392,7 +416,8 @@ static gboolean _cmd_default(const char * const inp)
return TRUE;
}
static void _update_presence(const jabber_presence_t presence,
static void
_update_presence(const jabber_presence_t presence,
const char * const show, const char * const inp)
{
char *msg;

View File

@ -30,13 +30,15 @@
#include "common.h"
void p_slist_free_full(GSList *items, GDestroyNotify free_func)
void
p_slist_free_full(GSList *items, GDestroyNotify free_func)
{
g_slist_foreach (items, (GFunc) free_func, NULL);
g_slist_free (items);
}
void create_config_directory()
void
create_config_directory()
{
GString *dir = g_string_new(getenv("HOME"));
g_string_append(dir, "/.profanity");
@ -44,7 +46,8 @@ void create_config_directory()
g_string_free(dir, TRUE);
}
void create_dir(char *name)
void
create_dir(char *name)
{
int e;
struct stat sb;

View File

@ -33,7 +33,8 @@ struct p_contact_t {
char *status;
};
PContact p_contact_new(const char * const name, const char * const show,
PContact
p_contact_new(const char * const name, const char * const show,
const char * const status)
{
PContact contact = malloc(sizeof(struct p_contact_t));
@ -52,7 +53,8 @@ PContact p_contact_new(const char * const name, const char * const show,
return contact;
}
PContact p_contact_copy(PContact contact)
PContact
p_contact_copy(PContact contact)
{
PContact copy = malloc(sizeof(struct p_contact_t));
copy->name = strdup(contact->name);
@ -66,7 +68,8 @@ PContact p_contact_copy(PContact contact)
return copy;
}
void p_contact_free(PContact contact)
void
p_contact_free(PContact contact)
{
free(contact->name);
@ -83,22 +86,26 @@ void p_contact_free(PContact contact)
contact = NULL;
}
const char * p_contact_name(const PContact contact)
const char *
p_contact_name(const PContact contact)
{
return contact->name;
}
const char * p_contact_show(const PContact contact)
const char *
p_contact_show(const PContact contact)
{
return contact->show;
}
const char * p_contact_status(const PContact contact)
const char *
p_contact_status(const PContact contact)
{
return contact->status;
}
int p_contacts_equal_deep(const PContact c1, const PContact c2)
int
p_contacts_equal_deep(const PContact c1, const PContact c2)
{
int name_eq = (g_strcmp0(c1->name, c2->name) == 0);
int show_eq = (g_strcmp0(c1->show, c2->show) == 0);

View File

@ -32,7 +32,8 @@
static PAutocomplete ac;
void contact_list_init(void)
void
contact_list_init(void)
{
ac = p_obj_autocomplete_new((PStrFunc)p_contact_name,
(PCopyFunc)p_contact_copy,
@ -40,33 +41,39 @@ void contact_list_init(void)
(GDestroyNotify)p_contact_free);
}
void contact_list_clear(void)
void
contact_list_clear(void)
{
p_autocomplete_clear(ac);
}
void reset_search_attempts(void)
void
reset_search_attempts(void)
{
p_autocomplete_reset(ac);
}
gboolean contact_list_remove(const char * const name)
gboolean
contact_list_remove(const char * const name)
{
return p_autocomplete_remove(ac, name);
}
gboolean contact_list_add(const char * const name, const char * const show,
gboolean
contact_list_add(const char * const name, const char * const show,
const char * const status)
{
return p_autocomplete_add(ac, p_contact_new(name, show, status));
}
GSList * get_contact_list(void)
GSList *
get_contact_list(void)
{
return p_autocomplete_get_list(ac);
}
char * find_contact(char *search_str)
char *
find_contact(char *search_str)
{
return p_autocomplete_complete(ac, search_str);
}

View File

@ -31,17 +31,20 @@ static PHistory history;
void _stringify_input(char *inp, int size, char *string);
void history_init(void)
void
history_init(void)
{
history = p_history_new(MAX_HISTORY);
}
void history_append(char *inp)
void
history_append(char *inp)
{
p_history_append(history, inp);
}
char * history_previous(char *inp, int *size)
char *
history_previous(char *inp, int *size)
{
char inp_str[*size + 1];
_stringify_input(inp, *size, inp_str);
@ -49,7 +52,8 @@ char * history_previous(char *inp, int *size)
return p_history_previous(history, inp_str);
}
char *history_next(char *inp, int *size)
char *
history_next(char *inp, int *size)
{
char inp_str[*size + 1];
_stringify_input(inp, *size, inp_str);
@ -57,7 +61,8 @@ char *history_next(char *inp, int *size)
return p_history_next(history, inp_str);
}
void _stringify_input(char *inp, int size, char *string)
void
_stringify_input(char *inp, int size, char *string)
{
int i;
for (i = 0; i < size; i++) {
@ -65,5 +70,3 @@ void _stringify_input(char *inp, int size, char *string)
}
string[size] = '\0';
}

View File

@ -57,7 +57,8 @@ static int _handle_edit(const int ch, char *input, int *size);
static int _printable(const int ch);
static void _replace_input(char *input, const char * const new_input, int *size);
void create_input_window(void)
void
create_input_window(void)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
@ -69,7 +70,8 @@ void create_input_window(void)
prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1);
}
void inp_win_resize(const char * const input, const int size)
void
inp_win_resize(const char * const input, const int size)
{
int rows, cols, inp_x, inp_y;
getmaxyx(stdscr, rows, cols);
@ -86,7 +88,8 @@ void inp_win_resize(const char * const input, const int size)
prefresh(inp_win, pad_start, 0, rows-1, 0, rows-1, cols-1);
}
void inp_clear(void)
void
inp_clear(void)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
@ -96,17 +99,20 @@ void inp_clear(void)
prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1);
}
void inp_non_block(void)
void
inp_non_block(void)
{
wtimeout(inp_win, 500);
}
void inp_block(void)
void
inp_block(void)
{
wtimeout(inp_win, -1);
}
void inp_get_char(int *ch, char *input, int *size)
void
inp_get_char(int *ch, char *input, int *size)
{
int inp_y = 0;
int inp_x = 0;
@ -155,7 +161,8 @@ void inp_get_char(int *ch, char *input, int *size)
echo();
}
void inp_get_password(char *passwd)
void
inp_get_password(char *passwd)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
@ -169,7 +176,8 @@ void inp_get_password(char *passwd)
status_bar_clear();
}
void inp_put_back(void)
void
inp_put_back(void)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
@ -181,7 +189,8 @@ void inp_put_back(void)
* key press: up, down, left, right or backspace
* return 0 if it wasnt
*/
static int _handle_edit(const int ch, char *input, int *size)
static int
_handle_edit(const int ch, char *input, int *size)
{
int i, rows, cols;
char *prev = NULL;
@ -356,7 +365,8 @@ static int _handle_edit(const int ch, char *input, int *size)
}
}
static int _printable(const int ch)
static int
_printable(const int ch)
{
return (ch != ERR && ch != '\n' &&
ch != KEY_PPAGE && ch != KEY_NPAGE &&
@ -367,7 +377,8 @@ static int _printable(const int ch)
ch != KEY_IC && ch != KEY_EIC && ch != KEY_RESIZE);
}
static void _replace_input(char *input, const char * const new_input, int *size)
static void
_replace_input(char *input, const char * const new_input, int *size)
{
int i;

View File

@ -52,12 +52,14 @@ void xmpp_file_logger(void * const userdata, const xmpp_log_level_t level,
static const xmpp_log_t file_log = { &xmpp_file_logger, XMPP_LEVEL_DEBUG };
xmpp_log_t *xmpp_get_file_logger()
xmpp_log_t *
xmpp_get_file_logger()
{
return (xmpp_log_t*) &file_log;
}
void xmpp_file_logger(void * const userdata, const xmpp_log_level_t level,
void
xmpp_file_logger(void * const userdata, const xmpp_log_level_t level,
const char * const area, const char * const msg)
{
log_msg(area, msg);
@ -79,19 +81,22 @@ static int _jabber_presence_handler(xmpp_conn_t * const conn,
static int _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata);
void jabber_init(const int disable_tls)
void
jabber_init(const int disable_tls)
{
jabber_conn.conn_status = JABBER_STARTED;
jabber_conn.presence = PRESENCE_OFFLINE;
jabber_conn.tls_disabled = disable_tls;
}
jabber_conn_status_t jabber_connection_status(void)
jabber_conn_status_t
jabber_connection_status(void)
{
return (jabber_conn.conn_status);
}
jabber_conn_status_t jabber_connect(const char * const user,
jabber_conn_status_t
jabber_connect(const char * const user,
const char * const passwd)
{
xmpp_initialize();
@ -117,12 +122,14 @@ jabber_conn_status_t jabber_connect(const char * const user,
return jabber_conn.conn_status;
}
const char * jabber_get_jid(void)
const char *
jabber_get_jid(void)
{
return xmpp_conn_get_jid(jabber_conn.conn);
}
void jabber_disconnect(void)
void
jabber_disconnect(void)
{
if (jabber_conn.conn_status == JABBER_CONNECTED) {
xmpp_conn_release(jabber_conn.conn);
@ -133,14 +140,16 @@ void jabber_disconnect(void)
}
}
void jabber_process_events(void)
void
jabber_process_events(void)
{
if (jabber_conn.conn_status == JABBER_CONNECTED
|| jabber_conn.conn_status == JABBER_CONNECTING)
xmpp_run_once(jabber_conn.ctx, 10);
}
void jabber_send(const char * const msg, const char * const recipient)
void
jabber_send(const char * const msg, const char * const recipient)
{
char *coded_msg = str_replace(msg, "&", "&amp;");
char *coded_msg2 = str_replace(coded_msg, "<", "&lt;");
@ -173,7 +182,8 @@ void jabber_send(const char * const msg, const char * const recipient)
}
}
void jabber_roster_request(void)
void
jabber_roster_request(void)
{
xmpp_stanza_t *iq, *query;
@ -192,7 +202,8 @@ void jabber_roster_request(void)
xmpp_stanza_release(iq);
}
void jabber_update_presence(jabber_presence_t status, const char * const msg)
void
jabber_update_presence(jabber_presence_t status, const char * const msg)
{
jabber_conn.presence = status;
@ -240,7 +251,8 @@ void jabber_update_presence(jabber_presence_t status, const char * const msg)
xmpp_stanza_release(pres);
}
static int _jabber_message_handler(xmpp_conn_t * const conn,
static int
_jabber_message_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata)
{
xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, "body");
@ -268,7 +280,8 @@ static int _jabber_message_handler(xmpp_conn_t * const conn,
return 1;
}
static void _jabber_conn_handler(xmpp_conn_t * const conn,
static void
_jabber_conn_handler(xmpp_conn_t * const conn,
const xmpp_conn_event_t status, const int error,
xmpp_stream_error_t * const stream_error, void * const userdata)
{
@ -317,7 +330,8 @@ static void _jabber_conn_handler(xmpp_conn_t * const conn,
}
}
static int _roster_handler(xmpp_conn_t * const conn,
static int
_roster_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata)
{
xmpp_stanza_t *query, *item;
@ -356,7 +370,8 @@ static int _roster_handler(xmpp_conn_t * const conn,
return 1;
}
static int _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata)
static int
_ping_timed_handler(xmpp_conn_t * const conn, void * const userdata)
{
if (jabber_conn.conn_status == JABBER_CONNECTED) {
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
@ -383,7 +398,8 @@ static int _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata)
return 1;
}
static int _jabber_presence_handler(xmpp_conn_t * const conn,
static int
_jabber_presence_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata)
{
const char *jid = xmpp_conn_get_jid(jabber_conn.conn);
@ -427,5 +443,3 @@ static int _jabber_presence_handler(xmpp_conn_t * const conn,
return 1;
}

View File

@ -30,12 +30,14 @@
extern FILE *logp;
void log_msg(const char * const area, const char * const msg)
void
log_msg(const char * const area, const char * const msg)
{
fprintf(logp, "%s DEBUG: %s\n", area, msg);
}
void log_init(void)
void
log_init(void)
{
GString *log_file = g_string_new(getenv("HOME"));
g_string_append(log_file, "/.profanity/log");
@ -46,7 +48,8 @@ void log_init(void)
log_msg(PROF, "Starting Profanity...");
}
void log_close(void)
void
log_close(void)
{
fclose(logp);
}

View File

@ -31,7 +31,8 @@
static gboolean disable_tls = FALSE;
static gboolean version = FALSE;
int main(int argc, char **argv)
int
main(int argc, char **argv)
{
static GOptionEntry entries[] =
{

View File

@ -73,7 +73,8 @@ static void _set_colour(gchar *val, NCURSES_COLOR_T *pref,
static void _load_colours(void);
static void _save_prefs(void);
void prefs_load(void)
void
prefs_load(void)
{
ac = p_autocomplete_new();
prefs_loc = g_string_new(getenv("HOME"));
@ -95,7 +96,8 @@ void prefs_load(void)
_load_colours();
}
static NCURSES_COLOR_T _lookup_colour(const char * const colour)
static NCURSES_COLOR_T
_lookup_colour(const char * const colour)
{
int i;
for (i = 0; i < num_colours; i++) {
@ -107,7 +109,8 @@ static NCURSES_COLOR_T _lookup_colour(const char * const colour)
return -99;
}
static void _set_colour(gchar *val, NCURSES_COLOR_T *pref,
static void
_set_colour(gchar *val, NCURSES_COLOR_T *pref,
NCURSES_COLOR_T def)
{
if(!val) {
@ -122,7 +125,8 @@ static void _set_colour(gchar *val, NCURSES_COLOR_T *pref,
}
}
static void _load_colours(void)
static void
_load_colours(void)
{
gchar *bkgnd_val = g_key_file_get_string(prefs, "colours", "bkgnd", NULL);
_set_colour(bkgnd_val, &colour_prefs.bkgnd, -1);
@ -152,61 +156,72 @@ static void _load_colours(void)
_set_colour(bar_text_val, &colour_prefs.bar_text, COLOR_WHITE);
}
char * find_login(char *prefix)
char *
find_login(char *prefix)
{
return p_autocomplete_complete(ac, prefix);
}
void reset_login_search(void)
void
reset_login_search(void)
{
p_autocomplete_reset(ac);
}
gboolean prefs_get_beep(void)
gboolean
prefs_get_beep(void)
{
return g_key_file_get_boolean(prefs, "ui", "beep", NULL);
}
void prefs_set_beep(gboolean value)
void
prefs_set_beep(gboolean value)
{
g_key_file_set_boolean(prefs, "ui", "beep", value);
_save_prefs();
}
gboolean prefs_get_notify(void)
gboolean
prefs_get_notify(void)
{
return g_key_file_get_boolean(prefs, "ui", "notify", NULL);
}
void prefs_set_notify(gboolean value)
void
prefs_set_notify(gboolean value)
{
g_key_file_set_boolean(prefs, "ui", "notify", value);
_save_prefs();
}
gboolean prefs_get_flash(void)
gboolean
prefs_get_flash(void)
{
return g_key_file_get_boolean(prefs, "ui", "flash", NULL);
}
void prefs_set_flash(gboolean value)
void
prefs_set_flash(gboolean value)
{
g_key_file_set_boolean(prefs, "ui", "flash", value);
_save_prefs();
}
gboolean prefs_get_chlog(void)
gboolean
prefs_get_chlog(void)
{
return g_key_file_get_boolean(prefs, "ui", "chlog", NULL);
}
void prefs_set_chlog(gboolean value)
void
prefs_set_chlog(gboolean value)
{
g_key_file_set_boolean(prefs, "ui", "chlog", value);
_save_prefs();
}
void prefs_add_login(const char *jid)
void
prefs_add_login(const char *jid)
{
gsize njids;
gchar **jids =
@ -247,65 +262,77 @@ void prefs_add_login(const char *jid)
}
}
gboolean prefs_get_showsplash(void)
gboolean
prefs_get_showsplash(void)
{
return g_key_file_get_boolean(prefs, "ui", "showsplash", NULL);
}
void prefs_set_showsplash(gboolean value)
void
prefs_set_showsplash(gboolean value)
{
g_key_file_set_boolean(prefs, "ui", "showsplash", value);
_save_prefs();
}
static void _save_prefs(void)
static void
_save_prefs(void)
{
gsize g_data_size;
char *g_prefs_data = g_key_file_to_data(prefs, &g_data_size, NULL);
g_file_set_contents(prefs_loc->str, g_prefs_data, g_data_size, NULL);
}
NCURSES_COLOR_T prefs_get_bkgnd()
NCURSES_COLOR_T
prefs_get_bkgnd()
{
return colour_prefs.bkgnd;
}
NCURSES_COLOR_T prefs_get_text()
NCURSES_COLOR_T
prefs_get_text()
{
return colour_prefs.text;
}
NCURSES_COLOR_T prefs_get_online()
NCURSES_COLOR_T
prefs_get_online()
{
return colour_prefs.online;
}
NCURSES_COLOR_T prefs_get_offline()
NCURSES_COLOR_T
prefs_get_offline()
{
return colour_prefs.offline;
}
NCURSES_COLOR_T prefs_get_err()
NCURSES_COLOR_T
prefs_get_err()
{
return colour_prefs.err;
}
NCURSES_COLOR_T prefs_get_inc()
NCURSES_COLOR_T
prefs_get_inc()
{
return colour_prefs.inc;
}
NCURSES_COLOR_T prefs_get_bar()
NCURSES_COLOR_T
prefs_get_bar()
{
return colour_prefs.bar;
}
NCURSES_COLOR_T prefs_get_bar_draw()
NCURSES_COLOR_T
prefs_get_bar_draw()
{
return colour_prefs.bar_draw;
}
NCURSES_COLOR_T prefs_get_bar_text()
NCURSES_COLOR_T
prefs_get_bar_text()
{
return colour_prefs.bar_text;
}

View File

@ -43,12 +43,14 @@ static const char *_str_func_default(const char *orig);
static const char *_copy_func_default(const char *orig);
static int _deep_equals_func_default(const char *o1, const char *o2);
PAutocomplete p_autocomplete_new(void)
PAutocomplete
p_autocomplete_new(void)
{
return p_obj_autocomplete_new(NULL, NULL, NULL, NULL);
}
PAutocomplete p_obj_autocomplete_new(PStrFunc str_func, PCopyFunc copy_func,
PAutocomplete
p_obj_autocomplete_new(PStrFunc str_func, PCopyFunc copy_func,
PEqualDeepFunc equal_deep_func, GDestroyNotify free_func)
{
PAutocomplete new = malloc(sizeof(struct p_autocomplete_t));
@ -79,7 +81,8 @@ PAutocomplete p_obj_autocomplete_new(PStrFunc str_func, PCopyFunc copy_func,
return new;
}
void p_autocomplete_clear(PAutocomplete ac)
void
p_autocomplete_clear(PAutocomplete ac)
{
g_slist_free_full(ac->items, ac->free_func);
ac->items = NULL;
@ -87,7 +90,8 @@ void p_autocomplete_clear(PAutocomplete ac)
p_autocomplete_reset(ac);
}
void p_autocomplete_reset(PAutocomplete ac)
void
p_autocomplete_reset(PAutocomplete ac)
{
ac->last_found = NULL;
if (ac->search_str != NULL) {
@ -96,7 +100,8 @@ void p_autocomplete_reset(PAutocomplete ac)
}
}
gboolean p_autocomplete_add(PAutocomplete ac, void *item)
gboolean
p_autocomplete_add(PAutocomplete ac, void *item)
{
if (ac->items == NULL) {
ac->items = g_slist_append(ac->items, item);
@ -134,7 +139,8 @@ gboolean p_autocomplete_add(PAutocomplete ac, void *item)
}
}
gboolean p_autocomplete_remove(PAutocomplete ac, const char * const item)
gboolean
p_autocomplete_remove(PAutocomplete ac, const char * const item)
{
// reset last found if it points to the item to be removed
if (ac->last_found != NULL)
@ -162,7 +168,8 @@ gboolean p_autocomplete_remove(PAutocomplete ac, const char * const item)
}
}
GSList * p_autocomplete_get_list(PAutocomplete ac)
GSList *
p_autocomplete_get_list(PAutocomplete ac)
{
GSList *copy = NULL;
GSList *curr = ac->items;
@ -175,7 +182,8 @@ GSList * p_autocomplete_get_list(PAutocomplete ac)
return copy;
}
gchar * p_autocomplete_complete(PAutocomplete ac, gchar *search_str)
gchar *
p_autocomplete_complete(PAutocomplete ac, gchar *search_str)
{
gchar *found = NULL;
@ -210,7 +218,8 @@ gchar * p_autocomplete_complete(PAutocomplete ac, gchar *search_str)
}
}
static gchar * _search_from(PAutocomplete ac, GSList *curr)
static gchar *
_search_from(PAutocomplete ac, GSList *curr)
{
while(curr) {
@ -235,17 +244,20 @@ static gchar * _search_from(PAutocomplete ac, GSList *curr)
return NULL;
}
static const char *_str_func_default(const char *orig)
static const char *
_str_func_default(const char *orig)
{
return orig;
}
static const char *_copy_func_default(const char *orig)
static const char *
_copy_func_default(const char *orig)
{
return strdup(orig);
}
static int _deep_equals_func_default(const char *o1, const char *o2)
static int
_deep_equals_func_default(const char *o1, const char *o2)
{
return (strcmp(o1, o2) == 0);
}

View File

@ -53,7 +53,8 @@ static void _create_session(PHistory history);
static void _session_previous(PHistory history);
static void _session_next(PHistory history);
PHistory p_history_new(unsigned int size)
PHistory
p_history_new(unsigned int size)
{
PHistory new_history = malloc(sizeof(struct p_history_t));
new_history->items = NULL;
@ -64,7 +65,8 @@ PHistory p_history_new(unsigned int size)
return new_history;
}
void p_history_append(PHistory history, char *item)
void
p_history_append(PHistory history, char *item)
{
char *copied = "";
if (item != NULL) {
@ -105,7 +107,8 @@ void p_history_append(PHistory history, char *item)
}
}
char * p_history_previous(PHistory history, char *item)
char *
p_history_previous(PHistory history, char *item)
{
// no history
if (history->items == NULL) {
@ -135,7 +138,8 @@ char * p_history_previous(PHistory history, char *item)
return result;
}
char * p_history_next(PHistory history, char *item)
char *
p_history_next(PHistory history, char *item)
{
// no history, or no session, return NULL
if ((history->items == NULL) || (history->session.items == NULL)) {
@ -154,7 +158,8 @@ char * p_history_next(PHistory history, char *item)
return result;
}
static void _replace_history_with_session(PHistory history)
static void
_replace_history_with_session(PHistory history)
{
g_list_free(history->items);
history->items = g_list_copy(history->session.items);
@ -166,13 +171,15 @@ static void _replace_history_with_session(PHistory history)
_reset_session(history);
}
static gboolean _adding_new(PHistory history)
static gboolean
_adding_new(PHistory history)
{
return (history->session.sess_curr ==
g_list_last(history->session.items));
}
static void _reset_session(PHistory history)
static void
_reset_session(PHistory history)
{
history->session.items = NULL;
history->session.sess_curr = NULL;
@ -180,29 +187,34 @@ static void _reset_session(PHistory history)
history->session.orig_curr = NULL;
}
static gboolean _has_session(PHistory history)
static gboolean
_has_session(PHistory history)
{
return (history->session.items != NULL);
}
static void _remove_first(PHistory history)
static void
_remove_first(PHistory history)
{
GList *first = g_list_first(history->items);
char *first_item = first->data;
history->items = g_list_remove(history->items, first_item);
}
static void _update_current_session_item(PHistory history, char *item)
static void
_update_current_session_item(PHistory history, char *item)
{
history->session.sess_curr->data = item;
}
static void _add_to_history(PHistory history, char *item)
static void
_add_to_history(PHistory history, char *item)
{
history->items = g_list_append(history->items, item);
}
static void _remove_last_session_item(PHistory history)
static void
_remove_last_session_item(PHistory history)
{
history->session.items = g_list_reverse(history->session.items);
GList *first = g_list_first(history->session.items);
@ -211,19 +223,22 @@ static void _remove_last_session_item(PHistory history)
history->session.items = g_list_reverse(history->session.items);
}
static void _replace_current_with_original(PHistory history)
static void
_replace_current_with_original(PHistory history)
{
history->session.sess_curr->data = strdup(history->session.orig_curr->data);
}
static void _create_session(PHistory history)
static void
_create_session(PHistory history)
{
history->session.items = g_list_copy(history->items);
history->session.sess_curr = g_list_last(history->session.items);
history->session.orig_curr = g_list_last(history->items);
}
static void _session_previous(PHistory history)
static void
_session_previous(PHistory history)
{
history->session.sess_curr =
g_list_previous(history->session.sess_curr);
@ -239,7 +254,8 @@ static void _session_previous(PHistory history)
}
}
static void _session_next(PHistory history)
static void
_session_next(PHistory history)
{
history->session.sess_curr = g_list_next(history->session.sess_curr);
history->session.orig_curr = g_list_next(history->session.orig_curr);

View File

@ -37,7 +37,8 @@
static void _profanity_shutdown(void);
void profanity_run(void)
void
profanity_run(void)
{
gboolean cmd_result = TRUE;
@ -66,7 +67,8 @@ void profanity_run(void)
}
void profanity_init(const int disable_tls)
void
profanity_init(const int disable_tls)
{
create_config_directory();
log_init();
@ -79,7 +81,8 @@ void profanity_init(const int disable_tls)
atexit(_profanity_shutdown);
}
void _profanity_shutdown(void)
void
_profanity_shutdown(void)
{
jabber_disconnect();
gui_close();

View File

@ -38,7 +38,8 @@ static char curr_time[80];
static void _status_bar_update_time(void);
void create_status_bar(void)
void
create_status_bar(void)
{
int rows, cols, i;
getmaxyx(stdscr, rows, cols);
@ -58,7 +59,8 @@ void create_status_bar(void)
dirty = TRUE;
}
void status_bar_refresh(void)
void
status_bar_refresh(void)
{
char new_time[80];
get_time(new_time);
@ -76,7 +78,8 @@ void status_bar_refresh(void)
}
}
void status_bar_resize(void)
void
status_bar_resize(void)
{
int rows, cols, i;
getmaxyx(stdscr, rows, cols);
@ -103,7 +106,8 @@ void status_bar_resize(void)
dirty = TRUE;
}
void status_bar_inactive(const int win)
void
status_bar_inactive(const int win)
{
is_active[win-1] = FALSE;
is_new[win-1] = FALSE;
@ -120,7 +124,8 @@ void status_bar_inactive(const int win)
dirty = TRUE;
}
void status_bar_active(const int win)
void
status_bar_active(const int win)
{
is_active[win-1] = TRUE;
is_new[win-1] = FALSE;
@ -140,7 +145,8 @@ void status_bar_active(const int win)
dirty = TRUE;
}
void status_bar_new(const int win)
void
status_bar_new(const int win)
{
is_active[win-1] = TRUE;
is_new[win-1] = TRUE;
@ -162,13 +168,15 @@ void status_bar_new(const int win)
dirty = TRUE;
}
void status_bar_get_password(void)