1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2015-10-26 01:05:31 +00:00
commit 67d57ba908
85 changed files with 1948 additions and 2006 deletions

View File

@ -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);

View File

@ -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);

View File

@ -76,7 +76,6 @@ static void _update_presence(const resource_presence_t presence,
const char *const show, gchar **args);
static gboolean _cmd_set_boolean_preference(gchar *arg, const char *const command,
const char *const display, preference_t pref);
//static void _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size);
static void _who_room(ProfWin *window, const char *const command, gchar **args);
static void _who_roster(ProfWin *window, const char *const command, gchar **args);
@ -2064,7 +2063,6 @@ cmd_info(ProfWin *window, const char * const command, gchar **args)
char *usr = args[0];
jabber_conn_status_t conn_status = jabber_get_connection_status();
PContact pcontact = NULL;
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
@ -2127,7 +2125,7 @@ cmd_info(ProfWin *window, const char * const command, gchar **args)
if (usr_jid == NULL) {
usr_jid = usr;
}
pcontact = roster_get_contact(usr_jid);
PContact pcontact = roster_get_contact(usr_jid);
if (pcontact) {
cons_show_info(pcontact);
} else {
@ -2148,7 +2146,6 @@ gboolean
cmd_caps(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
PContact pcontact = NULL;
Occupant *occupant = NULL;
if (conn_status != JABBER_CONNECTED) {
@ -2182,7 +2179,7 @@ cmd_caps(ProfWin *window, const char * const command, gchar **args)
if (jid->fulljid == NULL) {
cons_show("You must provide a full jid to the /caps command.");
} else {
pcontact = roster_get_contact(jid->barejid);
PContact pcontact = roster_get_contact(jid->barejid);
if (pcontact == NULL) {
cons_show("Contact not found in roster: %s", jid->barejid);
} else {
@ -2225,7 +2222,6 @@ gboolean
cmd_software(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
Occupant *occupant = NULL;
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
@ -2238,7 +2234,7 @@ cmd_software(ProfWin *window, const char * const command, gchar **args)
if (args[0]) {
ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
occupant = muc_roster_item(mucwin->roomjid, args[0]);
Occupant *occupant = muc_roster_item(mucwin->roomjid, args[0]);
if (occupant) {
Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
iq_send_software_version(jid->fulljid);

View File

@ -310,7 +310,7 @@ prof_getline(FILE *stream)
}
char*
release_get_latest()
release_get_latest(void)
{
char *url = "http://www.profanity.im/profanity_version.txt";
@ -644,3 +644,21 @@ strip_arg_quotes(const char * const input)
return unquoted;
}
gboolean
is_notify_enabled(void)
{
gboolean notify_enabled = FALSE;
#ifdef HAVE_OSXNOTIFY
notify_enabled = TRUE;
#endif
#ifdef HAVE_LIBNOTIFY
notify_enabled = TRUE;
#endif
#ifdef PLATFORM_CYGWIN
notify_enabled = TRUE;
#endif
return notify_enabled;
}

View File

@ -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);
@ -128,5 +127,6 @@ int get_next_available_win_num(GList *used);
char* get_file_or_linked(char *loc, char *basedir);
char* strip_arg_quotes(const char *const input);
gboolean is_notify_enabled(void);
#endif

View File

@ -263,7 +263,8 @@ prefs_set_max_log_size(gint value)
_save_prefs();
}
gint prefs_get_inpblock(void)
gint
prefs_get_inpblock(void)
{
int val = g_key_file_get_integer(prefs, PREF_GROUP_UI, "inpblock", NULL);
if (val == 0) {
@ -273,7 +274,8 @@ gint prefs_get_inpblock(void)
}
}
void prefs_set_inpblock(gint value)
void
prefs_set_inpblock(gint value)
{
g_key_file_set_integer(prefs, PREF_GROUP_UI, "inpblock", value);
_save_prefs();

View File

@ -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);

View File

@ -133,8 +133,7 @@ sv_ev_room_invite(jabber_invite_t invite_type,
}
void
sv_ev_room_broadcast(const char *const room_jid,
const char * const message)
sv_ev_room_broadcast(const char *const room_jid, const char *const message)
{
if (muc_roster_complete(room_jid)) {
ui_room_broadcast(room_jid, message);

View File

@ -43,8 +43,7 @@ void sv_ev_failed_login(void);
void sv_ev_room_invite(jabber_invite_t invite_type,
const char *const invitor, const char *const room,
const char *const reason, const char *const password);
void sv_ev_room_broadcast(const char *const room_jid,
const char * const message);
void sv_ev_room_broadcast(const char *const room_jid, const char *const message);
void sv_ev_room_subject(const char *const room, const char *const nick, const char *const subject);
void sv_ev_room_history(const char *const room_jid, const char *const nick,
GDateTime *timestamp, const char *const message);

View File

@ -82,16 +82,15 @@ static struct dated_chat_log * _create_log(const char * const other, const char
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 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, ...)
@ -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);
@ -572,8 +570,7 @@ gboolean _key_equals(void *key1, void *key2)
}
static char*
_get_log_filename(const char * const other, const char * const login,
GDateTime *dt, gboolean create)
_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);
@ -604,8 +601,7 @@ _get_log_filename(const char * const other, const char * const login,
}
static char*
_get_groupchat_log_filename(const char * const room, const char * const login,
GDateTime *dt, gboolean create)
_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);

View File

@ -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, gbo
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

View File

@ -40,6 +40,7 @@
#endif
#include "profanity.h"
#include "common.h"
#include "command/command.h"
static gboolean version = FALSE;
@ -103,18 +104,7 @@ main(int argc, char **argv)
g_print("XMPP library: libstrophe\n");
#endif
gboolean notify_enabled = FALSE;
#ifdef HAVE_OSXNOTIFY
notify_enabled = TRUE;
#endif
#ifdef HAVE_LIBNOTIFY
notify_enabled = TRUE;
#endif
#ifdef PLATFORM_CYGWIN
notify_enabled = TRUE;
#endif
if (notify_enabled) {
if (is_notify_enabled()) {
g_print("Desktop notification support: Enabled\n");
} else {
g_print("Desktop notification support: Disabled\n");

View File

@ -76,8 +76,8 @@ 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
@ -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);
@ -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;
@ -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) {
@ -648,8 +646,7 @@ muc_occupant_nick_change_start(const char * const room,
* the caller
*/
char*
muc_roster_nick_change_complete(const char * const room,
const char * const nick)
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) {
@ -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;
@ -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));

View File

@ -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);

View File

@ -78,8 +78,7 @@ otrlib_start_query(void)
}
static const char*
cb_otr_error_message(void *opdata, ConnContext *context,
OtrlErrorCode err_code)
cb_otr_error_message(void *opdata, ConnContext *context, OtrlErrorCode err_code)
{
switch(err_code)
{

View File

@ -71,5 +71,4 @@ char* p_gpg_autocomplete_key(const char * const search_str);
void p_gpg_autocomplete_key_reset(void);
char* p_gpg_format_fp_str(char *fp);
#endif

View File

@ -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) {

View File

@ -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);

View File

@ -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

View File

@ -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);
@ -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);
@ -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) {
@ -449,8 +445,8 @@ 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) {
@ -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;

View File

@ -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);

View File

@ -58,7 +58,7 @@ struct prof_buff_t {
static void _free_entry(ProfBuffEntry *entry);
ProfBuff
buffer_create()
buffer_create(void)
{
ProfBuff new_buff = malloc(sizeof(struct prof_buff_t));
new_buff->entries = NULL;

View File

@ -66,5 +66,4 @@ int buffer_size(ProfBuff buffer);
ProfBuffEntry* buffer_yield_entry(ProfBuff buffer, int entry);
gboolean buffer_mark_received(ProfBuff buffer, const char *const id);
#endif

View File

@ -1170,18 +1170,7 @@ cons_show_ui_prefs(void)
void
cons_notify_setting(void)
{
gboolean notify_enabled = FALSE;
#ifdef HAVE_OSXNOTIFY
notify_enabled = TRUE;
#endif
#ifdef HAVE_LIBNOTIFY
notify_enabled = TRUE;
#endif
#ifdef PLATFORM_CYGWIN
notify_enabled = TRUE;
#endif
if (notify_enabled) {
if (is_notify_enabled()) {
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
cons_show("Messages (/notify message) : ON");
else

View File

@ -2586,12 +2586,9 @@ ui_handle_room_configuration_form_error(const char * const roomjid, const char *
void
ui_handle_room_config_submit_result(const char *const roomjid)
{
ProfWin *muc_window = NULL;
ProfWin *form_window = NULL;
int num;
if (roomjid) {
muc_window = (ProfWin*)wins_get_muc(roomjid);
ProfWin *form_window = NULL;
ProfWin *muc_window = (ProfWin*)wins_get_muc(roomjid);
GString *form_recipient = g_string_new(roomjid);
g_string_append(form_recipient, " config");
@ -2599,7 +2596,7 @@ ui_handle_room_config_submit_result(const char * const roomjid)
g_string_free(form_recipient, TRUE);
if (form_window) {
num = wins_get_num(form_window);
int num = wins_get_num(form_window);
wins_close_by_num(num);
}
@ -2620,10 +2617,9 @@ void
ui_handle_room_config_submit_result_error(const char *const roomjid, const char *const message)
{
ProfWin *console = wins_get_console();
if (roomjid) {
ProfWin *muc_window = NULL;
ProfWin *form_window = NULL;
if (roomjid) {
muc_window = (ProfWin*)wins_get_muc(roomjid);
GString *form_recipient = g_string_new(roomjid);
@ -2903,4 +2899,3 @@ _win_show_history(ProfChatWin *chatwin, const char * const contact)
g_slist_free_full(history, free);
}
}

View File

@ -195,8 +195,7 @@ notify_remind(void)
}
static void
_notify(const char * const message, int timeout,
const char * const category)
_notify(const char *const message, int timeout, const char *const category)
{
#ifdef HAVE_LIBNOTIFY
log_debug("Attempting notification: %s", message);

View File

@ -471,12 +471,12 @@ win_clear(ProfWin *window)
void
win_resize(ProfWin *window)
{
int subwin_cols = 0;
int cols = getmaxx(stdscr);
if (window->layout->type == LAYOUT_SPLIT) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
if (layout->subwin) {
int subwin_cols = 0;
if (window->type == WIN_CONSOLE) {
subwin_cols = win_roster_cols();
} else if (window->type == WIN_MUC) {
@ -506,11 +506,11 @@ win_update_virtual(ProfWin *window)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
int subwin_cols = 0;
if (window->layout->type == LAYOUT_SPLIT) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
if (layout->subwin) {
int subwin_cols = 0;
if (window->type == WIN_MUC) {
subwin_cols = win_occpuants_cols();
} else {
@ -905,6 +905,7 @@ win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
g_string_vprintf(fmt_msg, message, arg);
win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str);
g_string_free(fmt_msg, TRUE);
va_end(arg);
}
void

View File

@ -150,7 +150,7 @@ iq_room_list_request(gchar *conferencejid)
}
void
iq_enable_carbons()
iq_enable_carbons(void)
{
xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx();
@ -164,7 +164,7 @@ iq_enable_carbons()
}
void
iq_disable_carbons()
iq_disable_carbons(void)
{
xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx();
@ -1264,7 +1264,8 @@ _room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
return 0;
}
static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
static int
_room_affiliation_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
@ -1293,7 +1294,8 @@ static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_s
return 0;
}
static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
static int
_room_role_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);

View File

@ -62,23 +62,15 @@
static Autocomplete sub_requests_ac;
#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, \
STANZA_NAME_PRESENCE, type, ctx)
#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_PRESENCE, type, ctx)
static int _unavailable_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
static int _subscribe_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
static int _subscribed_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
static int _unsubscribed_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
static int _available_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
static int _muc_user_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
static int _presence_error_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
static int _unavailable_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
static int _subscribe_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
static int _subscribed_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
static int _unsubscribed_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
static int _available_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
static int _muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
static int _presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
void _send_caps_request(char *node, char *caps_key, char *id, char *from);
static void _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence);

View File

@ -60,8 +60,7 @@
#include "xmpp/stanza.h"
#include "xmpp/xmpp.h"
#define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, \
STANZA_NAME_IQ, type, ctx)
#define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, STANZA_NAME_IQ, type, ctx)
// callback data for group commands
typedef struct _group_data {
@ -70,18 +69,12 @@ typedef struct _group_data {
} GroupData;
// event handlers
static int _roster_set_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
static int _roster_result_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
static int _roster_set_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
static int _roster_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
// id handlers
static int
_group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
void * const userdata);
static int
_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
void * const userdata);
static int _group_add_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
static int _group_remove_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
// helper functions
GSList* _get_groups_from_item(xmpp_stanza_t *item);

View File

@ -207,7 +207,8 @@ stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char * const jid,
#endif
xmpp_stanza_t*
stanza_enable_carbons(xmpp_ctx_t *ctx){
stanza_enable_carbons(xmpp_ctx_t *ctx)
{
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
char *id = create_unique_id("carbons");
@ -227,7 +228,8 @@ stanza_enable_carbons(xmpp_ctx_t *ctx){
}
xmpp_stanza_t*
stanza_disable_carbons(xmpp_ctx_t *ctx){
stanza_disable_carbons(xmpp_ctx_t *ctx)
{
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
char *id = create_unique_id("carbons");

View File

@ -246,16 +246,11 @@ gboolean stanza_is_room_nick_change(xmpp_stanza_t * const stanza);
gboolean stanza_muc_requires_config(xmpp_stanza_t *const stanza);
char* stanza_get_new_nick(xmpp_stanza_t *const stanza);
xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx,
const char * const room_jid);
xmpp_stanza_t* stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx,
const char * const room_jid);
xmpp_stanza_t* stanza_create_room_config_request_iq(xmpp_ctx_t *ctx,
const char * const room_jid);
xmpp_stanza_t* stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx,
const char * const room_jid);
xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx,
const char * const room, DataForm *form);
xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_jid);
xmpp_stanza_t* stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char *const room_jid);
xmpp_stanza_t* stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid);
xmpp_stanza_t* stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const room_jid);
xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, DataForm *form);
xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room,
const char *const affiliation);
xmpp_stanza_t* stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, const char *const jid,
@ -274,28 +269,22 @@ char * stanza_get_caps_str(xmpp_stanza_t * const stanza);
DataForm* stanza_create_form(xmpp_stanza_t *const stanza);
void stanza_destroy_form(DataForm *form);
void stanza_attach_priority(xmpp_ctx_t * const ctx,
xmpp_stanza_t * const presence, const int pri);
void stanza_attach_last_activity(xmpp_ctx_t * const ctx,
xmpp_stanza_t * const presence, const int idle);
void stanza_attach_priority(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int pri);
void stanza_attach_last_activity(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int idle);
void stanza_attach_caps(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence);
void stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence,
const char * const show);
void stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence,
const char * const status);
void stanza_attach_show(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const char *const show);
void stanza_attach_status(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const char *const status);
const char* stanza_get_presence_string_from_type(resource_presence_t presence_type);
xmpp_stanza_t* stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid);
xmpp_stanza_t * stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char * const id,
const char * const jid);
xmpp_stanza_t* stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id, const char *const jid);
char* stanza_get_status(xmpp_stanza_t *stanza, char *def);
char* stanza_get_show(xmpp_stanza_t *stanza, char *def);
xmpp_stanza_t * stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id,
const char * const jid, const char * const handle, GSList *groups);
xmpp_stanza_t * stanza_create_roster_remove_set(xmpp_ctx_t *ctx,
const char * const barejid);
xmpp_stanza_t* stanza_create_roster_set(xmpp_ctx_t *ctx, const char *const id, const char *const jid,
const char *const handle, GSList *groups);
xmpp_stanza_t* stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid);
char* stanza_get_error_message(xmpp_stanza_t *const stanza);

View File

@ -138,8 +138,8 @@ typedef struct data_form_t {
// connection functions
void jabber_init(void);
jabber_conn_status_t jabber_connect_with_details(const char * const jid,
const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy);
jabber_conn_status_t jabber_connect_with_details(const char *const jid, const char *const passwd,
const char *const altdomain, const int port, const char *const tls_policy);
jabber_conn_status_t jabber_connect_with_account(const ProfAccount *const account);
void jabber_disconnect(void);
void jabber_shutdown(void);
@ -166,8 +166,7 @@ void message_send_composing(const char * const jid);
void message_send_paused(const char *const jid);
void message_send_gone(const char *const jid);
void message_send_invite(const char * const room, const char * const contact,
const char * const reason);
void message_send_invite(const char *const room, const char *const contact, const char *const reason);
// presence functions
void presence_subscription(const char *const jid, const jabber_subscr_t action);
@ -182,8 +181,8 @@ void presence_send(resource_presence_t status, const char * const msg, int idle,
gboolean presence_sub_request_exists(const char *const bare_jid);
// iq functions
void iq_enable_carbons();
void iq_disable_carbons();
void iq_enable_carbons(void);
void iq_disable_carbons(void);
void iq_send_software_version(const char *const fulljid);
void iq_room_list_request(gchar *conferencejid);
void iq_disco_info_request(gchar *jid);
@ -196,19 +195,17 @@ void iq_request_room_config_form(const char * const room_jid);
void iq_submit_room_config(const char *const room, DataForm *form);
void iq_room_config_cancel(const char *const room_jid);
void iq_send_ping(const char *const target);
void iq_send_caps_request(const char * const to, const char * const id,
const char * const node, const char * const ver);
void iq_send_caps_request_for_jid(const char * const to, const char * const id,
const char * const node, const char * const ver);
void iq_send_caps_request_legacy(const char * const to, const char * const id,
const char * const node, const char * const ver);
void iq_send_caps_request(const char *const to, const char *const id, const char *const node, const char *const ver);
void iq_send_caps_request_for_jid(const char *const to, const char *const id, const char *const node,
const char *const ver);
void iq_send_caps_request_legacy(const char *const to, const char *const id, const char *const node,
const char *const ver);
void iq_room_info_request(const char *const room, gboolean display_result);
void iq_room_affiliation_list(const char *const room, char *affiliation);
void iq_room_affiliation_set(const char *const room, const char *const jid, char *affiliation,
const char *const reason);
void iq_room_kick_occupant(const char *const room, const char *const nick, const char *const reason);
void iq_room_role_set(const char * const room, const char * const nick, char *role,
const char * const reason);
void iq_room_role_set(const char *const room, const char *const nick, char *role, const char *const reason);
void iq_room_role_list(const char * const room, char *role);
// caps functions