1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Renamed remaining win_ functions

This commit is contained in:
James Booth 2013-04-21 19:44:31 +01:00
parent 954c9ededc
commit 1046a00405
5 changed files with 188 additions and 187 deletions

View File

@ -918,7 +918,7 @@ cmd_reset_autocomplete()
autocomplete_reset(sub_ac);
if (ui_current_win_type() == WIN_MUC) {
Autocomplete nick_ac = muc_get_roster_ac(ui_current_win_recipient());
Autocomplete nick_ac = muc_get_roster_ac(ui_current_recipient());
if (nick_ac != NULL) {
autocomplete_reset(nick_ac);
}
@ -992,7 +992,7 @@ cmd_execute(const char * const command, const char * const inp)
if (ui_current_win_type() == WIN_CHAT) {
char usage[strlen(cmd->help.usage) + 8];
sprintf(usage, "Usage: %s", cmd->help.usage);
win_current_show(usage);
ui_current_print_line(usage);
}
return TRUE;
} else {
@ -1010,13 +1010,13 @@ cmd_execute_default(const char * const inp)
{
win_type_t win_type = ui_current_win_type();
jabber_conn_status_t status = jabber_get_connection_status();
char *recipient = ui_current_win_recipient();
char *recipient = ui_current_recipient();
switch (win_type)
{
case WIN_MUC:
if (status != JABBER_CONNECTED) {
win_current_show("You are not currently connected.");
ui_current_print_line("You are not currently connected.");
} else {
message_send_groupchat(inp, recipient);
free(recipient);
@ -1025,7 +1025,7 @@ cmd_execute_default(const char * const inp)
case WIN_CHAT:
if (status != JABBER_CONNECTED) {
win_current_show("You are not currently connected.");
ui_current_print_line("You are not currently connected.");
} else {
message_send(inp, recipient);
@ -1036,17 +1036,17 @@ cmd_execute_default(const char * const inp)
jid_destroy(jidp);
}
win_show_outgoing_msg("me", recipient, inp);
ui_outgoing_msg("me", recipient, inp);
free(recipient);
}
break;
case WIN_PRIVATE:
if (status != JABBER_CONNECTED) {
win_current_show("You are not currently connected.");
ui_current_print_line("You are not currently connected.");
} else {
message_send(inp, recipient);
win_show_outgoing_msg("me", recipient, inp);
ui_outgoing_msg("me", recipient, inp);
free(recipient);
}
break;
@ -1088,7 +1088,7 @@ _cmd_complete_parameters(char *input, int *size)
prefs_autocomplete_boolean_choice);
if (ui_current_win_type() == WIN_MUC) {
Autocomplete nick_ac = muc_get_roster_ac(ui_current_win_recipient());
Autocomplete nick_ac = muc_get_roster_ac(ui_current_recipient());
if (nick_ac != NULL) {
_parameter_autocomplete_with_ac(input, size, "/msg", nick_ac);
_parameter_autocomplete_with_ac(input, size, "/info", nick_ac);
@ -1411,7 +1411,7 @@ _cmd_sub(gchar **args, struct cmd_help_t help)
if (jid != NULL) {
jid = strdup(jid);
} else {
jid = ui_current_win_recipient();
jid = ui_current_recipient();
}
bare_jid = strtok(jid, "/");
@ -1432,17 +1432,17 @@ _cmd_sub(gchar **args, struct cmd_help_t help)
PContact contact = contact_list_get_contact(bare_jid);
if ((contact == NULL) || (p_contact_subscription(contact) == NULL)) {
if (win_type == WIN_CHAT) {
win_current_show("No subscription information for %s.", bare_jid);
ui_current_print_line("No subscription information for %s.", bare_jid);
} else {
cons_show("No subscription information for %s.", bare_jid);
}
} else {
if (win_type == WIN_CHAT) {
if (p_contact_pending_out(contact)) {
win_current_show("%s subscription status: %s, request pending.",
ui_current_print_line("%s subscription status: %s, request pending.",
bare_jid, p_contact_subscription(contact));
} else {
win_current_show("%s subscription status: %s.", bare_jid,
ui_current_print_line("%s subscription status: %s.", bare_jid,
p_contact_subscription(contact));
}
} else {
@ -1665,12 +1665,12 @@ _cmd_who(gchar **args, struct cmd_help_t help)
// valid arg
} else {
if (win_type == WIN_MUC) {
char *room = ui_current_win_recipient();
char *room = ui_current_recipient();
GList *list = muc_get_roster(room);
// no arg, show all contacts
if (presence == NULL) {
win_show_room_roster(room, list, NULL);
ui_room_roster(room, list, NULL);
// available
} else if (strcmp("available", presence) == 0) {
@ -1684,7 +1684,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
list = g_list_next(list);
}
win_show_room_roster(room, filtered, "available");
ui_room_roster(room, filtered, "available");
// unavailable
} else if (strcmp("unavailable", presence) == 0) {
@ -1698,7 +1698,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
list = g_list_next(list);
}
win_show_room_roster(room, filtered, "unavailable");
ui_room_roster(room, filtered, "unavailable");
// online, available resources
} else if (strcmp("online", presence) == 0) {
@ -1712,7 +1712,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
list = g_list_next(list);
}
win_show_room_roster(room, filtered, "online");
ui_room_roster(room, filtered, "online");
// offline, no available resources
} else if (strcmp("offline", presence) == 0) {
@ -1726,7 +1726,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
list = g_list_next(list);
}
win_show_room_roster(room, filtered, "offline");
ui_room_roster(room, filtered, "offline");
// show specific status
} else {
@ -1740,7 +1740,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
list = g_list_next(list);
}
win_show_room_roster(room, filtered, presence);
ui_room_roster(room, filtered, presence);
}
// not in groupchat window
@ -1859,7 +1859,7 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
}
if (win_type == WIN_MUC) {
char *room_name = ui_current_win_recipient();
char *room_name = ui_current_recipient();
if (muc_nick_in_roster(room_name, usr)) {
GString *full_jid = g_string_new(room_name);
g_string_append(full_jid, "/");
@ -1867,15 +1867,15 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
if (msg != NULL) {
message_send(msg, full_jid->str);
win_show_outgoing_msg("me", full_jid->str, msg);
ui_outgoing_msg("me", full_jid->str, msg);
} else {
win_new_chat_win(full_jid->str);
ui_new_chat_win(full_jid->str);
}
g_string_free(full_jid, TRUE);
} else {
win_current_show("No such participant \"%s\" in room.", usr);
ui_current_print_line("No such participant \"%s\" in room.", usr);
}
return TRUE;
@ -1883,7 +1883,7 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
} else {
if (msg != NULL) {
message_send(msg, usr);
win_show_outgoing_msg("me", usr, msg);
ui_outgoing_msg("me", usr, msg);
if ((win_type == WIN_CHAT) && prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_jid();
@ -1894,7 +1894,7 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
return TRUE;
} else {
win_new_chat_win(usr);
ui_new_chat_win(usr);
return TRUE;
}
}
@ -1917,23 +1917,23 @@ _cmd_status(gchar **args, struct cmd_help_t help)
{
case WIN_MUC:
if (usr != NULL) {
win_room_show_status(usr);
ui_status_room(usr);
} else {
win_current_show("You must specify a nickname.");
ui_current_print_line("You must specify a nickname.");
}
break;
case WIN_CHAT:
if (usr != NULL) {
win_current_show("No parameter required when in chat.");
ui_current_print_line("No parameter required when in chat.");
} else {
win_show_status();
ui_status();
}
break;
case WIN_PRIVATE:
if (usr != NULL) {
win_current_show("No parameter required when in chat.");
ui_current_print_line("No parameter required when in chat.");
} else {
win_private_show_status();
ui_status_private();
}
break;
case WIN_CONSOLE:
@ -1968,7 +1968,7 @@ _cmd_info(gchar **args, struct cmd_help_t help)
{
case WIN_MUC:
if (usr != NULL) {
pcontact = muc_get_participant(ui_current_win_recipient(), usr);
pcontact = muc_get_participant(ui_current_recipient(), usr);
if (pcontact != NULL) {
cons_show_info(pcontact);
} else {
@ -1982,19 +1982,19 @@ _cmd_info(gchar **args, struct cmd_help_t help)
if (usr != NULL) {
cons_show("No parameter required for /info in chat.");
} else {
pcontact = contact_list_get_contact(ui_current_win_recipient());
pcontact = contact_list_get_contact(ui_current_recipient());
if (pcontact != NULL) {
cons_show_info(pcontact);
} else {
cons_show("No such contact \"%s\" in roster.", ui_current_win_recipient());
cons_show("No such contact \"%s\" in roster.", ui_current_recipient());
}
}
break;
case WIN_PRIVATE:
if (usr != NULL) {
win_current_show("No parameter required when in chat.");
ui_current_print_line("No parameter required when in chat.");
} else {
Jid *jid = jid_create(ui_current_win_recipient());
Jid *jid = jid_create(ui_current_recipient());
pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
if (pcontact != NULL) {
cons_show_info(pcontact);
@ -2039,7 +2039,7 @@ _cmd_caps(gchar **args, struct cmd_help_t help)
{
case WIN_MUC:
if (args[0] != NULL) {
pcontact = muc_get_participant(ui_current_win_recipient(), args[0]);
pcontact = muc_get_participant(ui_current_recipient(), args[0]);
if (pcontact != NULL) {
Resource *resource = p_contact_get_resource(pcontact, args[0]);
cons_show_caps(args[0], resource);
@ -2078,7 +2078,7 @@ _cmd_caps(gchar **args, struct cmd_help_t help)
if (args[0] != NULL) {
cons_show("No parameter needed to /caps when in private chat.");
} else {
Jid *jid = jid_create(ui_current_win_recipient());
Jid *jid = jid_create(ui_current_recipient());
pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
Resource *resource = p_contact_get_resource(pcontact, jid->resourcepart);
cons_show_caps(jid->resourcepart, resource);
@ -2108,9 +2108,9 @@ _cmd_software(gchar **args, struct cmd_help_t help)
{
case WIN_MUC:
if (args[0] != NULL) {
pcontact = muc_get_participant(ui_current_win_recipient(), args[0]);
pcontact = muc_get_participant(ui_current_recipient(), args[0]);
if (pcontact != NULL) {
Jid *jid = jid_create_from_bare_and_resource(ui_current_win_recipient(), args[0]);
Jid *jid = jid_create_from_bare_and_resource(ui_current_recipient(), args[0]);
iq_send_software_version(jid->fulljid);
jid_destroy(jid);
} else {
@ -2138,7 +2138,7 @@ _cmd_software(gchar **args, struct cmd_help_t help)
if (args[0] != NULL) {
cons_show("No parameter needed to /software when in private chat.");
} else {
iq_send_software_version(ui_current_win_recipient());
iq_send_software_version(ui_current_recipient());
}
break;
default:
@ -2196,7 +2196,7 @@ _cmd_join(gchar **args, struct cmd_help_t help)
if (!muc_room_is_active(room_jid)) {
presence_join_room(room_jid);
}
win_join_chat(room_jid);
ui_room_join(room_jid);
jid_destroy(room_jid);
jid_destroy(my_jid);
@ -2223,7 +2223,7 @@ _cmd_invite(gchar **args, struct cmd_help_t help)
return TRUE;
}
room = ui_current_win_recipient();
room = ui_current_recipient();
message_send_invite(room, contact, reason);
if (reason != NULL) {
cons_show("Room invite sent, contact: %s, room: %s, reason: \"%s\".",
@ -2304,7 +2304,7 @@ _cmd_nick(gchar **args, struct cmd_help_t help)
return TRUE;
}
char *room = ui_current_win_recipient();
char *room = ui_current_recipient();
char *nick = args[0];
presence_change_room_nick(room, nick);
@ -2322,7 +2322,7 @@ _cmd_tiny(gchar **args, struct cmd_help_t help)
g_string_append(error, url);
cons_show_error(error->str);
if (win_type != WIN_CONSOLE) {
win_current_bad_show(error->str);
ui_current_error_line(error->str);
}
g_string_free(error, TRUE);
} else if (win_type != WIN_CONSOLE) {
@ -2330,7 +2330,7 @@ _cmd_tiny(gchar **args, struct cmd_help_t help)
if (tiny != NULL) {
if (win_type == WIN_CHAT) {
char *recipient = ui_current_win_recipient();
char *recipient = ui_current_recipient();
message_send(tiny, recipient);
if (prefs_get_boolean(PREF_CHLOG)) {
@ -2340,15 +2340,15 @@ _cmd_tiny(gchar **args, struct cmd_help_t help)
jid_destroy(jidp);
}
win_show_outgoing_msg("me", recipient, tiny);
ui_outgoing_msg("me", recipient, tiny);
free(recipient);
} else if (win_type == WIN_PRIVATE) {
char *recipient = ui_current_win_recipient();
char *recipient = ui_current_recipient();
message_send(tiny, recipient);
win_show_outgoing_msg("me", recipient, tiny);
ui_outgoing_msg("me", recipient, tiny);
free(recipient);
} else { // groupchat
char *recipient = ui_current_win_recipient();
char *recipient = ui_current_recipient();
message_send_groupchat(tiny, recipient);
free(recipient);
}
@ -2385,12 +2385,12 @@ _cmd_close(gchar **args, struct cmd_help_t help)
// handle leaving rooms, or chat
if (conn_status == JABBER_CONNECTED) {
if (win_type == WIN_MUC) {
char *room_jid = ui_current_win_recipient();
char *room_jid = ui_current_recipient();
presence_leave_chat_room(room_jid);
} else if ((win_type == WIN_CHAT) || (win_type == WIN_PRIVATE)) {
if (prefs_get_boolean(PREF_STATES)) {
char *recipient = ui_current_win_recipient();
char *recipient = ui_current_recipient();
// send <gone/> chat state before closing
if (chat_session_get_recipient_supports(recipient)) {

View File

@ -102,15 +102,15 @@ prof_run(const int disable_tls, char *log_level)
void
prof_handle_typing(char *from)
{
ui_show_typing(from);
win_current_page_off();
ui_contact_typing(from);
ui_current_page_off();
}
void
prof_handle_incoming_message(char *from, char *message, gboolean priv)
{
ui_show_incoming_msg(from, message, NULL, priv);
win_current_page_off();
ui_incoming_msg(from, message, NULL, priv);
ui_current_page_off();
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
Jid *from_jid = jid_create(from);
@ -126,8 +126,8 @@ void
prof_handle_delayed_message(char *from, char *message, GTimeVal tv_stamp,
gboolean priv)
{
ui_show_incoming_msg(from, message, &tv_stamp, priv);
win_current_page_off();
ui_incoming_msg(from, message, &tv_stamp, priv);
ui_current_page_off();
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
Jid *from_jid = jid_create(from);
@ -147,7 +147,7 @@ prof_handle_error_message(const char *from, const char *err_msg)
cons_show_error("Unknown error received from service.");
} else if (strcmp(err_msg, "conflict") == 0) {
if (win_type == WIN_MUC) {
win_current_show("Nickname already in use.");
ui_current_print_line("Nickname already in use.");
} else {
cons_show_error("Error received from server: %s", err_msg);
}
@ -155,7 +155,7 @@ prof_handle_error_message(const char *from, const char *err_msg)
cons_show_error("Error received from server: %s", err_msg);
}
win_show_error_msg(from, err_msg);
ui_print_error_from_recipient(from, err_msg);
}
void
@ -166,20 +166,20 @@ prof_handle_subscription(const char *from, jabber_subscr_t type)
/* TODO: auto-subscribe if needed */
cons_show("Received authorization request from %s", from);
log_info("Received authorization request from %s", from);
win_show_system_msg(from, "Authorization request, type '/sub allow' to accept or '/sub deny' to reject");
win_current_page_off();
ui_print_system_msg_from_recipient(from, "Authorization request, type '/sub allow' to accept or '/sub deny' to reject");
ui_current_page_off();
break;
case PRESENCE_SUBSCRIBED:
cons_show("Subscription received from %s", from);
log_info("Subscription received from %s", from);
win_show_system_msg(from, "Subscribed");
win_current_page_off();
ui_print_system_msg_from_recipient(from, "Subscribed");
ui_current_page_off();
break;
case PRESENCE_UNSUBSCRIBED:
cons_show("%s deleted subscription", from);
log_info("%s deleted subscription", from);
win_show_system_msg(from, "Unsubscribed");
win_current_page_off();
ui_print_system_msg_from_recipient(from, "Unsubscribed");
ui_current_page_off();
break;
default:
/* unknown type */
@ -196,7 +196,7 @@ prof_handle_login_account_success(char *account_name)
cons_show_login_success(account);
title_bar_set_status(contact_presence);
log_info("%s logged in successfully", account->jid);
win_current_page_off();
ui_current_page_off();
status_bar_print_message(account->jid);
status_bar_refresh();
@ -206,8 +206,8 @@ prof_handle_login_account_success(char *account_name)
void
prof_handle_gone(const char * const from)
{
win_show_gone(from);
win_current_page_off();
ui_recipient_gone(from);
ui_current_page_off();
}
void
@ -215,7 +215,7 @@ prof_handle_failed_login(void)
{
cons_show_error("Login failed.");
log_info("Login failed");
win_current_page_off();
ui_current_page_off();
}
void
@ -225,7 +225,7 @@ prof_handle_lost_connection(void)
contact_list_clear();
chat_sessions_clear();
ui_disconnected();
win_current_page_off();
ui_current_page_off();
}
void
@ -236,38 +236,38 @@ prof_handle_disconnect(const char * const jid)
contact_list_clear();
chat_sessions_clear();
ui_disconnected();
win_current_page_off();
ui_current_page_off();
}
void
prof_handle_room_history(const char * const room_jid, const char * const nick,
GTimeVal tv_stamp, const char * const message)
{
win_show_room_history(room_jid, nick, tv_stamp, message);
win_current_page_off();
ui_room_history(room_jid, nick, tv_stamp, message);
ui_current_page_off();
}
void
prof_handle_room_message(const char * const room_jid, const char * const nick,
const char * const message)
{
win_show_room_message(room_jid, nick, message);
win_current_page_off();
ui_room_message(room_jid, nick, message);
ui_current_page_off();
}
void
prof_handle_room_subject(const char * const room_jid, const char * const subject)
{
win_show_room_subject(room_jid, subject);
win_current_page_off();
ui_room_subject(room_jid, subject);
ui_current_page_off();
}
void
prof_handle_room_broadcast(const char *const room_jid,
const char * const message)
{
win_show_room_broadcast(room_jid, message);
win_current_page_off();
ui_room_broadcast(room_jid, message);
ui_current_page_off();
}
void
@ -275,8 +275,8 @@ prof_handle_room_roster_complete(const char * const room)
{
muc_set_roster_received(room);
GList *roster = muc_get_roster(room);
win_show_room_roster(room, roster, NULL);
win_current_page_off();
ui_room_roster(room, roster, NULL);
ui_current_page_off();
}
void
@ -287,8 +287,8 @@ prof_handle_room_member_presence(const char * const room,
gboolean updated = muc_add_to_roster(room, nick, show, status, caps_str);
if (updated) {
win_show_room_member_presence(room, nick, show, status);
win_current_page_off();
ui_room_member_presence(room, nick, show, status);
ui_current_page_off();
}
}
@ -298,8 +298,8 @@ prof_handle_room_member_online(const char * const room, const char * const nick,
const char * const caps_str)
{
muc_add_to_roster(room, nick, show, status, caps_str);
win_show_room_member_online(room, nick, show, status);
win_current_page_off();
ui_room_member_online(room, nick, show, status);
ui_current_page_off();
}
void
@ -307,8 +307,8 @@ prof_handle_room_member_offline(const char * const room, const char * const nick
const char * const show, const char * const status)
{
muc_remove_from_roster(room, nick);
win_show_room_member_offline(room, nick);
win_current_page_off();
ui_room_member_offline(room, nick);
ui_current_page_off();
}
void
@ -322,7 +322,7 @@ void prof_handle_room_invite(jabber_invite_t invite_type,
const char * const reason)
{
cons_show_room_invite(invitor, room, reason);
win_current_page_off();
ui_current_page_off();
}
void
@ -337,7 +337,7 @@ prof_handle_contact_online(char *contact, Resource *resource,
if (strcmp(p_contact_subscription(result), "none") != 0) {
const char *show = string_from_resource_presence(resource->presence);
ui_contact_online(contact, resource->name, show, resource->status, last_activity);
win_current_page_off();
ui_current_page_off();
}
}
}
@ -354,7 +354,7 @@ prof_handle_contact_offline(char *contact, char *resource, char *status)
if (p_contact_subscription(result) != NULL) {
if (strcmp(p_contact_subscription(result), "none") != 0) {
ui_contact_offline(jid->fulljid, "offline", status);
win_current_page_off();
ui_current_page_off();
}
}
jid_destroy(jid);
@ -365,16 +365,16 @@ void
prof_handle_room_member_nick_change(const char * const room,
const char * const old_nick, const char * const nick)
{
win_show_room_member_nick_change(room, old_nick, nick);
win_current_page_off();
ui_room_member_nick_change(room, old_nick, nick);
ui_current_page_off();
}
void
prof_handle_room_nick_change(const char * const room,
const char * const nick)
{
win_show_room_nick_change(room, nick);
win_current_page_off();
ui_room_nick_change(room, nick);
ui_current_page_off();
}
void
@ -393,7 +393,7 @@ prof_handle_activity(void)
jabber_conn_status_t status = jabber_get_connection_status();
if ((status == JABBER_CONNECTED) && (win_type == WIN_CHAT)) {
char *recipient = ui_current_win_recipient();
char *recipient = ui_current_recipient();
chat_session_set_composing(recipient);
if (!chat_session_get_sent(recipient) ||
chat_session_is_paused(recipient)) {
@ -407,28 +407,28 @@ prof_handle_version_result(const char * const jid, const char * const presence,
const char * const name, const char * const version, const char * const os)
{
cons_show_software_version(jid, presence, name, version, os);
win_current_page_off();
ui_current_page_off();
}
void
prof_handle_room_list(GSList *rooms, const char *conference_node)
{
cons_show_room_list(rooms, conference_node);
win_current_page_off();
ui_current_page_off();
}
void
prof_handle_disco_items(GSList *items, const char *jid)
{
cons_show_disco_items(items, jid);
win_current_page_off();
ui_current_page_off();
}
void
prof_handle_disco_info(const char *from, GSList *identities, GSList *features)
{
cons_show_disco_info(from, identities, features);
win_current_page_off();
ui_current_page_off();
}
/*
@ -465,7 +465,7 @@ _process_input(char *inp)
inp_win_reset();
contact_list_reset_search_attempts();
win_current_page_off();
ui_current_page_off();
return result;
}
@ -490,7 +490,7 @@ _handle_idle_time()
cons_show("Idle for %d minutes, status set to away (priority %d), \"%s\".",
prefs_get_autoaway_time(), pri, prefs_get_string(PREF_AUTOAWAY_MESSAGE));
title_bar_set_status(CONTACT_AWAY);
win_current_page_off();
ui_current_page_off();
} else {
int pri =
accounts_get_priority_for_presence_type(jabber_get_account_name(),
@ -498,7 +498,7 @@ _handle_idle_time()
cons_show("Idle for %d minutes, status set to away (priority %d).",
prefs_get_autoaway_time(), pri);
title_bar_set_status(CONTACT_AWAY);
win_current_page_off();
ui_current_page_off();
}
// handle idle mode
@ -521,7 +521,7 @@ _handle_idle_time()
RESOURCE_ONLINE);
cons_show("No longer idle, status set to online (priority %d).", pri);
title_bar_set_status(CONTACT_ONLINE);
win_current_page_off();
ui_current_page_off();
} else if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "idle") == 0) {
presence_update(RESOURCE_ONLINE, NULL, 0);
title_bar_set_status(CONTACT_ONLINE);

View File

@ -100,7 +100,7 @@ cons_debug(const char * const msg, ...)
status_bar_new(0);
}
win_current_page_off();
ui_current_page_off();
ui_refresh();
}
}

View File

@ -214,7 +214,7 @@ ui_windows_full(void)
}
void
ui_show_typing(const char * const from)
ui_contact_typing(const char * const from)
{
int win_index = _find_prof_win_index(from);
@ -269,7 +269,7 @@ ui_idle(void)
}
void
ui_show_incoming_msg(const char * const from, const char * const message,
ui_incoming_msg(const char * const from, const char * const message,
GTimeVal *tv_stamp, gboolean priv)
{
char *display_from;
@ -491,11 +491,11 @@ ui_handle_special_keys(const wint_t * const ch, const char * const inp,
void
ui_switch_win(const int i)
{
win_current_page_off();
ui_current_page_off();
if (windows[i] != NULL) {
current_index = i;
current = windows[current_index];
win_current_page_off();
ui_current_page_off();
current->unread = 0;
@ -543,13 +543,13 @@ ui_current_win_type(void)
}
char *
ui_current_win_recipient(void)
ui_current_recipient(void)
{
return strdup(current->from);
}
void
win_current_show(const char * const msg, ...)
ui_current_print_line(const char * const msg, ...)
{
va_list arg;
va_start(arg, msg);
@ -564,7 +564,7 @@ win_current_show(const char * const msg, ...)
}
void
win_current_bad_show(const char * const msg)
ui_current_error_line(const char * const msg)
{
window_print_time(current, '-');
wattron(current->win, COLOUR_ERROR);
@ -575,7 +575,7 @@ win_current_bad_show(const char * const msg)
}
void
win_current_page_off(void)
ui_current_page_off(void)
{
int rows = getmaxy(stdscr);
ProfWin *window = windows[current_index];
@ -594,7 +594,7 @@ win_current_page_off(void)
}
void
win_show_error_msg(const char * const from, const char *err_msg)
ui_print_error_from_recipient(const char * const from, const char *err_msg)
{
int win_index;
ProfWin *window;
@ -615,7 +615,7 @@ win_show_error_msg(const char * const from, const char *err_msg)
}
void
win_show_system_msg(const char * const from, const char *message)
ui_print_system_msg_from_recipient(const char * const from, const char *message)
{
int win_index;
ProfWin *window;
@ -646,7 +646,7 @@ win_show_system_msg(const char * const from, const char *message)
}
void
win_show_gone(const char * const from)
ui_recipient_gone(const char * const from)
{
int win_index;
ProfWin *window;
@ -671,7 +671,7 @@ win_show_gone(const char * const from)
}
void
win_new_chat_win(const char * const to)
ui_new_chat_win(const char * const to)
{
// if the contact is offline, show a message
PContact contact = contact_list_get_contact(to);
@ -713,7 +713,7 @@ win_new_chat_win(const char * const to)
}
void
win_show_outgoing_msg(const char * const from, const char * const to,
ui_outgoing_msg(const char * const from, const char * const to,
const char * const message)
{
// if the contact is offline, show a message
@ -767,7 +767,7 @@ win_show_outgoing_msg(const char * const from, const char * const to,
}
void
win_join_chat(Jid *jid)
ui_room_join(Jid *jid)
{
int win_index = _find_prof_win_index(jid->barejid);
@ -780,7 +780,7 @@ win_join_chat(Jid *jid)
}
void
win_show_room_roster(const char * const room, GList *roster, const char * const presence)
ui_room_roster(const char * const room, GList *roster, const char * const presence)
{
int win_index = _find_prof_win_index(room);
ProfWin *window = windows[win_index];
@ -829,7 +829,7 @@ win_show_room_roster(const char * const room, GList *roster, const char * const
}
void
win_show_room_member_offline(const char * const room, const char * const nick)
ui_room_member_offline(const char * const room, const char * const nick)
{
int win_index = _find_prof_win_index(room);
ProfWin *window = windows[win_index];
@ -844,7 +844,7 @@ win_show_room_member_offline(const char * const room, const char * const nick)
}
void
win_show_room_member_online(const char * const room, const char * const nick,
ui_room_member_online(const char * const room, const char * const nick,
const char * const show, const char * const status)
{
int win_index = _find_prof_win_index(room);
@ -860,7 +860,7 @@ win_show_room_member_online(const char * const room, const char * const nick,
}
void
win_show_room_member_presence(const char * const room, const char * const nick,
ui_room_member_presence(const char * const room, const char * const nick,
const char * const show, const char * const status)
{
int win_index = _find_prof_win_index(room);
@ -874,7 +874,7 @@ win_show_room_member_presence(const char * const room, const char * const nick,
}
void
win_show_room_member_nick_change(const char * const room,
ui_room_member_nick_change(const char * const room,
const char * const old_nick, const char * const nick)
{
int win_index = _find_prof_win_index(room);
@ -890,7 +890,7 @@ win_show_room_member_nick_change(const char * const room,
}
void
win_show_room_nick_change(const char * const room, const char * const nick)
ui_room_nick_change(const char * const room, const char * const nick)
{
int win_index = _find_prof_win_index(room);
ProfWin *window = windows[win_index];
@ -905,7 +905,7 @@ win_show_room_nick_change(const char * const room, const char * const nick)
}
void
win_show_room_history(const char * const room_jid, const char * const nick,
ui_room_history(const char * const room_jid, const char * const nick,
GTimeVal tv_stamp, const char * const message)
{
int win_index = _find_prof_win_index(room_jid);
@ -931,7 +931,7 @@ win_show_room_history(const char * const room_jid, const char * const nick,
}
void
win_show_room_message(const char * const room_jid, const char * const nick,
ui_room_message(const char * const room_jid, const char * const nick,
const char * const message)
{
int win_index = _find_prof_win_index(room_jid);
@ -996,7 +996,7 @@ win_show_room_message(const char * const room_jid, const char * const nick,
}
void
win_show_room_subject(const char * const room_jid, const char * const subject)
ui_room_subject(const char * const room_jid, const char * const subject)
{
int win_index = _find_prof_win_index(room_jid);
ProfWin *window = windows[win_index];
@ -1019,7 +1019,7 @@ win_show_room_subject(const char * const room_jid, const char * const subject)
}
void
win_show_room_broadcast(const char * const room_jid, const char * const message)
ui_room_broadcast(const char * const room_jid, const char * const message)
{
int win_index = _find_prof_win_index(room_jid);
ProfWin *window = windows[win_index];
@ -1042,43 +1042,43 @@ win_show_room_broadcast(const char * const room_jid, const char * const message)
}
void
win_show_status(void)
ui_status(void)
{
char *recipient = ui_current_win_recipient();
char *recipient = ui_current_recipient();
PContact pcontact = contact_list_get_contact(recipient);
if (pcontact != NULL) {
window_show_contact(current, pcontact);
} else {
win_current_show("Error getting contact info.");
ui_current_print_line("Error getting contact info.");
}
}
void
win_private_show_status(void)
ui_status_private(void)
{
Jid *jid = jid_create(ui_current_win_recipient());
Jid *jid = jid_create(ui_current_recipient());
PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
if (pcontact != NULL) {
window_show_contact(current, pcontact);
} else {
win_current_show("Error getting contact info.");
ui_current_print_line("Error getting contact info.");
}
jid_destroy(jid);
}
void
win_room_show_status(const char * const contact)
ui_status_room(const char * const contact)
{
PContact pcontact = muc_get_participant(ui_current_win_recipient(), contact);
PContact pcontact = muc_get_participant(ui_current_recipient(), contact);
if (pcontact != NULL) {
window_show_contact(current, pcontact);
} else {
win_current_show("No such participant \"%s\" in room.", contact);
ui_current_print_line("No such participant \"%s\" in room.", contact);
}
}

View File

@ -45,28 +45,68 @@
// holds console at index 0 and chat wins 1 through to 9
ProfWin* windows[NUM_WINS];
// gui startup and shutdown, resize
// ui startup and control
void ui_init(void);
void ui_load_colours(void);
void ui_refresh(void);
void ui_close(void);
void ui_resize(const int ch, const char * const input,
const int size);
void ui_show_typing(const char * const from);
void ui_idle(void);
void ui_show_incoming_msg(const char * const from, const char * const message,
GTimeVal *tv_stamp, gboolean priv);
void ui_contact_online(const char * const barejid, const char * const resource,
const char * const show, const char * const status, GDateTime *last_activity);
void ui_contact_offline(const char * const from, const char * const show,
const char * const status);
void ui_disconnected(void);
void ui_handle_special_keys(const wint_t * const ch, const char * const inp,
const int size);
void ui_switch_win(const int i);
gboolean ui_windows_full(void);
unsigned long ui_get_idle_time(void);
void ui_reset_idle_time(void);
void ui_new_chat_win(const char * const to);
void ui_print_error_from_recipient(const char * const from, const char *err_msg);
void ui_print_system_msg_from_recipient(const char * const from, const char *message);
// current window actions
void ui_close_current(void);
void ui_clear_current(void);
win_type_t ui_current_win_type(void);
char* ui_current_recipient(void);
void ui_current_print_line(const char * const msg, ...);
void ui_current_error_line(const char * const msg);
void ui_current_page_off(void);
// ui events
void ui_contact_typing(const char * const from);
void ui_incoming_msg(const char * const from, const char * const message,
GTimeVal *tv_stamp, gboolean priv);
void ui_contact_online(const char * const barejid, const char * const resource,
const char * const show, const char * const status, GDateTime *last_activity);
void ui_contact_offline(const char * const from, const char * const show,
const char * const status);
void ui_disconnected(void);
void ui_recipient_gone(const char * const from);
void ui_outgoing_msg(const char * const from, const char * const to,
const char * const message);
void ui_room_join(Jid *jid);
void ui_room_roster(const char * const room, GList *roster, const char * const presence);
void ui_room_history(const char * const room_jid, const char * const nick,
GTimeVal tv_stamp, const char * const message);
void ui_room_message(const char * const room_jid, const char * const nick,
const char * const message);
void ui_room_subject(const char * const room_jid,
const char * const subject);
void ui_room_broadcast(const char * const room_jid,
const char * const message);
void ui_room_member_offline(const char * const room, const char * const nick);
void ui_room_member_online(const char * const room,
const char * const nick, const char * const show, const char * const status);
void ui_room_member_nick_change(const char * const room,
const char * const old_nick, const char * const nick);
void ui_room_nick_change(const char * const room, const char * const nick);
void ui_room_member_presence(const char * const room,
const char * const nick, const char * const show, const char * const status);
// contact status functions
void ui_status_room(const char * const contact);
void ui_status(void);
void ui_status_private(void);
// create windows
void create_title_bar(void);
@ -83,45 +123,6 @@ void title_bar_set_recipient(char *from);
void title_bar_set_typing(gboolean is_typing);
void title_bar_draw(void);
// current window actions
void ui_close_current(void);
void ui_clear_current(void);
win_type_t ui_current_win_type(void);
char* ui_current_win_recipient(void);
void win_current_show(const char * const msg, ...);
void win_current_bad_show(const char * const msg);
void win_current_page_off(void);
void win_show_error_msg(const char * const from, const char *err_msg);
void win_show_gone(const char * const from);
void win_show_system_msg(const char * const from, const char *message);
void win_show_outgoing_msg(const char * const from, const char * const to,
const char * const message);
void win_new_chat_win(const char * const to);
void win_join_chat(Jid *jid);
void win_show_room_roster(const char * const room, GList *roster, const char * const presence);
void win_show_room_history(const char * const room_jid, const char * const nick,
GTimeVal tv_stamp, const char * const message);
void win_show_room_message(const char * const room_jid, const char * const nick,
const char * const message);
void win_show_room_subject(const char * const room_jid,
const char * const subject);
void win_show_room_broadcast(const char * const room_jid,
const char * const message);
void win_show_room_member_offline(const char * const room, const char * const nick);
void win_show_room_member_online(const char * const room,
const char * const nick, const char * const show, const char * const status);
void win_show_room_member_nick_change(const char * const room,
const char * const old_nick, const char * const nick);
void win_show_room_nick_change(const char * const room, const char * const nick);
void win_show_room_member_presence(const char * const room,
const char * const nick, const char * const show, const char * const status);
void win_room_show_status(const char * const contact);
void win_room_show_info(const char * const contact);
void win_show_status(void);
void win_private_show_status(void);
// console window actions
ProfWin* cons_create(void);
void cons_refresh(void);