diff options
author | James Booth <boothj5@gmail.com> | 2015-10-26 00:52:33 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-10-26 00:52:33 +0000 |
commit | dd11334b06e11e26e925e289b84176911c05cd16 (patch) | |
tree | b5c305eb9f8859abea7667653d0da6e188b94d3c | |
parent | c8a6bdb381c9a666fc340e8b7fc74100e7328d8c (diff) | |
download | profani-tty-dd11334b06e11e26e925e289b84176911c05cd16.tar.gz |
Applied coding style to src/
-rw-r--r-- | src/chat_session.c | 22 | ||||
-rw-r--r-- | src/chat_session.h | 3 | ||||
-rw-r--r-- | src/chat_state.c | 12 | ||||
-rw-r--r-- | src/common.c | 34 | ||||
-rw-r--r-- | src/common.h | 3 | ||||
-rw-r--r-- | src/contact.c | 50 | ||||
-rw-r--r-- | src/contact.h | 7 | ||||
-rw-r--r-- | src/jid.c | 18 | ||||
-rw-r--r-- | src/log.c | 76 | ||||
-rw-r--r-- | src/log.h | 11 | ||||
-rw-r--r-- | src/muc.c | 155 | ||||
-rw-r--r-- | src/muc.h | 7 | ||||
-rw-r--r-- | src/profanity.c | 4 | ||||
-rw-r--r-- | src/resource.c | 7 | ||||
-rw-r--r-- | src/resource.h | 5 | ||||
-rw-r--r-- | src/roster_list.c | 79 | ||||
-rw-r--r-- | src/roster_list.h | 14 | ||||
-rw-r--r-- | src/window_list.c | 54 |
18 files changed, 271 insertions, 290 deletions
diff --git a/src/chat_session.c b/src/chat_session.c index 2758d603..162a60d5 100644 --- a/src/chat_session.c +++ b/src/chat_session.c @@ -46,8 +46,8 @@ static GHashTable *sessions; static void -_chat_session_new(const char * const barejid, const char * const resource, - gboolean resource_override, gboolean send_states) +_chat_session_new(const char *const barejid, const char *const resource, gboolean resource_override, + gboolean send_states) { assert(barejid != NULL); assert(resource != NULL); @@ -86,19 +86,19 @@ chat_sessions_clear(void) } void -chat_session_resource_override(const char * const barejid, const char * const resource) +chat_session_resource_override(const char *const barejid, const char *const resource) { _chat_session_new(barejid, resource, TRUE, TRUE); } ChatSession* -chat_session_get(const char * const barejid) +chat_session_get(const char *const barejid) { return g_hash_table_lookup(sessions, barejid); } void -chat_session_recipient_gone(const char * const barejid, const char * const resource) +chat_session_recipient_gone(const char *const barejid, const char *const resource) { assert(barejid != NULL); assert(resource != NULL); @@ -112,25 +112,25 @@ chat_session_recipient_gone(const char * const barejid, const char * const resou } void -chat_session_recipient_typing(const char * const barejid, const char * const resource) +chat_session_recipient_typing(const char *const barejid, const char *const resource) { chat_session_recipient_active(barejid, resource, TRUE); } void -chat_session_recipient_paused(const char * const barejid, const char * const resource) +chat_session_recipient_paused(const char *const barejid, const char *const resource) { chat_session_recipient_active(barejid, resource, TRUE); } void -chat_session_recipient_inactive(const char * const barejid, const char * const resource) +chat_session_recipient_inactive(const char *const barejid, const char *const resource) { chat_session_recipient_active(barejid, resource, TRUE); } void -chat_session_recipient_active(const char * const barejid, const char * const resource, +chat_session_recipient_active(const char *const barejid, const char *const resource, gboolean send_states) { assert(barejid != NULL); @@ -153,7 +153,7 @@ chat_session_recipient_active(const char * const barejid, const char * const res } void -chat_session_remove(const char * const barejid) +chat_session_remove(const char *const barejid) { g_hash_table_remove(sessions, barejid); -} \ No newline at end of file +} diff --git a/src/chat_session.h b/src/chat_session.h index e3372687..9f84cbec 100644 --- a/src/chat_session.h +++ b/src/chat_session.h @@ -51,8 +51,7 @@ void chat_sessions_clear(void); void chat_session_resource_override(const char *const barejid, const char *const resource); ChatSession* chat_session_get(const char *const barejid); -void chat_session_recipient_active(const char *const barejid, const char *const resource, - gboolean send_states); +void chat_session_recipient_active(const char *const barejid, const char *const resource, gboolean send_states); void chat_session_recipient_typing(const char *const barejid, const char *const resource); void chat_session_recipient_paused(const char *const barejid, const char *const resource); void chat_session_recipient_gone(const char *const barejid, const char *const resource); diff --git a/src/chat_state.c b/src/chat_state.c index 8ddb6f1e..8e8e974f 100644 --- a/src/chat_state.c +++ b/src/chat_state.c @@ -44,7 +44,7 @@ #define PAUSED_TIMEOUT 10.0 #define INACTIVE_TIMEOUT 30.0 -static void _send_if_supported(const char * const barejid, void(*send_func)(const char * const)); +static void _send_if_supported(const char *const barejid, void (*send_func)(const char *const)); ChatState* chat_state_new(void) @@ -66,7 +66,7 @@ chat_state_free(ChatState *state) } void -chat_state_handle_idle(const char * const barejid, ChatState *state) +chat_state_handle_idle(const char *const barejid, ChatState *state) { gdouble elapsed = g_timer_elapsed(state->timer, NULL); @@ -118,7 +118,7 @@ chat_state_handle_idle(const char * const barejid, ChatState *state) } void -chat_state_handle_typing(const char * const barejid, ChatState *state) +chat_state_handle_typing(const char *const barejid, ChatState *state) { // ACTIVE|INACTIVE|PAUSED|GONE -> COMPOSING if (state->type != CHAT_STATE_COMPOSING) { @@ -138,7 +138,7 @@ chat_state_active(ChatState *state) } void -chat_state_gone(const char * const barejid, ChatState *state) +chat_state_gone(const char *const barejid, ChatState *state) { if (state->type != CHAT_STATE_GONE) { if (prefs_get_boolean(PREF_STATES)) { @@ -150,7 +150,7 @@ chat_state_gone(const char * const barejid, ChatState *state) } static void -_send_if_supported(const char * const barejid, void(*send_func)(const char * const)) +_send_if_supported(const char *const barejid, void (*send_func)(const char *const)) { gboolean send = TRUE; GString *jid = g_string_new(barejid); @@ -169,4 +169,4 @@ _send_if_supported(const char * const barejid, void(*send_func)(const char * con } g_string_free(jid, TRUE); -} \ No newline at end of file +} diff --git a/src/common.c b/src/common.c index c77c45c8..390659af 100644 --- a/src/common.c +++ b/src/common.c @@ -62,7 +62,7 @@ static unsigned long unique_id = 0; static size_t _data_callback(void *ptr, size_t size, size_t nmemb, void *data); // taken from glib 2.30.3 -gchar * +gchar* p_utf8_substring(const gchar *str, glong start_pos, glong end_pos) { gchar *start, *end, *out; @@ -102,7 +102,7 @@ p_hash_table_add(GHashTable *hash_table, gpointer key) } gboolean -p_hash_table_contains(GHashTable *hash_table, gconstpointer key) +p_hash_table_contains(GHashTable *hash_table, gconstpointer key) { // doesn't handle when key exists, but value == NULL gpointer found = g_hash_table_lookup(hash_table, key); @@ -148,7 +148,7 @@ mkdir_recursive(const char *dir) return result; } -char * +char* str_replace(const char *string, const char *substr, const char *replacement) { @@ -193,7 +193,7 @@ str_replace(const char *string, const char *substr, } gboolean -str_contains_str(const char * const searchstr, const char * const substr) +str_contains_str(const char *const searchstr, const char *const substr) { if (!searchstr) { return FALSE; @@ -244,7 +244,7 @@ strtoi_range(char *str, int *saveptr, int min, int max, char **err_msg) } int -utf8_display_len(const char * const str) +utf8_display_len(const char *const str) { if (!str) { return 0; @@ -265,7 +265,7 @@ utf8_display_len(const char * const str) return len; } -char * +char* prof_getline(FILE *stream) { char *buf; @@ -309,8 +309,8 @@ prof_getline(FILE *stream) return s; } -char * -release_get_latest() +char* +release_get_latest(void) { char *url = "http://www.profanity.im/profanity_version.txt"; @@ -362,7 +362,7 @@ release_is_new(char *found_version) } gboolean -valid_resource_presence_string(const char * const str) +valid_resource_presence_string(const char *const str) { assert(str != NULL); if ((strcmp(str, "online") == 0) || (strcmp(str, "chat") == 0) || @@ -374,7 +374,7 @@ valid_resource_presence_string(const char * const str) } } -const char * +const char* string_from_resource_presence(resource_presence_t presence) { switch(presence) @@ -393,7 +393,7 @@ string_from_resource_presence(resource_presence_t presence) } resource_presence_t -resource_presence_from_string(const char * const str) +resource_presence_from_string(const char *const str) { if (str == NULL) { return RESOURCE_ONLINE; @@ -430,7 +430,7 @@ contact_presence_from_resource_presence(resource_presence_t resource_presence) } } -gchar * +gchar* xdg_get_config_home(void) { gchar *xdg_config_home = getenv("XDG_CONFIG_HOME"); @@ -449,7 +449,7 @@ xdg_get_config_home(void) } } -gchar * +gchar* xdg_get_data_home(void) { gchar *xdg_data_home = getenv("XDG_DATA_HOME"); @@ -468,7 +468,7 @@ xdg_get_data_home(void) } } -char * +char* create_unique_id(char *prefix) { char *result = NULL; @@ -492,7 +492,7 @@ reset_unique_id(void) unique_id = 0; } -char * +char* p_sha1_hash(char *str) { P_SHA1_CTX ctx; @@ -623,8 +623,8 @@ get_file_or_linked(char *loc, char *basedir) return true_loc; } -char * -strip_arg_quotes(const char * const input) +char* +strip_arg_quotes(const char *const input) { char *unquoted = strdup(input); diff --git a/src/common.h b/src/common.h index 3b05df29..45907514 100644 --- a/src/common.h +++ b/src/common.h @@ -102,8 +102,7 @@ gboolean p_hash_table_contains(GHashTable *hash_table, gconstpointer key); gboolean create_dir(char *name); gboolean mkdir_recursive(const char *dir); -char* str_replace(const char *string, const char *substr, - const char *replacement); +char* str_replace(const char *string, const char *substr, const char *replacement); gboolean str_contains_str(const char *const searchstr, const char *const substr); int str_contains(const char str[], int size, char ch); gboolean strtoi_range(char *str, int *saveptr, int min, int max, char **err_msg); diff --git a/src/contact.c b/src/contact.c index 713af955..28fd69a1 100644 --- a/src/contact.c +++ b/src/contact.c @@ -58,9 +58,9 @@ struct p_contact_t { }; PContact -p_contact_new(const char * const barejid, const char * const name, - GSList *groups, const char * const subscription, - const char * const offline_message, gboolean pending_out) +p_contact_new(const char *const barejid, const char *const name, + GSList *groups, const char *const subscription, + const char *const offline_message, gboolean pending_out) { PContact contact = malloc(sizeof(struct p_contact_t)); contact->barejid = strdup(barejid); @@ -98,7 +98,7 @@ p_contact_new(const char * const barejid, const char * const name, } void -p_contact_set_name(const PContact contact, const char * const name) +p_contact_set_name(const PContact contact, const char *const name) { FREE_SET_NULL(contact->name); FREE_SET_NULL(contact->name_collate_key); @@ -120,7 +120,7 @@ p_contact_set_groups(const PContact contact, GSList *groups) } gboolean -p_contact_in_group(const PContact contact, const char * const group) +p_contact_in_group(const PContact contact, const char *const group) { GSList *groups = contact->groups; while (groups) { @@ -133,14 +133,14 @@ p_contact_in_group(const PContact contact, const char * const group) return FALSE; } -GSList * +GSList* p_contact_groups(const PContact contact) { return contact->groups; } gboolean -p_contact_remove_resource(PContact contact, const char * const resource) +p_contact_remove_resource(PContact contact, const char *const resource) { gboolean result = g_hash_table_remove(contact->available_resources, resource); autocomplete_remove(contact->resource_ac, resource); @@ -173,31 +173,31 @@ p_contact_free(PContact contact) } } -const char * +const char* p_contact_barejid(const PContact contact) { return contact->barejid; } -const char * +const char* p_contact_barejid_collate_key(const PContact contact) { return contact->barejid_collate_key; } -const char * +const char* p_contact_name(const PContact contact) { return contact->name; } -const char * +const char* p_contact_name_collate_key(const PContact contact) { return contact->name_collate_key; } -const char * +const char* p_contact_name_or_jid(const PContact contact) { if (contact->name) { @@ -207,8 +207,8 @@ p_contact_name_or_jid(const PContact contact) } } -char * -p_contact_create_display_string(const PContact contact, const char * const resource) +char* +p_contact_create_display_string(const PContact contact, const char *const resource) { GString *result_str = g_string_new(""); @@ -229,7 +229,7 @@ p_contact_create_display_string(const PContact contact, const char * const resou return result; } -static Resource * +static Resource* _highest_presence(Resource *first, Resource *second) { if (first->presence == RESOURCE_CHAT) { @@ -253,7 +253,7 @@ _highest_presence(Resource *first, Resource *second) } } -Resource * +Resource* _get_most_available_resource(PContact contact) { // find resource with highest priority, if more than one, @@ -287,7 +287,7 @@ _get_most_available_resource(PContact contact) return highest; } -const char * +const char* p_contact_presence(const PContact contact) { assert(contact != NULL); @@ -302,7 +302,7 @@ p_contact_presence(const PContact contact) return string_from_resource_presence(resource->presence); } -const char * +const char* p_contact_status(const PContact contact) { assert(contact != NULL); @@ -317,7 +317,7 @@ p_contact_status(const PContact contact) return resource->status; } -const char * +const char* p_contact_subscription(const PContact contact) { return contact->subscription; @@ -337,8 +337,8 @@ p_contact_subscribed(const PContact contact) } } -Resource * -p_contact_get_resource(const PContact contact, const char * const resource) +Resource* +p_contact_get_resource(const PContact contact, const char *const resource) { return g_hash_table_lookup(contact->available_resources, resource); } @@ -349,13 +349,13 @@ p_contact_pending_out(const PContact contact) return contact->pending_out; } -GDateTime * +GDateTime* p_contact_last_activity(const PContact contact) { return contact->last_activity; } -GList * +GList* p_contact_get_available_resources(const PContact contact) { assert(contact != NULL); @@ -406,7 +406,7 @@ p_contact_set_presence(const PContact contact, Resource *resource) } void -p_contact_set_subscription(const PContact contact, const char * const subscription) +p_contact_set_subscription(const PContact contact, const char *const subscription) { FREE_SET_NULL(contact->subscription); if (subscription) { @@ -443,4 +443,4 @@ void p_contact_resource_ac_reset(const PContact contact) { autocomplete_reset(contact->resource_ac); -} \ No newline at end of file +} diff --git a/src/contact.h b/src/contact.h index a65c25df..2d22db19 100644 --- a/src/contact.h +++ b/src/contact.h @@ -40,9 +40,8 @@ typedef struct p_contact_t *PContact; -PContact p_contact_new(const char *const barejid, const char *const name, - GSList *groups, const char *const subscription, - const char *const offline_message, gboolean pending_out); +PContact p_contact_new(const char *const barejid, const char *const name, GSList *groups, + const char *const subscription, const char *const offline_message, gboolean pending_out); void p_contact_add_resource(PContact contact, Resource *resource); gboolean p_contact_remove_resource(PContact contact, const char *const resource); void p_contact_free(PContact contact); @@ -67,7 +66,7 @@ gboolean p_contact_is_available(const PContact contact); gboolean p_contact_has_available_resource(const PContact contact); Resource* p_contact_get_resource(const PContact contact, const char *const resource); void p_contact_set_groups(const PContact contact, GSList *groups); -GSList * p_contact_groups(const PContact contact); +GSList* p_contact_groups(const PContact contact); gboolean p_contact_in_group(const PContact contact, const char *const group); gboolean p_contact_subscribed(const PContact contact); char* p_contact_create_display_string(const PContact contact, const char *const resource); diff --git a/src/jid.c b/src/jid.c index 8b40d16a..ae9bcc90 100644 --- a/src/jid.c +++ b/src/jid.c @@ -41,8 +41,8 @@ #include "common.h" -Jid * -jid_create(const gchar * const str) +Jid* +jid_create(const gchar *const str) { Jid *result = NULL; @@ -106,8 +106,8 @@ jid_create(const gchar * const str) return result; } -Jid * -jid_create_from_bare_and_resource(const char * const room, const char * const nick) +Jid* +jid_create_from_bare_and_resource(const char *const room, const char *const nick) { Jid *result; char *jid = create_fulljid(room, nick); @@ -142,8 +142,8 @@ jid_is_valid_room_form(Jid *jid) * barejid/resourcepart * Will return a newly created string that must be freed by the caller */ -char * -create_fulljid(const char * const barejid, const char * const resource) +char* +create_fulljid(const char *const barejid, const char *const resource) { gchar *barejidlower = g_utf8_strdown(barejid, -1); GString *full_jid = g_string_new(barejidlower); @@ -163,8 +163,8 @@ create_fulljid(const char * const barejid, const char * const resource) * Full JID = "test@conference.server/person" * returns "person" */ -char * -get_nick_from_full_jid(const char * const full_room_jid) +char* +get_nick_from_full_jid(const char *const full_room_jid) { char **tokens = g_strsplit(full_room_jid, "/", 0); char *nick_part = NULL; @@ -184,7 +184,7 @@ get_nick_from_full_jid(const char * const full_room_jid) /* * get the fulljid, fall back to the barejid */ -char * +char* jid_fulljid_or_barejid(Jid *jid) { if (jid->fulljid) { diff --git a/src/log.c b/src/log.c index 5537c612..a5bd30fa 100644 --- a/src/log.c +++ b/src/log.c @@ -78,23 +78,22 @@ struct dated_chat_log { }; static gboolean _log_roll_needed(struct dated_chat_log *dated_log); -static struct dated_chat_log * _create_log(const char * const other, const char * const login); -static struct dated_chat_log * _create_groupchat_log(char *room, const char * const login); +static struct dated_chat_log* _create_log(const char *const other, const char *const login); +static struct dated_chat_log* _create_groupchat_log(char *room, const char *const login); static void _free_chat_log(struct dated_chat_log *dated_log); static gboolean _key_equals(void *key1, void *key2); -static char * _get_log_filename(const char * const other, const char * const login, - GDateTime *dt, gboolean create); -static char * _get_groupchat_log_filename(const char * const room, - const char * const login, GDateTime *dt, gboolean create); -static gchar * _get_chatlog_dir(void); -static gchar * _get_main_log_file(void); +static char* _get_log_filename(const char *const other, const char *const login, GDateTime *dt, gboolean create); +static char* _get_groupchat_log_filename(const char *const room, const char *const login, GDateTime *dt, + gboolean create); +static gchar* _get_chatlog_dir(void); +static gchar* _get_main_log_file(void); static void _rotate_log_file(void); static char* _log_string_from_level(log_level_t level); -static void _chat_log_chat(const char * const login, const char * const other, - const gchar * const msg, chat_log_direction_t direction, GDateTime *timestamp); +static void _chat_log_chat(const char *const login, const char *const other, const gchar *const msg, + chat_log_direction_t direction, GDateTime *timestamp); void -log_debug(const char * const msg, ...) +log_debug(const char *const msg, ...) { va_list arg; va_start(arg, msg); @@ -106,7 +105,7 @@ log_debug(const char * const msg, ...) } void -log_info(const char * const msg, ...) +log_info(const char *const msg, ...) { va_list arg; va_start(arg, msg); @@ -118,7 +117,7 @@ log_info(const char * const msg, ...) } void -log_warning(const char * const msg, ...) +log_warning(const char *const msg, ...) { va_list arg; va_start(arg, msg); @@ -130,7 +129,7 @@ log_warning(const char * const msg, ...) } void -log_error(const char * const msg, ...) +log_error(const char *const msg, ...) { va_list arg; va_start(arg, msg); @@ -160,7 +159,7 @@ log_reinit(void) log_init(level_filter); } -char * +char* get_log_file_location(void) { return mainlogfile->str; @@ -183,7 +182,7 @@ log_close(void) } void -log_msg(log_level_t level, const char * const area, const char * const msg) +log_msg(log_level_t level, const char *const area, const char *const msg) { if (level >= level_filter && logp) { dt = g_date_time_new_now(tz); @@ -263,7 +262,7 @@ groupchat_log_init(void) } void -chat_log_msg_out(const char * const barejid, const char * const msg) +chat_log_msg_out(const char *const barejid, const char *const msg) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -274,7 +273,7 @@ chat_log_msg_out(const char * const barejid, const char * const msg) } void -chat_log_otr_msg_out(const char * const barejid, const char * const msg) +chat_log_otr_msg_out(const char *const barejid, const char *const msg) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -291,7 +290,7 @@ chat_log_otr_msg_out(const char * const barejid, const char * const msg) } void -chat_log_pgp_msg_out(const char * const barejid, const char * const msg) +chat_log_pgp_msg_out(const char *const barejid, const char *const msg) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -308,7 +307,7 @@ chat_log_pgp_msg_out(const char * const barejid, const char * const msg) } void -chat_log_otr_msg_in(const char * const barejid, const char * const msg, gboolean was_decrypted, GDateTime *timestamp) +chat_log_otr_msg_in(const char *const barejid, const char *const msg, gboolean was_decrypted, GDateTime *timestamp) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -325,7 +324,7 @@ chat_log_otr_msg_in(const char * const barejid, const char * const msg, gboolean } void -chat_log_pgp_msg_in(const char * const barejid, const char * const msg, GDateTime *timestamp) +chat_log_pgp_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -342,7 +341,7 @@ chat_log_pgp_msg_in(const char * const barejid, const char * const msg, GDateTim } void -chat_log_msg_in(const char * const barejid, const char * const msg, GDateTime *timestamp) +chat_log_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -353,8 +352,8 @@ chat_log_msg_in(const char * const barejid, const char * const msg, GDateTime *t } static void -_chat_log_chat(const char * const login, const char * const other, - const char * const msg, chat_log_direction_t direction, GDateTime *timestamp) +_chat_log_chat(const char *const login, const char *const other, const char *const msg, + chat_log_direction_t direction, GDateTime *timestamp) { struct dated_chat_log *dated_log = g_hash_table_lookup(logs, other); @@ -404,8 +403,7 @@ _chat_log_chat(const char * const login, const char * const other, } void -groupchat_log_chat(const gchar * const login, const gchar * const room, - const gchar * const nick, const gchar * const msg) +groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, const gchar *const msg) { gchar *room_copy = strdup(room); struct dated_chat_log *dated_log = g_hash_table_lookup(groupchat_logs, room_copy); @@ -446,8 +444,8 @@ groupchat_log_chat(const gchar * const login, const gchar * const room, } -GSList * -chat_log_get_previous(const gchar * const login, const gchar * const recipient) +GSList* +chat_log_get_previous(const gchar *const login, const gchar *const recipient) { GSList *history = NULL; GDateTime *now = g_date_time_new_now_local(); @@ -502,8 +500,8 @@ chat_log_close(void) g_date_time_unref(session_started); } -static struct dated_chat_log * -_create_log(const char * const other, const char * const login) +static struct dated_chat_log* +_create_log(const char *const other, const char *const login) { GDateTime *now = g_date_time_new_now_local(); char *filename = _get_log_filename(other, login, now, TRUE); @@ -517,8 +515,8 @@ _create_log(const char * const other, const char * const login) return new_log; } -static struct dated_chat_log * -_create_groupchat_log(char *room, const char * const login) +static struct dated_chat_log* +_create_groupchat_log(char *room, const char *const login) { GDateTime *now = g_date_time_new_now_local(); char *filename = _get_groupchat_log_filename(room, login, now, TRUE); @@ -571,9 +569,8 @@ gboolean _key_equals(void *key1, void *key2) return (g_strcmp0(str1, str2) == 0); } -static char * -_get_log_filename(const char * const other, const char * const login, - GDateTime *dt, gboolean create) +static char* +_get_log_filename(const char *const other, const char *const login, GDateTime *dt, gboolean create) { gchar *chatlogs_dir = _get_chatlog_dir(); GString *log_file = g_string_new(chatlogs_dir); @@ -603,9 +600,8 @@ _get_log_filename(const char * const other, const char * const login, return result; } -static char * -_get_groupchat_log_filename(const char * const room, const char * const login, - GDateTime *dt, gboolean create) +static char* +_get_groupchat_log_filename(const char *const room, const char *const login, GDateTime *dt, gboolean create) { gchar *chatlogs_dir = _get_chatlog_dir(); GString *log_file = g_string_new(chatlogs_dir); @@ -640,7 +636,7 @@ _get_groupchat_log_filename(const char * const room, const char * const login, return result; } -static gchar * +static gchar* _get_chatlog_dir(void) { gchar *xdg_data = xdg_get_data_home(); @@ -653,7 +649,7 @@ _get_chatlog_dir(void) return result; } -static gchar * +static gchar* _get_main_log_file(void) { gchar *xdg_data = xdg_get_data_home(); diff --git a/src/log.h b/src/log.h index 22bf6f30..c26c2fea 100644 --- a/src/log.h +++ b/src/log.h @@ -59,8 +59,7 @@ void log_debug(const char *const msg, ...); void log_info(const char *const msg, ...); void log_warning(const char *const msg, ...); void log_error(const char *const msg, ...); -void log_msg(log_level_t level, const char *const area, - const char *const msg); +void log_msg(log_level_t level, const char *const area, const char *const msg); log_level_t log_level_from_string(char *log_level); void log_stderr_init(log_level_t level); @@ -78,10 +77,10 @@ void chat_log_otr_msg_in(const char *const barejid, const char *const msg, gbool void chat_log_pgp_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp); void chat_log_close(void); -GSList* chat_log_get_previous(const gchar *const login, - const gchar *const recipient); +GSList* chat_log_get_previous(const gchar *const login, const gchar *const recipient); void groupchat_log_init(void); -void groupchat_log_chat(const gchar *const login, const gchar *const room, - const gchar *const nick, const gchar *const msg); +void groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, + const gchar *const msg); + #endif diff --git a/src/muc.c b/src/muc.c index 8bc530aa..1ceb7ce0 100644 --- a/src/muc.c +++ b/src/muc.c @@ -72,12 +72,12 @@ Autocomplete invite_ac; static void _free_room(ChatRoom *room); static gint _compare_occupants(Occupant *a, Occupant *b); -static muc_role_t _role_from_string(const char * const role); -static muc_affiliation_t _affiliation_from_string(const char * const affiliation); +static muc_role_t _role_from_string(const char *const role); +static muc_affiliation_t _affiliation_from_string(const char *const affiliation); static char* _role_to_string(muc_role_t role); static char* _affiliation_to_string(muc_affiliation_t affiliation); -static Occupant* _muc_occupant_new(const char *const nick, const char * const jid, - muc_role_t role, muc_affiliation_t affiliation, resource_presence_t presence, const char * const status); +static Occupant* _muc_occupant_new(const char *const nick, const char *const jid, muc_role_t role, + muc_affiliation_t affiliation, resource_presence_t presence, const char *const status); static void _occupant_free(Occupant *occupant); void @@ -99,7 +99,7 @@ muc_close(void) } void -muc_invites_add(const char * const room, const char * const password) +muc_invites_add(const char *const room, const char *const password) { autocomplete_add(invite_ac, room); if (password) { @@ -108,7 +108,7 @@ muc_invites_add(const char * const room, const char * const password) } void -muc_invites_remove(const char * const room) +muc_invites_remove(const char *const room) { autocomplete_remove(invite_ac, room); g_hash_table_remove(invite_passwords, room); @@ -120,20 +120,20 @@ muc_invites_count(void) return autocomplete_length(invite_ac); } -GSList * +GSList* muc_invites(void) { return autocomplete_create_list(invite_ac); } -char * -muc_invite_password(const char * const room) +char* +muc_invite_password(const char *const room) { return g_hash_table_lookup(invite_passwords, room); } gboolean -muc_invites_contain(const char * const room) +muc_invites_contain(const char *const room) { GSList *invites = autocomplete_create_list(invite_ac); GSList *curr = invites; @@ -156,8 +156,8 @@ muc_invites_reset_ac(void) autocomplete_reset(invite_ac); } -char * -muc_invites_find(const char * const search_str) +char* +muc_invites_find(const char *const search_str) { return autocomplete_complete(invite_ac, search_str, TRUE); } @@ -172,8 +172,7 @@ muc_invites_clear(void) } void -muc_join(const char * const room, const char * const nick, - const char * const password, gboolean autojoin) +muc_join(const char *const room, const char *const nick, const char *const password, gboolean autojoin) { ChatRoom *new_room = malloc(sizeof(ChatRoom)); new_room->room = strdup(room); @@ -202,13 +201,13 @@ muc_join(const char * const room, const char * const nick, } void -muc_leave(const char * const room) +muc_leave(const char *const room) { g_hash_table_remove(rooms, room); } gboolean -muc_requires_config(const char * const room) +muc_requires_config(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -220,7 +219,7 @@ muc_requires_config(const char * const room) } void -muc_set_requires_config(const char * const room, gboolean val) +muc_set_requires_config(const char *const room, gboolean val) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -229,7 +228,7 @@ muc_set_requires_config(const char * const room, gboolean val) } void -muc_set_features(const char * const room, GSList *features) +muc_set_features(const char *const room, GSList *features) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room && features) { @@ -245,14 +244,14 @@ muc_set_features(const char * const room, GSList *features) * Returns TRUE if the user is currently in the room */ gboolean -muc_active(const char * const room) +muc_active(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); return (chat_room != NULL); } gboolean -muc_autojoin(const char * const room) +muc_autojoin(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -263,7 +262,7 @@ muc_autojoin(const char * const room) } void -muc_set_subject(const char * const room, const char * const subject) +muc_set_subject(const char *const room, const char *const subject) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -276,8 +275,8 @@ muc_set_subject(const char * const room, const char * const subject) } } -char * -muc_subject(const char * const room) +char* +muc_subject(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -288,7 +287,7 @@ muc_subject(const char * const room) } void -muc_pending_broadcasts_add(const char * const room, const char * const message) +muc_pending_broadcasts_add(const char *const room, const char *const message) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -296,8 +295,8 @@ muc_pending_broadcasts_add(const char * const room, const char * const message) } } -GList * -muc_pending_broadcasts(const char * const room) +GList* +muc_pending_broadcasts(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -307,8 +306,8 @@ muc_pending_broadcasts(const char * const room) } } -char * -muc_old_nick(const char * const room, const char * const new_nick) +char* +muc_old_nick(const char *const room, const char *const new_nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room && chat_room->pending_nick_change) { @@ -323,7 +322,7 @@ muc_old_nick(const char * const room, const char * const new_nick) * and is awaiting the response */ void -muc_nick_change_start(const char * const room, const char * const new_nick) +muc_nick_change_start(const char *const room, const char *const new_nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -337,7 +336,7 @@ muc_nick_change_start(const char * const room, const char * const new_nick) * nick change */ gboolean -muc_nick_change_pending(const char * const room) +muc_nick_change_pending(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -352,7 +351,7 @@ muc_nick_change_pending(const char * const room) * the service has responded */ void -muc_nick_change_complete(const char * const room, const char * const nick) +muc_nick_change_complete(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -370,7 +369,7 @@ muc_nick_change_complete(const char * const room, const char * const nick) * The contents of the list are owned by the chat room and should not be * modified or freed. */ -GList * +GList* muc_rooms(void) { return g_hash_table_get_keys(rooms); @@ -380,8 +379,8 @@ muc_rooms(void) * Return current users nickname for the specified room * The nickname is owned by the chat room and should not be modified or freed */ -char * -muc_nick(const char * const room) +char* +muc_nick(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -395,8 +394,8 @@ muc_nick(const char * const room) * Return password for the specified room * The password is owned by the chat room and should not be modified or freed */ -char * -muc_password(const char * const room) +char* +muc_password(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -410,7 +409,7 @@ muc_password(const char * const room) * Returns TRUE if the specified nick exists in the room's roster */ gboolean -muc_roster_contains_nick(const char * const room, const char * const nick) +muc_roster_contains_nick(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -425,8 +424,8 @@ muc_roster_contains_nick(const char * const room, const char * const nick) * Add a new chat room member to the room's roster */ gboolean -muc_roster_add(const char * const room, const char * const nick, const char * const jid, - const char * const role, const char * const affiliation, const char * const show, const char * const status) +muc_roster_add(const char *const room, const char *const nick, const char *const jid, const char *const role, + const char *const affiliation, const char *const show, const char *const status) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); gboolean updated = FALSE; @@ -465,7 +464,7 @@ muc_roster_add(const char * const room, const char * const nick, const char * co * Remove a room member from the room's roster */ void -muc_roster_remove(const char * const room, const char * const nick) +muc_roster_remove(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -474,8 +473,8 @@ muc_roster_remove(const char * const room, const char * const nick) } } -Occupant * -muc_roster_item(const char * const room, const char * const nick) +Occupant* +muc_roster_item(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -489,8 +488,8 @@ muc_roster_item(const char * const room, const char * const nick) /* * Return a list of PContacts representing the room members in the room's roster */ -GList * -muc_roster(const char * const room) +GList* +muc_roster(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -515,7 +514,7 @@ muc_roster(const char * const room) * Return a Autocomplete representing the room member's in the roster */ Autocomplete -muc_roster_ac(const char * const room) +muc_roster_ac(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -526,7 +525,7 @@ muc_roster_ac(const char * const room) } Autocomplete -muc_roster_jid_ac(const char * const room) +muc_roster_jid_ac(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -540,7 +539,7 @@ muc_roster_jid_ac(const char * const room) * Set to TRUE when the rooms roster has been fully received */ void -muc_roster_set_complete(const char * const room) +muc_roster_set_complete(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -552,7 +551,7 @@ muc_roster_set_complete(const char * const room) * Returns TRUE id the rooms roster has been fully received */ gboolean -muc_roster_complete(const char * const room) +muc_roster_complete(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -568,20 +567,20 @@ muc_occupant_available(Occupant *occupant) return (occupant->presence == RESOURCE_ONLINE || occupant->presence == RESOURCE_CHAT); } -const char * +const char* muc_occupant_affiliation_str(Occupant *occupant) { return _affiliation_to_string(occupant->affiliation); } -const char * +const char* muc_occupant_role_str(Occupant *occupant) { return _role_to_string(occupant->role); } -GSList * -muc_occupants_by_role(const char * const room, muc_role_t role) +GSList* +muc_occupants_by_role(const char *const room, muc_role_t role) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -603,8 +602,8 @@ muc_occupants_by_role(const char * const room, muc_role_t role) } } -GSList * -muc_occupants_by_affiliation(const char * const room, muc_affiliation_t affiliation) +GSList* +muc_occupants_by_affiliation(const char *const room, muc_affiliation_t affiliation) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -631,8 +630,7 @@ muc_occupants_by_affiliation(const char * const room, muc_affiliation_t affiliat * is in progress */ void -muc_occupant_nick_change_start(const char * const room, - const char * const new_nick, const char * const old_nick) +muc_occupant_nick_change_start(const char *const room, const char *const new_nick, const char *const old_nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -647,9 +645,8 @@ muc_occupant_nick_change_start(const char * const room, * The old nick name will be returned in a new string which must be freed by * the caller */ -char * -muc_roster_nick_change_complete(const char * const room, - const char * const nick) +char* +muc_roster_nick_change_complete(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -665,8 +662,8 @@ muc_roster_nick_change_complete(const char * const room, return NULL; } -char * -muc_autocomplete(ProfWin *window, const char * const input) +char* +muc_autocomplete(ProfWin *window, const char *const input) { if (window->type == WIN_MUC) { ProfMucWin *mucwin = (ProfMucWin*)window; @@ -708,7 +705,7 @@ muc_autocomplete(ProfWin *window, const char * const input) } void -muc_jid_autocomplete_reset(const char * const room) +muc_jid_autocomplete_reset(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -719,7 +716,7 @@ muc_jid_autocomplete_reset(const char * const room) } void -muc_jid_autocomplete_add_all(const char * const room, GSList *jids) +muc_jid_autocomplete_add_all(const char *const room, GSList *jids) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -741,7 +738,7 @@ muc_jid_autocomplete_add_all(const char * const room, GSList *jids) } void -muc_autocomplete_reset(const char * const room) +muc_autocomplete_reset(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -756,8 +753,8 @@ muc_autocomplete_reset(const char * const room) } } -char * -muc_role_str(const char * const room) +char* +muc_role_str(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -768,7 +765,7 @@ muc_role_str(const char * const room) } void -muc_set_role(const char * const room, const char * const role) +muc_set_role(const char *const room, const char *const role) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -776,8 +773,8 @@ muc_set_role(const char * const room, const char * const role) } } -char * -muc_affiliation_str(const char * const room) +char* +muc_affiliation_str(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -788,7 +785,7 @@ muc_affiliation_str(const char * const room) } void -muc_set_affiliation(const char * const room, const char * const affiliation) +muc_set_affiliation(const char *const room, const char *const affiliation) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -797,7 +794,7 @@ muc_set_affiliation(const char * const room, const char * const affiliation) } muc_member_type_t -muc_member_type(const char * const room) +muc_member_type(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -832,8 +829,8 @@ _free_room(ChatRoom *room) } } -static -gint _compare_occupants(Occupant *a, Occupant *b) +static gint +_compare_occupants(Occupant *a, Occupant *b) { const char * utf8_str_a = a->nick_collate_key; const char * utf8_str_b = b->nick_collate_key; @@ -844,7 +841,7 @@ gint _compare_occupants(Occupant *a, Occupant *b) } static muc_role_t -_role_from_string(const char * const role) +_role_from_string(const char *const role) { if (role) { if (g_strcmp0(role, "visitor") == 0) { @@ -861,7 +858,7 @@ _role_from_string(const char * const role) } } -static char * +static char* _role_to_string(muc_role_t role) { char *result = NULL; @@ -888,7 +885,7 @@ _role_to_string(muc_role_t role) } static muc_affiliation_t -_affiliation_from_string(const char * const affiliation) +_affiliation_from_string(const char *const affiliation) { if (affiliation) { if (g_strcmp0(affiliation, "outcast") == 0) { @@ -907,7 +904,7 @@ _affiliation_from_string(const char * const affiliation) } } -static char * +static char* _affiliation_to_string(muc_affiliation_t affiliation) { char *result = NULL; @@ -937,8 +934,8 @@ _affiliation_to_string(muc_affiliation_t affiliation) } static Occupant* -_muc_occupant_new(const char *const nick, const char * const jid, muc_role_t role, muc_affiliation_t affiliation, resource_presence_t presence, - const char * const status) +_muc_occupant_new(const char *const nick, const char *const jid, muc_role_t role, muc_affiliation_t affiliation, + resource_presence_t presence, const char *const status) { Occupant *occupant = malloc(sizeof(Occupant)); diff --git a/src/muc.h b/src/muc.h index 73077b75..f9fcd0e1 100644 --- a/src/muc.h +++ b/src/muc.h @@ -96,9 +96,8 @@ char* muc_old_nick(const char *const room, const char *const new_nick); gboolean muc_roster_contains_nick(const char *const room, const char *const nick); gboolean muc_roster_complete(const char *const room); -gboolean muc_roster_add(const char *const room, const char *const nick, const char *const jid, - const char *const role, const char *const affiliation, const char *const show, - const char *const status); +gboolean muc_roster_add(const char *const room, const char *const nick, const char *const jid, const char *const role, + const char *const affiliation, const char *const show, const char *const status); void muc_roster_remove(const char *const room, const char *const nick); void muc_roster_set_complete(const char *const room); GList* muc_roster(const char *const room); @@ -107,7 +106,7 @@ Autocomplete muc_roster_jid_ac(const char *const room); void muc_jid_autocomplete_reset(const char *const room); void muc_jid_autocomplete_add_all(const char *const room, GSList *jids); -Occupant * muc_roster_item(const char *const room, const char *const nick); +Occupant* muc_roster_item(const char *const room, const char *const nick); gboolean muc_occupant_available(Occupant *occupant); const char* muc_occupant_affiliation_str(Occupant *occupant); diff --git a/src/profanity.c b/src/profanity.c index 8233178b..d316ba2f 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -162,7 +162,7 @@ prof_handle_activity(void) } static void -_connect_default(const char * const account) +_connect_default(const char *const account) { ProfWin *window = wins_get_current(); if (account) { @@ -177,7 +177,7 @@ _connect_default(const char * const account) } static void -_check_autoaway() +_check_autoaway(void) { jabber_conn_status_t conn_status = jabber_get_connection_status(); if (conn_status != JABBER_CONNECTED) { diff --git a/src/resource.c b/src/resource.c index 1598c7b2..ec122e0a 100644 --- a/src/resource.c +++ b/src/resource.c @@ -39,8 +39,8 @@ #include <common.h> #include <resource.h> -Resource * resource_new(const char * const name, resource_presence_t presence, - const char * const status, const int priority) +Resource* +resource_new(const char *const name, resource_presence_t presence, const char *const status, const int priority) { assert(name != NULL); Resource *new_resource = malloc(sizeof(struct resource_t)); @@ -86,7 +86,8 @@ resource_compare_availability(Resource *first, Resource *second) } } -void resource_destroy(Resource *resource) +void +resource_destroy(Resource *resource) { if (resource) { free(resource->name); diff --git a/src/resource.h b/src/resource.h index f45920fa..ce400740 100644 --- a/src/resource.h +++ b/src/resource.h @@ -44,10 +44,9 @@ typedef struct resource_t { int priority; } Resource; -Resource* resource_new(const char *const name, resource_presence_t presence, - const char *const status, const int priority); +Resource* resource_new(const char *const name, resource_presence_t presence, const char *const status, + const int priority); void resource_destroy(Resource *resource); - int resource_compare_availability(Resource *first, Resource *second); #endif diff --git a/src/roster_list.c b/src/roster_list.c index 2d9df860..26776c68 100644 --- a/src/roster_list.c +++ b/src/roster_list.c @@ -64,10 +64,8 @@ static GHashTable *name_to_barejid; static gboolean _key_equals(void *key1, void *key2); static gboolean _datetimes_equal(GDateTime *dt1, GDateTime *dt2); -static void _replace_name(const char * const current_name, - const char * const new_name, const char * const barejid); -static void _add_name_and_barejid(const char * const name, - const char * const barejid); +static void _replace_name(const char *const current_name, const char *const new_name, const char *const barejid); +static void _add_name_and_barejid(const char *const name, const char *const barejid); static gint _compare_contacts(PContact a, PContact b); void @@ -86,8 +84,7 @@ roster_clear(void) } gboolean -roster_update_presence(const char * const barejid, Resource *resource, - GDateTime *last_activity) +roster_update_presence(const char *const barejid, Resource *resource, GDateTime *last_activity) { assert(barejid != NULL); assert(resource != NULL); @@ -108,7 +105,7 @@ roster_update_presence(const char * const barejid, Resource *resource, } PContact -roster_get_contact(const char * const barejid) +roster_get_contact(const char *const barejid) { gchar *barejidlower = g_utf8_strdown(barejid, -1); PContact contact = g_hash_table_lookup(contacts, barejidlower); @@ -117,8 +114,8 @@ roster_get_contact(const char * const barejid) return contact; } -char * -roster_get_msg_display_name(const char * const barejid, const char * const resource) +char* +roster_get_msg_display_name(const char *const barejid, const char *const resource) { GString *result = g_string_new(""); @@ -145,8 +142,7 @@ roster_get_msg_display_name(const char * const barejid, const char * const resou } gboolean -roster_contact_offline(const char * const barejid, - const char * const resource, const char * const status) +roster_contact_offline(const char *const barejid, const char *const resource, const char *const status) { PContact contact = roster_get_contact(barejid); @@ -199,7 +195,7 @@ roster_free(void) } void -roster_change_name(PContact contact, const char * const new_name) +roster_change_name(PContact contact, const char *const new_name) { assert(contact != NULL); @@ -215,7 +211,7 @@ roster_change_name(PContact contact, const char * const new_name) } void -roster_remove(const char * const name, const char * const barejid) +roster_remove(const char *const name, const char *const barejid) { autocomplete_remove(barejid_ac, barejid); autocomplete_remove(name_ac, name); @@ -241,8 +237,8 @@ roster_remove(const char * const name, const char * const barejid) } void -roster_update(const char * const barejid, const char * const name, - GSList *groups, const char * const subscription, gboolean pending_out) +roster_update(const char *const barejid, const char *const name, GSList *groups, const char *const subscription, + gboolean pending_out) { PContact contact = roster_get_contact(barejid); assert(contact != NULL); @@ -268,8 +264,8 @@ roster_update(const char * const barejid, const char * const name, } gboolean -roster_add(const char * const barejid, const char * const name, GSList *groups, - const char * const subscription, gboolean pending_out) +roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription, + gboolean pending_out) { PContact contact = roster_get_contact(barejid); if (contact) { @@ -292,8 +288,8 @@ roster_add(const char * const barejid, const char * const name, GSList *groups, return TRUE; } -char * -roster_barejid_from_name(const char * const name) +char* +roster_barejid_from_name(const char *const name) { if (name) { return g_hash_table_lookup(name_to_barejid, name); @@ -302,8 +298,8 @@ roster_barejid_from_name(const char * const name) } } -GSList * -roster_get_contacts_by_presence(const char * const presence) +GSList* +roster_get_contacts_by_presence(const char *const presence) { GSList *result = NULL; GHashTableIter iter; @@ -322,7 +318,7 @@ roster_get_contacts_by_presence(const char * const presence) return result; } -GSList * +GSList* roster_get_contacts(void) { GSList *result = NULL; @@ -339,7 +335,7 @@ roster_get_contacts(void) return result; } -GSList * +GSList* roster_get_contacts_online(void) { GSList *result = NULL; @@ -375,19 +371,19 @@ roster_has_pending_subscriptions(void) return FALSE; } -char * -roster_contact_autocomplete(const char * const search_str) +char* +roster_contact_autocomplete(const char *const search_str) { return autocomplete_complete(name_ac, search_str, TRUE); } -char * -roster_fulljid_autocomplete(const char * const search_str) +char* +roster_fulljid_autocomplete(const char *const search_str) { return autocomplete_complete(fulljid_ac, search_str, TRUE); } -GSList * +GSList* roster_get_nogroup(void) { GSList *result = NULL; @@ -407,8 +403,8 @@ roster_get_nogroup(void) return result; } -GSList * -roster_get_group(const char * const group) +GSList* +roster_get_group(const char *const group) { GSList *result = NULL; GHashTableIter iter; @@ -431,26 +427,26 @@ roster_get_group(const char * const group) return result; } -GSList * +GSList* roster_get_groups(void) { return autocomplete_create_list(groups_ac); } -char * -roster_group_autocomplete(const char * const search_str) +char* +roster_group_autocomplete(const char *const search_str) { return autocomplete_complete(groups_ac, search_str, TRUE); } -char * -roster_barejid_autocomplete(const char * const search_str) +char* +roster_barejid_autocomplete(const char *const search_str) { return autocomplete_complete(barejid_ac, search_str, TRUE); } -static -gboolean _key_equals(void *key1, void *key2) +static gboolean +_key_equals(void *key1, void *key2) { gchar *str1 = (gchar *) key1; gchar *str2 = (gchar *) key2; @@ -473,8 +469,7 @@ _datetimes_equal(GDateTime *dt1, GDateTime *dt2) } static void -_replace_name(const char * const current_name, const char * const new_name, - const char * const barejid) +_replace_name(const char *const current_name, const char *const new_name, const char *const barejid) { // current handle exists already if (current_name) { @@ -490,7 +485,7 @@ _replace_name(const char * const current_name, const char * const new_name, } static void -_add_name_and_barejid(const char * const name, const char * const barejid) +_add_name_and_barejid(const char *const name, const char *const barejid) { if (name) { autocomplete_add(name_ac, name); @@ -501,8 +496,8 @@ _add_name_and_barejid(const char * const name, const char * const barejid) } } -static -gint _compare_contacts(PContact a, PContact b) +static gint +_compare_contacts(PContact a, PContact b) { const char * utf8_str_a = NULL; const char * utf8_str_b = NULL; diff --git a/src/roster_list.h b/src/roster_list.h index 2b01ea64..01def408 100644 --- a/src/roster_list.h +++ b/src/roster_list.h @@ -41,20 +41,18 @@ #include "contact.h" void roster_clear(void); -gboolean roster_update_presence(const char *const barejid, Resource *resource, - GDateTime *last_activity); +gboolean roster_update_presence(const char *const barejid, Resource *resource, GDateTime *last_activity); PContact roster_get_contact(const char *const barejid); -gboolean roster_contact_offline(const char *const barejid, - const char *const resource, const char *const status); +gboolean roster_contact_offline(const char *const barejid, const char *const resource, const char *const status); void roster_reset_search_attempts(void); void roster_init(void); void roster_free(void); void roster_change_name(PContact contact, const char *const new_name); void roster_remove(const char *const name, const char *const barejid); -void roster_update(const char *const barejid, const char *const name, - GSList *groups, const char *const subscription, gboolean pending_out); -gboolean roster_add(const char *const barejid, const char *const name, GSList *groups, - const char *const subscription, gboolean pending_out); +void roster_update(const char *const barejid, const char *const name, GSList *groups, const char *const subscription, + gboolean pending_out); +gboolean roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription, + gboolean pending_out); char* roster_barejid_from_name(const char *const name); GSList* roster_get_contacts(void); GSList* roster_get_contacts_online(void); diff --git a/src/window_list.c b/src/window_list.c index a300bd82..ad43f888 100644 --- a/src/window_list.c +++ b/src/window_list.c @@ -63,14 +63,14 @@ wins_init(void) current = 1; } -ProfWin * +ProfWin* wins_get_console(void) { return g_hash_table_lookup(windows, GINT_TO_POINTER(1)); } -ProfChatWin * -wins_get_chat(const char * const barejid) +ProfChatWin* +wins_get_chat(const char *const barejid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; @@ -91,8 +91,8 @@ wins_get_chat(const char * const barejid) return NULL; } -ProfMucConfWin * -wins_get_muc_conf(const char * const roomjid) +ProfMucConfWin* +wins_get_muc_conf(const char *const roomjid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; @@ -113,8 +113,8 @@ wins_get_muc_conf(const char * const roomjid) return NULL; } -ProfMucWin * -wins_get_muc(const char * const roomjid) +ProfMucWin* +wins_get_muc(const char *const roomjid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; @@ -135,8 +135,8 @@ wins_get_muc(const char * const roomjid) return NULL; } -ProfPrivateWin * -wins_get_private(const char * const fulljid) +ProfPrivateWin* +wins_get_private(const char *const fulljid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; @@ -157,7 +157,7 @@ wins_get_private(const char * const fulljid) return NULL; } -ProfWin * +ProfWin* wins_get_current(void) { if (windows) { @@ -167,7 +167,7 @@ wins_get_current(void) } } -GList * +GList* wins_get_nums(void) { return g_hash_table_get_keys(windows); @@ -194,13 +194,13 @@ wins_set_current_by_num(int i) } } -ProfWin * +ProfWin* wins_get_by_num(int i) { return g_hash_table_lookup(windows, GINT_TO_POINTER(i)); } -ProfWin * +ProfWin* wins_get_next(void) { // get and sort win nums @@ -229,7 +229,7 @@ wins_get_next(void) } } -ProfWin * +ProfWin* wins_get_previous(void) { // get and sort win nums @@ -321,7 +321,7 @@ wins_is_current(ProfWin *window) } } -ProfWin * +ProfWin* wins_new_xmlconsole(void) { GList *keys = g_hash_table_get_keys(windows); @@ -332,8 +332,8 @@ wins_new_xmlconsole(void) return newwin; } -ProfWin * -wins_new_chat(const char * const barejid) +ProfWin* +wins_new_chat(const char *const barejid) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); @@ -343,8 +343,8 @@ wins_new_chat(const char * const barejid) return newwin; } -ProfWin * -wins_new_muc(const char * const roomjid) +ProfWin* +wins_new_muc(const char *const roomjid) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); @@ -354,8 +354,8 @@ wins_new_muc(const char * const roomjid) return newwin; } -ProfWin * -wins_new_muc_config(const char * const roomjid, DataForm *form) +ProfWin* +wins_new_muc_config(const char *const roomjid, DataForm *form) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); @@ -365,8 +365,8 @@ wins_new_muc_config(const char * const roomjid, DataForm *form) return newwin; } -ProfWin * -wins_new_private(const char * const fulljid) +ProfWin* +wins_new_private(const char *const fulljid) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); @@ -426,7 +426,7 @@ wins_show_subwin(ProfWin *window) win_refresh_with_subwin(current_win); } -ProfXMLWin * +ProfXMLWin* wins_get_xmlconsole(void) { GList *values = g_hash_table_get_values(windows); @@ -447,7 +447,7 @@ wins_get_xmlconsole(void) return NULL; } -GSList * +GSList* wins_get_chat_recipients(void) { GSList *result = NULL; @@ -466,7 +466,7 @@ wins_get_chat_recipients(void) return result; } -GSList * +GSList* wins_get_prune_wins(void) { GSList *result = NULL; @@ -620,7 +620,7 @@ wins_tidy(void) } } -GSList * +GSList* wins_create_summary(void) { GSList *result = NULL; |