mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Renamed remaining win_ functions
This commit is contained in:
parent
954c9ededc
commit
1046a00405
@ -918,7 +918,7 @@ cmd_reset_autocomplete()
|
|||||||
autocomplete_reset(sub_ac);
|
autocomplete_reset(sub_ac);
|
||||||
|
|
||||||
if (ui_current_win_type() == WIN_MUC) {
|
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) {
|
if (nick_ac != NULL) {
|
||||||
autocomplete_reset(nick_ac);
|
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) {
|
if (ui_current_win_type() == WIN_CHAT) {
|
||||||
char usage[strlen(cmd->help.usage) + 8];
|
char usage[strlen(cmd->help.usage) + 8];
|
||||||
sprintf(usage, "Usage: %s", cmd->help.usage);
|
sprintf(usage, "Usage: %s", cmd->help.usage);
|
||||||
win_current_show(usage);
|
ui_current_print_line(usage);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
@ -1010,13 +1010,13 @@ cmd_execute_default(const char * const inp)
|
|||||||
{
|
{
|
||||||
win_type_t win_type = ui_current_win_type();
|
win_type_t win_type = ui_current_win_type();
|
||||||
jabber_conn_status_t status = jabber_get_connection_status();
|
jabber_conn_status_t status = jabber_get_connection_status();
|
||||||
char *recipient = ui_current_win_recipient();
|
char *recipient = ui_current_recipient();
|
||||||
|
|
||||||
switch (win_type)
|
switch (win_type)
|
||||||
{
|
{
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
if (status != JABBER_CONNECTED) {
|
if (status != JABBER_CONNECTED) {
|
||||||
win_current_show("You are not currently connected.");
|
ui_current_print_line("You are not currently connected.");
|
||||||
} else {
|
} else {
|
||||||
message_send_groupchat(inp, recipient);
|
message_send_groupchat(inp, recipient);
|
||||||
free(recipient);
|
free(recipient);
|
||||||
@ -1025,7 +1025,7 @@ cmd_execute_default(const char * const inp)
|
|||||||
|
|
||||||
case WIN_CHAT:
|
case WIN_CHAT:
|
||||||
if (status != JABBER_CONNECTED) {
|
if (status != JABBER_CONNECTED) {
|
||||||
win_current_show("You are not currently connected.");
|
ui_current_print_line("You are not currently connected.");
|
||||||
} else {
|
} else {
|
||||||
message_send(inp, recipient);
|
message_send(inp, recipient);
|
||||||
|
|
||||||
@ -1036,17 +1036,17 @@ cmd_execute_default(const char * const inp)
|
|||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_show_outgoing_msg("me", recipient, inp);
|
ui_outgoing_msg("me", recipient, inp);
|
||||||
free(recipient);
|
free(recipient);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WIN_PRIVATE:
|
case WIN_PRIVATE:
|
||||||
if (status != JABBER_CONNECTED) {
|
if (status != JABBER_CONNECTED) {
|
||||||
win_current_show("You are not currently connected.");
|
ui_current_print_line("You are not currently connected.");
|
||||||
} else {
|
} else {
|
||||||
message_send(inp, recipient);
|
message_send(inp, recipient);
|
||||||
win_show_outgoing_msg("me", recipient, inp);
|
ui_outgoing_msg("me", recipient, inp);
|
||||||
free(recipient);
|
free(recipient);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1088,7 +1088,7 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
prefs_autocomplete_boolean_choice);
|
prefs_autocomplete_boolean_choice);
|
||||||
|
|
||||||
if (ui_current_win_type() == WIN_MUC) {
|
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) {
|
if (nick_ac != NULL) {
|
||||||
_parameter_autocomplete_with_ac(input, size, "/msg", nick_ac);
|
_parameter_autocomplete_with_ac(input, size, "/msg", nick_ac);
|
||||||
_parameter_autocomplete_with_ac(input, size, "/info", 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) {
|
if (jid != NULL) {
|
||||||
jid = strdup(jid);
|
jid = strdup(jid);
|
||||||
} else {
|
} else {
|
||||||
jid = ui_current_win_recipient();
|
jid = ui_current_recipient();
|
||||||
}
|
}
|
||||||
|
|
||||||
bare_jid = strtok(jid, "/");
|
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);
|
PContact contact = contact_list_get_contact(bare_jid);
|
||||||
if ((contact == NULL) || (p_contact_subscription(contact) == NULL)) {
|
if ((contact == NULL) || (p_contact_subscription(contact) == NULL)) {
|
||||||
if (win_type == WIN_CHAT) {
|
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 {
|
} else {
|
||||||
cons_show("No subscription information for %s.", bare_jid);
|
cons_show("No subscription information for %s.", bare_jid);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (win_type == WIN_CHAT) {
|
if (win_type == WIN_CHAT) {
|
||||||
if (p_contact_pending_out(contact)) {
|
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));
|
bare_jid, p_contact_subscription(contact));
|
||||||
} else {
|
} else {
|
||||||
win_current_show("%s subscription status: %s.", bare_jid,
|
ui_current_print_line("%s subscription status: %s.", bare_jid,
|
||||||
p_contact_subscription(contact));
|
p_contact_subscription(contact));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1665,12 +1665,12 @@ _cmd_who(gchar **args, struct cmd_help_t help)
|
|||||||
// valid arg
|
// valid arg
|
||||||
} else {
|
} else {
|
||||||
if (win_type == WIN_MUC) {
|
if (win_type == WIN_MUC) {
|
||||||
char *room = ui_current_win_recipient();
|
char *room = ui_current_recipient();
|
||||||
GList *list = muc_get_roster(room);
|
GList *list = muc_get_roster(room);
|
||||||
|
|
||||||
// no arg, show all contacts
|
// no arg, show all contacts
|
||||||
if (presence == NULL) {
|
if (presence == NULL) {
|
||||||
win_show_room_roster(room, list, NULL);
|
ui_room_roster(room, list, NULL);
|
||||||
|
|
||||||
// available
|
// available
|
||||||
} else if (strcmp("available", presence) == 0) {
|
} else if (strcmp("available", presence) == 0) {
|
||||||
@ -1684,7 +1684,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
|
|||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_show_room_roster(room, filtered, "available");
|
ui_room_roster(room, filtered, "available");
|
||||||
|
|
||||||
// unavailable
|
// unavailable
|
||||||
} else if (strcmp("unavailable", presence) == 0) {
|
} else if (strcmp("unavailable", presence) == 0) {
|
||||||
@ -1698,7 +1698,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
|
|||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_show_room_roster(room, filtered, "unavailable");
|
ui_room_roster(room, filtered, "unavailable");
|
||||||
|
|
||||||
// online, available resources
|
// online, available resources
|
||||||
} else if (strcmp("online", presence) == 0) {
|
} else if (strcmp("online", presence) == 0) {
|
||||||
@ -1712,7 +1712,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
|
|||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_show_room_roster(room, filtered, "online");
|
ui_room_roster(room, filtered, "online");
|
||||||
|
|
||||||
// offline, no available resources
|
// offline, no available resources
|
||||||
} else if (strcmp("offline", presence) == 0) {
|
} else if (strcmp("offline", presence) == 0) {
|
||||||
@ -1726,7 +1726,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
|
|||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_show_room_roster(room, filtered, "offline");
|
ui_room_roster(room, filtered, "offline");
|
||||||
|
|
||||||
// show specific status
|
// show specific status
|
||||||
} else {
|
} else {
|
||||||
@ -1740,7 +1740,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
|
|||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_show_room_roster(room, filtered, presence);
|
ui_room_roster(room, filtered, presence);
|
||||||
}
|
}
|
||||||
|
|
||||||
// not in groupchat window
|
// not in groupchat window
|
||||||
@ -1859,7 +1859,7 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (win_type == WIN_MUC) {
|
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)) {
|
if (muc_nick_in_roster(room_name, usr)) {
|
||||||
GString *full_jid = g_string_new(room_name);
|
GString *full_jid = g_string_new(room_name);
|
||||||
g_string_append(full_jid, "/");
|
g_string_append(full_jid, "/");
|
||||||
@ -1867,15 +1867,15 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
if (msg != NULL) {
|
if (msg != NULL) {
|
||||||
message_send(msg, full_jid->str);
|
message_send(msg, full_jid->str);
|
||||||
win_show_outgoing_msg("me", full_jid->str, msg);
|
ui_outgoing_msg("me", full_jid->str, msg);
|
||||||
} else {
|
} else {
|
||||||
win_new_chat_win(full_jid->str);
|
ui_new_chat_win(full_jid->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_string_free(full_jid, TRUE);
|
g_string_free(full_jid, TRUE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
win_current_show("No such participant \"%s\" in room.", usr);
|
ui_current_print_line("No such participant \"%s\" in room.", usr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1883,7 +1883,7 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
|
|||||||
} else {
|
} else {
|
||||||
if (msg != NULL) {
|
if (msg != NULL) {
|
||||||
message_send(msg, usr);
|
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)) {
|
if ((win_type == WIN_CHAT) && prefs_get_boolean(PREF_CHLOG)) {
|
||||||
const char *jid = jabber_get_jid();
|
const char *jid = jabber_get_jid();
|
||||||
@ -1894,7 +1894,7 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
win_new_chat_win(usr);
|
ui_new_chat_win(usr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1917,23 +1917,23 @@ _cmd_status(gchar **args, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
if (usr != NULL) {
|
if (usr != NULL) {
|
||||||
win_room_show_status(usr);
|
ui_status_room(usr);
|
||||||
} else {
|
} else {
|
||||||
win_current_show("You must specify a nickname.");
|
ui_current_print_line("You must specify a nickname.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIN_CHAT:
|
case WIN_CHAT:
|
||||||
if (usr != NULL) {
|
if (usr != NULL) {
|
||||||
win_current_show("No parameter required when in chat.");
|
ui_current_print_line("No parameter required when in chat.");
|
||||||
} else {
|
} else {
|
||||||
win_show_status();
|
ui_status();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIN_PRIVATE:
|
case WIN_PRIVATE:
|
||||||
if (usr != NULL) {
|
if (usr != NULL) {
|
||||||
win_current_show("No parameter required when in chat.");
|
ui_current_print_line("No parameter required when in chat.");
|
||||||
} else {
|
} else {
|
||||||
win_private_show_status();
|
ui_status_private();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIN_CONSOLE:
|
case WIN_CONSOLE:
|
||||||
@ -1968,7 +1968,7 @@ _cmd_info(gchar **args, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
if (usr != NULL) {
|
if (usr != NULL) {
|
||||||
pcontact = muc_get_participant(ui_current_win_recipient(), usr);
|
pcontact = muc_get_participant(ui_current_recipient(), usr);
|
||||||
if (pcontact != NULL) {
|
if (pcontact != NULL) {
|
||||||
cons_show_info(pcontact);
|
cons_show_info(pcontact);
|
||||||
} else {
|
} else {
|
||||||
@ -1982,19 +1982,19 @@ _cmd_info(gchar **args, struct cmd_help_t help)
|
|||||||
if (usr != NULL) {
|
if (usr != NULL) {
|
||||||
cons_show("No parameter required for /info in chat.");
|
cons_show("No parameter required for /info in chat.");
|
||||||
} else {
|
} else {
|
||||||
pcontact = contact_list_get_contact(ui_current_win_recipient());
|
pcontact = contact_list_get_contact(ui_current_recipient());
|
||||||
if (pcontact != NULL) {
|
if (pcontact != NULL) {
|
||||||
cons_show_info(pcontact);
|
cons_show_info(pcontact);
|
||||||
} else {
|
} 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;
|
break;
|
||||||
case WIN_PRIVATE:
|
case WIN_PRIVATE:
|
||||||
if (usr != NULL) {
|
if (usr != NULL) {
|
||||||
win_current_show("No parameter required when in chat.");
|
ui_current_print_line("No parameter required when in chat.");
|
||||||
} else {
|
} else {
|
||||||
Jid *jid = jid_create(ui_current_win_recipient());
|
Jid *jid = jid_create(ui_current_recipient());
|
||||||
pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||||
if (pcontact != NULL) {
|
if (pcontact != NULL) {
|
||||||
cons_show_info(pcontact);
|
cons_show_info(pcontact);
|
||||||
@ -2039,7 +2039,7 @@ _cmd_caps(gchar **args, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
if (args[0] != NULL) {
|
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) {
|
if (pcontact != NULL) {
|
||||||
Resource *resource = p_contact_get_resource(pcontact, args[0]);
|
Resource *resource = p_contact_get_resource(pcontact, args[0]);
|
||||||
cons_show_caps(args[0], resource);
|
cons_show_caps(args[0], resource);
|
||||||
@ -2078,7 +2078,7 @@ _cmd_caps(gchar **args, struct cmd_help_t help)
|
|||||||
if (args[0] != NULL) {
|
if (args[0] != NULL) {
|
||||||
cons_show("No parameter needed to /caps when in private chat.");
|
cons_show("No parameter needed to /caps when in private chat.");
|
||||||
} else {
|
} else {
|
||||||
Jid *jid = jid_create(ui_current_win_recipient());
|
Jid *jid = jid_create(ui_current_recipient());
|
||||||
pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||||
Resource *resource = p_contact_get_resource(pcontact, jid->resourcepart);
|
Resource *resource = p_contact_get_resource(pcontact, jid->resourcepart);
|
||||||
cons_show_caps(jid->resourcepart, resource);
|
cons_show_caps(jid->resourcepart, resource);
|
||||||
@ -2108,9 +2108,9 @@ _cmd_software(gchar **args, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
if (args[0] != NULL) {
|
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) {
|
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);
|
iq_send_software_version(jid->fulljid);
|
||||||
jid_destroy(jid);
|
jid_destroy(jid);
|
||||||
} else {
|
} else {
|
||||||
@ -2138,7 +2138,7 @@ _cmd_software(gchar **args, struct cmd_help_t help)
|
|||||||
if (args[0] != NULL) {
|
if (args[0] != NULL) {
|
||||||
cons_show("No parameter needed to /software when in private chat.");
|
cons_show("No parameter needed to /software when in private chat.");
|
||||||
} else {
|
} else {
|
||||||
iq_send_software_version(ui_current_win_recipient());
|
iq_send_software_version(ui_current_recipient());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2196,7 +2196,7 @@ _cmd_join(gchar **args, struct cmd_help_t help)
|
|||||||
if (!muc_room_is_active(room_jid)) {
|
if (!muc_room_is_active(room_jid)) {
|
||||||
presence_join_room(room_jid);
|
presence_join_room(room_jid);
|
||||||
}
|
}
|
||||||
win_join_chat(room_jid);
|
ui_room_join(room_jid);
|
||||||
|
|
||||||
jid_destroy(room_jid);
|
jid_destroy(room_jid);
|
||||||
jid_destroy(my_jid);
|
jid_destroy(my_jid);
|
||||||
@ -2223,7 +2223,7 @@ _cmd_invite(gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
room = ui_current_win_recipient();
|
room = ui_current_recipient();
|
||||||
message_send_invite(room, contact, reason);
|
message_send_invite(room, contact, reason);
|
||||||
if (reason != NULL) {
|
if (reason != NULL) {
|
||||||
cons_show("Room invite sent, contact: %s, room: %s, reason: \"%s\".",
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *room = ui_current_win_recipient();
|
char *room = ui_current_recipient();
|
||||||
char *nick = args[0];
|
char *nick = args[0];
|
||||||
presence_change_room_nick(room, nick);
|
presence_change_room_nick(room, nick);
|
||||||
|
|
||||||
@ -2322,7 +2322,7 @@ _cmd_tiny(gchar **args, struct cmd_help_t help)
|
|||||||
g_string_append(error, url);
|
g_string_append(error, url);
|
||||||
cons_show_error(error->str);
|
cons_show_error(error->str);
|
||||||
if (win_type != WIN_CONSOLE) {
|
if (win_type != WIN_CONSOLE) {
|
||||||
win_current_bad_show(error->str);
|
ui_current_error_line(error->str);
|
||||||
}
|
}
|
||||||
g_string_free(error, TRUE);
|
g_string_free(error, TRUE);
|
||||||
} else if (win_type != WIN_CONSOLE) {
|
} else if (win_type != WIN_CONSOLE) {
|
||||||
@ -2330,7 +2330,7 @@ _cmd_tiny(gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
if (tiny != NULL) {
|
if (tiny != NULL) {
|
||||||
if (win_type == WIN_CHAT) {
|
if (win_type == WIN_CHAT) {
|
||||||
char *recipient = ui_current_win_recipient();
|
char *recipient = ui_current_recipient();
|
||||||
message_send(tiny, recipient);
|
message_send(tiny, recipient);
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||||
@ -2340,15 +2340,15 @@ _cmd_tiny(gchar **args, struct cmd_help_t help)
|
|||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_show_outgoing_msg("me", recipient, tiny);
|
ui_outgoing_msg("me", recipient, tiny);
|
||||||
free(recipient);
|
free(recipient);
|
||||||
} else if (win_type == WIN_PRIVATE) {
|
} else if (win_type == WIN_PRIVATE) {
|
||||||
char *recipient = ui_current_win_recipient();
|
char *recipient = ui_current_recipient();
|
||||||
message_send(tiny, recipient);
|
message_send(tiny, recipient);
|
||||||
win_show_outgoing_msg("me", recipient, tiny);
|
ui_outgoing_msg("me", recipient, tiny);
|
||||||
free(recipient);
|
free(recipient);
|
||||||
} else { // groupchat
|
} else { // groupchat
|
||||||
char *recipient = ui_current_win_recipient();
|
char *recipient = ui_current_recipient();
|
||||||
message_send_groupchat(tiny, recipient);
|
message_send_groupchat(tiny, recipient);
|
||||||
free(recipient);
|
free(recipient);
|
||||||
}
|
}
|
||||||
@ -2385,12 +2385,12 @@ _cmd_close(gchar **args, struct cmd_help_t help)
|
|||||||
// handle leaving rooms, or chat
|
// handle leaving rooms, or chat
|
||||||
if (conn_status == JABBER_CONNECTED) {
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
if (win_type == WIN_MUC) {
|
if (win_type == WIN_MUC) {
|
||||||
char *room_jid = ui_current_win_recipient();
|
char *room_jid = ui_current_recipient();
|
||||||
presence_leave_chat_room(room_jid);
|
presence_leave_chat_room(room_jid);
|
||||||
} else if ((win_type == WIN_CHAT) || (win_type == WIN_PRIVATE)) {
|
} else if ((win_type == WIN_CHAT) || (win_type == WIN_PRIVATE)) {
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_STATES)) {
|
if (prefs_get_boolean(PREF_STATES)) {
|
||||||
char *recipient = ui_current_win_recipient();
|
char *recipient = ui_current_recipient();
|
||||||
|
|
||||||
// send <gone/> chat state before closing
|
// send <gone/> chat state before closing
|
||||||
if (chat_session_get_recipient_supports(recipient)) {
|
if (chat_session_get_recipient_supports(recipient)) {
|
||||||
|
104
src/profanity.c
104
src/profanity.c
@ -102,15 +102,15 @@ prof_run(const int disable_tls, char *log_level)
|
|||||||
void
|
void
|
||||||
prof_handle_typing(char *from)
|
prof_handle_typing(char *from)
|
||||||
{
|
{
|
||||||
ui_show_typing(from);
|
ui_contact_typing(from);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_handle_incoming_message(char *from, char *message, gboolean priv)
|
prof_handle_incoming_message(char *from, char *message, gboolean priv)
|
||||||
{
|
{
|
||||||
ui_show_incoming_msg(from, message, NULL, priv);
|
ui_incoming_msg(from, message, NULL, priv);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
|
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
|
||||||
Jid *from_jid = jid_create(from);
|
Jid *from_jid = jid_create(from);
|
||||||
@ -126,8 +126,8 @@ void
|
|||||||
prof_handle_delayed_message(char *from, char *message, GTimeVal tv_stamp,
|
prof_handle_delayed_message(char *from, char *message, GTimeVal tv_stamp,
|
||||||
gboolean priv)
|
gboolean priv)
|
||||||
{
|
{
|
||||||
ui_show_incoming_msg(from, message, &tv_stamp, priv);
|
ui_incoming_msg(from, message, &tv_stamp, priv);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
|
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
|
||||||
Jid *from_jid = jid_create(from);
|
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.");
|
cons_show_error("Unknown error received from service.");
|
||||||
} else if (strcmp(err_msg, "conflict") == 0) {
|
} else if (strcmp(err_msg, "conflict") == 0) {
|
||||||
if (win_type == WIN_MUC) {
|
if (win_type == WIN_MUC) {
|
||||||
win_current_show("Nickname already in use.");
|
ui_current_print_line("Nickname already in use.");
|
||||||
} else {
|
} else {
|
||||||
cons_show_error("Error received from server: %s", err_msg);
|
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);
|
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
|
void
|
||||||
@ -166,20 +166,20 @@ prof_handle_subscription(const char *from, jabber_subscr_t type)
|
|||||||
/* TODO: auto-subscribe if needed */
|
/* TODO: auto-subscribe if needed */
|
||||||
cons_show("Received authorization request from %s", from);
|
cons_show("Received authorization request from %s", from);
|
||||||
log_info("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");
|
ui_print_system_msg_from_recipient(from, "Authorization request, type '/sub allow' to accept or '/sub deny' to reject");
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
break;
|
break;
|
||||||
case PRESENCE_SUBSCRIBED:
|
case PRESENCE_SUBSCRIBED:
|
||||||
cons_show("Subscription received from %s", from);
|
cons_show("Subscription received from %s", from);
|
||||||
log_info("Subscription received from %s", from);
|
log_info("Subscription received from %s", from);
|
||||||
win_show_system_msg(from, "Subscribed");
|
ui_print_system_msg_from_recipient(from, "Subscribed");
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
break;
|
break;
|
||||||
case PRESENCE_UNSUBSCRIBED:
|
case PRESENCE_UNSUBSCRIBED:
|
||||||
cons_show("%s deleted subscription", from);
|
cons_show("%s deleted subscription", from);
|
||||||
log_info("%s deleted subscription", from);
|
log_info("%s deleted subscription", from);
|
||||||
win_show_system_msg(from, "Unsubscribed");
|
ui_print_system_msg_from_recipient(from, "Unsubscribed");
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* unknown type */
|
/* unknown type */
|
||||||
@ -196,7 +196,7 @@ prof_handle_login_account_success(char *account_name)
|
|||||||
cons_show_login_success(account);
|
cons_show_login_success(account);
|
||||||
title_bar_set_status(contact_presence);
|
title_bar_set_status(contact_presence);
|
||||||
log_info("%s logged in successfully", account->jid);
|
log_info("%s logged in successfully", account->jid);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
status_bar_print_message(account->jid);
|
status_bar_print_message(account->jid);
|
||||||
status_bar_refresh();
|
status_bar_refresh();
|
||||||
|
|
||||||
@ -206,8 +206,8 @@ prof_handle_login_account_success(char *account_name)
|
|||||||
void
|
void
|
||||||
prof_handle_gone(const char * const from)
|
prof_handle_gone(const char * const from)
|
||||||
{
|
{
|
||||||
win_show_gone(from);
|
ui_recipient_gone(from);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -215,7 +215,7 @@ prof_handle_failed_login(void)
|
|||||||
{
|
{
|
||||||
cons_show_error("Login failed.");
|
cons_show_error("Login failed.");
|
||||||
log_info("Login failed");
|
log_info("Login failed");
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -225,7 +225,7 @@ prof_handle_lost_connection(void)
|
|||||||
contact_list_clear();
|
contact_list_clear();
|
||||||
chat_sessions_clear();
|
chat_sessions_clear();
|
||||||
ui_disconnected();
|
ui_disconnected();
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -236,38 +236,38 @@ prof_handle_disconnect(const char * const jid)
|
|||||||
contact_list_clear();
|
contact_list_clear();
|
||||||
chat_sessions_clear();
|
chat_sessions_clear();
|
||||||
ui_disconnected();
|
ui_disconnected();
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_handle_room_history(const char * const room_jid, const char * const nick,
|
prof_handle_room_history(const char * const room_jid, const char * const nick,
|
||||||
GTimeVal tv_stamp, const char * const message)
|
GTimeVal tv_stamp, const char * const message)
|
||||||
{
|
{
|
||||||
win_show_room_history(room_jid, nick, tv_stamp, message);
|
ui_room_history(room_jid, nick, tv_stamp, message);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_handle_room_message(const char * const room_jid, const char * const nick,
|
prof_handle_room_message(const char * const room_jid, const char * const nick,
|
||||||
const char * const message)
|
const char * const message)
|
||||||
{
|
{
|
||||||
win_show_room_message(room_jid, nick, message);
|
ui_room_message(room_jid, nick, message);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_handle_room_subject(const char * const room_jid, const char * const subject)
|
prof_handle_room_subject(const char * const room_jid, const char * const subject)
|
||||||
{
|
{
|
||||||
win_show_room_subject(room_jid, subject);
|
ui_room_subject(room_jid, subject);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_handle_room_broadcast(const char *const room_jid,
|
prof_handle_room_broadcast(const char *const room_jid,
|
||||||
const char * const message)
|
const char * const message)
|
||||||
{
|
{
|
||||||
win_show_room_broadcast(room_jid, message);
|
ui_room_broadcast(room_jid, message);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -275,8 +275,8 @@ prof_handle_room_roster_complete(const char * const room)
|
|||||||
{
|
{
|
||||||
muc_set_roster_received(room);
|
muc_set_roster_received(room);
|
||||||
GList *roster = muc_get_roster(room);
|
GList *roster = muc_get_roster(room);
|
||||||
win_show_room_roster(room, roster, NULL);
|
ui_room_roster(room, roster, NULL);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
gboolean updated = muc_add_to_roster(room, nick, show, status, caps_str);
|
||||||
|
|
||||||
if (updated) {
|
if (updated) {
|
||||||
win_show_room_member_presence(room, nick, show, status);
|
ui_room_member_presence(room, nick, show, status);
|
||||||
win_current_page_off();
|
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)
|
const char * const caps_str)
|
||||||
{
|
{
|
||||||
muc_add_to_roster(room, nick, show, status, caps_str);
|
muc_add_to_roster(room, nick, show, status, caps_str);
|
||||||
win_show_room_member_online(room, nick, show, status);
|
ui_room_member_online(room, nick, show, status);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
const char * const show, const char * const status)
|
||||||
{
|
{
|
||||||
muc_remove_from_roster(room, nick);
|
muc_remove_from_roster(room, nick);
|
||||||
win_show_room_member_offline(room, nick);
|
ui_room_member_offline(room, nick);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -322,7 +322,7 @@ void prof_handle_room_invite(jabber_invite_t invite_type,
|
|||||||
const char * const reason)
|
const char * const reason)
|
||||||
{
|
{
|
||||||
cons_show_room_invite(invitor, room, reason);
|
cons_show_room_invite(invitor, room, reason);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -337,7 +337,7 @@ prof_handle_contact_online(char *contact, Resource *resource,
|
|||||||
if (strcmp(p_contact_subscription(result), "none") != 0) {
|
if (strcmp(p_contact_subscription(result), "none") != 0) {
|
||||||
const char *show = string_from_resource_presence(resource->presence);
|
const char *show = string_from_resource_presence(resource->presence);
|
||||||
ui_contact_online(contact, resource->name, show, resource->status, last_activity);
|
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 (p_contact_subscription(result) != NULL) {
|
||||||
if (strcmp(p_contact_subscription(result), "none") != 0) {
|
if (strcmp(p_contact_subscription(result), "none") != 0) {
|
||||||
ui_contact_offline(jid->fulljid, "offline", status);
|
ui_contact_offline(jid->fulljid, "offline", status);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jid_destroy(jid);
|
jid_destroy(jid);
|
||||||
@ -365,16 +365,16 @@ void
|
|||||||
prof_handle_room_member_nick_change(const char * const room,
|
prof_handle_room_member_nick_change(const char * const room,
|
||||||
const char * const old_nick, const char * const nick)
|
const char * const old_nick, const char * const nick)
|
||||||
{
|
{
|
||||||
win_show_room_member_nick_change(room, old_nick, nick);
|
ui_room_member_nick_change(room, old_nick, nick);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_handle_room_nick_change(const char * const room,
|
prof_handle_room_nick_change(const char * const room,
|
||||||
const char * const nick)
|
const char * const nick)
|
||||||
{
|
{
|
||||||
win_show_room_nick_change(room, nick);
|
ui_room_nick_change(room, nick);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -393,7 +393,7 @@ prof_handle_activity(void)
|
|||||||
jabber_conn_status_t status = jabber_get_connection_status();
|
jabber_conn_status_t status = jabber_get_connection_status();
|
||||||
|
|
||||||
if ((status == JABBER_CONNECTED) && (win_type == WIN_CHAT)) {
|
if ((status == JABBER_CONNECTED) && (win_type == WIN_CHAT)) {
|
||||||
char *recipient = ui_current_win_recipient();
|
char *recipient = ui_current_recipient();
|
||||||
chat_session_set_composing(recipient);
|
chat_session_set_composing(recipient);
|
||||||
if (!chat_session_get_sent(recipient) ||
|
if (!chat_session_get_sent(recipient) ||
|
||||||
chat_session_is_paused(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)
|
const char * const name, const char * const version, const char * const os)
|
||||||
{
|
{
|
||||||
cons_show_software_version(jid, presence, name, version, os);
|
cons_show_software_version(jid, presence, name, version, os);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_handle_room_list(GSList *rooms, const char *conference_node)
|
prof_handle_room_list(GSList *rooms, const char *conference_node)
|
||||||
{
|
{
|
||||||
cons_show_room_list(rooms, conference_node);
|
cons_show_room_list(rooms, conference_node);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_handle_disco_items(GSList *items, const char *jid)
|
prof_handle_disco_items(GSList *items, const char *jid)
|
||||||
{
|
{
|
||||||
cons_show_disco_items(items, jid);
|
cons_show_disco_items(items, jid);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_handle_disco_info(const char *from, GSList *identities, GSList *features)
|
prof_handle_disco_info(const char *from, GSList *identities, GSList *features)
|
||||||
{
|
{
|
||||||
cons_show_disco_info(from, identities, 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();
|
inp_win_reset();
|
||||||
contact_list_reset_search_attempts();
|
contact_list_reset_search_attempts();
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -490,7 +490,7 @@ _handle_idle_time()
|
|||||||
cons_show("Idle for %d minutes, status set to away (priority %d), \"%s\".",
|
cons_show("Idle for %d minutes, status set to away (priority %d), \"%s\".",
|
||||||
prefs_get_autoaway_time(), pri, prefs_get_string(PREF_AUTOAWAY_MESSAGE));
|
prefs_get_autoaway_time(), pri, prefs_get_string(PREF_AUTOAWAY_MESSAGE));
|
||||||
title_bar_set_status(CONTACT_AWAY);
|
title_bar_set_status(CONTACT_AWAY);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
} else {
|
} else {
|
||||||
int pri =
|
int pri =
|
||||||
accounts_get_priority_for_presence_type(jabber_get_account_name(),
|
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).",
|
cons_show("Idle for %d minutes, status set to away (priority %d).",
|
||||||
prefs_get_autoaway_time(), pri);
|
prefs_get_autoaway_time(), pri);
|
||||||
title_bar_set_status(CONTACT_AWAY);
|
title_bar_set_status(CONTACT_AWAY);
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle idle mode
|
// handle idle mode
|
||||||
@ -521,7 +521,7 @@ _handle_idle_time()
|
|||||||
RESOURCE_ONLINE);
|
RESOURCE_ONLINE);
|
||||||
cons_show("No longer idle, status set to online (priority %d).", pri);
|
cons_show("No longer idle, status set to online (priority %d).", pri);
|
||||||
title_bar_set_status(CONTACT_ONLINE);
|
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) {
|
} else if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "idle") == 0) {
|
||||||
presence_update(RESOURCE_ONLINE, NULL, 0);
|
presence_update(RESOURCE_ONLINE, NULL, 0);
|
||||||
title_bar_set_status(CONTACT_ONLINE);
|
title_bar_set_status(CONTACT_ONLINE);
|
||||||
|
@ -100,7 +100,7 @@ cons_debug(const char * const msg, ...)
|
|||||||
status_bar_new(0);
|
status_bar_new(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
ui_refresh();
|
ui_refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ ui_windows_full(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ui_show_typing(const char * const from)
|
ui_contact_typing(const char * const from)
|
||||||
{
|
{
|
||||||
int win_index = _find_prof_win_index(from);
|
int win_index = _find_prof_win_index(from);
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ ui_idle(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
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)
|
GTimeVal *tv_stamp, gboolean priv)
|
||||||
{
|
{
|
||||||
char *display_from;
|
char *display_from;
|
||||||
@ -491,11 +491,11 @@ ui_handle_special_keys(const wint_t * const ch, const char * const inp,
|
|||||||
void
|
void
|
||||||
ui_switch_win(const int i)
|
ui_switch_win(const int i)
|
||||||
{
|
{
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
if (windows[i] != NULL) {
|
if (windows[i] != NULL) {
|
||||||
current_index = i;
|
current_index = i;
|
||||||
current = windows[current_index];
|
current = windows[current_index];
|
||||||
win_current_page_off();
|
ui_current_page_off();
|
||||||
|
|
||||||
current->unread = 0;
|
current->unread = 0;
|
||||||
|
|
||||||
@ -543,13 +543,13 @@ ui_current_win_type(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
ui_current_win_recipient(void)
|
ui_current_recipient(void)
|
||||||
{
|
{
|
||||||
return strdup(current->from);
|
return strdup(current->from);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_current_show(const char * const msg, ...)
|
ui_current_print_line(const char * const msg, ...)
|
||||||
{
|
{
|
||||||
va_list arg;
|
va_list arg;
|
||||||
va_start(arg, msg);
|
va_start(arg, msg);
|
||||||
@ -564,7 +564,7 @@ win_current_show(const char * const msg, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_current_bad_show(const char * const msg)
|
ui_current_error_line(const char * const msg)
|
||||||
{
|
{
|
||||||
window_print_time(current, '-');
|
window_print_time(current, '-');
|
||||||
wattron(current->win, COLOUR_ERROR);
|
wattron(current->win, COLOUR_ERROR);
|
||||||
@ -575,7 +575,7 @@ win_current_bad_show(const char * const msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_current_page_off(void)
|
ui_current_page_off(void)
|
||||||
{
|
{
|
||||||
int rows = getmaxy(stdscr);
|
int rows = getmaxy(stdscr);
|
||||||
ProfWin *window = windows[current_index];
|
ProfWin *window = windows[current_index];
|
||||||
@ -594,7 +594,7 @@ win_current_page_off(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
int win_index;
|
||||||
ProfWin *window;
|
ProfWin *window;
|
||||||
@ -615,7 +615,7 @@ win_show_error_msg(const char * const from, const char *err_msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
int win_index;
|
||||||
ProfWin *window;
|
ProfWin *window;
|
||||||
@ -646,7 +646,7 @@ win_show_system_msg(const char * const from, const char *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_show_gone(const char * const from)
|
ui_recipient_gone(const char * const from)
|
||||||
{
|
{
|
||||||
int win_index;
|
int win_index;
|
||||||
ProfWin *window;
|
ProfWin *window;
|
||||||
@ -671,7 +671,7 @@ win_show_gone(const char * const from)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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
|
// if the contact is offline, show a message
|
||||||
PContact contact = contact_list_get_contact(to);
|
PContact contact = contact_list_get_contact(to);
|
||||||
@ -713,7 +713,7 @@ win_new_chat_win(const char * const to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
const char * const message)
|
||||||
{
|
{
|
||||||
// if the contact is offline, show a 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
|
void
|
||||||
win_join_chat(Jid *jid)
|
ui_room_join(Jid *jid)
|
||||||
{
|
{
|
||||||
int win_index = _find_prof_win_index(jid->barejid);
|
int win_index = _find_prof_win_index(jid->barejid);
|
||||||
|
|
||||||
@ -780,7 +780,7 @@ win_join_chat(Jid *jid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
int win_index = _find_prof_win_index(room);
|
||||||
ProfWin *window = windows[win_index];
|
ProfWin *window = windows[win_index];
|
||||||
@ -829,7 +829,7 @@ win_show_room_roster(const char * const room, GList *roster, const char * const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
int win_index = _find_prof_win_index(room);
|
||||||
ProfWin *window = windows[win_index];
|
ProfWin *window = windows[win_index];
|
||||||
@ -844,7 +844,7 @@ win_show_room_member_offline(const char * const room, const char * const nick)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
const char * const show, const char * const status)
|
||||||
{
|
{
|
||||||
int win_index = _find_prof_win_index(room);
|
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
|
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)
|
const char * const show, const char * const status)
|
||||||
{
|
{
|
||||||
int win_index = _find_prof_win_index(room);
|
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
|
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)
|
const char * const old_nick, const char * const nick)
|
||||||
{
|
{
|
||||||
int win_index = _find_prof_win_index(room);
|
int win_index = _find_prof_win_index(room);
|
||||||
@ -890,7 +890,7 @@ win_show_room_member_nick_change(const char * const room,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
int win_index = _find_prof_win_index(room);
|
||||||
ProfWin *window = windows[win_index];
|
ProfWin *window = windows[win_index];
|
||||||
@ -905,7 +905,7 @@ win_show_room_nick_change(const char * const room, const char * const nick)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
GTimeVal tv_stamp, const char * const message)
|
||||||
{
|
{
|
||||||
int win_index = _find_prof_win_index(room_jid);
|
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
|
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)
|
const char * const message)
|
||||||
{
|
{
|
||||||
int win_index = _find_prof_win_index(room_jid);
|
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
|
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);
|
int win_index = _find_prof_win_index(room_jid);
|
||||||
ProfWin *window = windows[win_index];
|
ProfWin *window = windows[win_index];
|
||||||
@ -1019,7 +1019,7 @@ win_show_room_subject(const char * const room_jid, const char * const subject)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
int win_index = _find_prof_win_index(room_jid);
|
||||||
ProfWin *window = windows[win_index];
|
ProfWin *window = windows[win_index];
|
||||||
@ -1042,43 +1042,43 @@ win_show_room_broadcast(const char * const room_jid, const char * const message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
PContact pcontact = contact_list_get_contact(recipient);
|
||||||
|
|
||||||
if (pcontact != NULL) {
|
if (pcontact != NULL) {
|
||||||
window_show_contact(current, pcontact);
|
window_show_contact(current, pcontact);
|
||||||
} else {
|
} else {
|
||||||
win_current_show("Error getting contact info.");
|
ui_current_print_line("Error getting contact info.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||||
|
|
||||||
if (pcontact != NULL) {
|
if (pcontact != NULL) {
|
||||||
window_show_contact(current, pcontact);
|
window_show_contact(current, pcontact);
|
||||||
} else {
|
} else {
|
||||||
win_current_show("Error getting contact info.");
|
ui_current_print_line("Error getting contact info.");
|
||||||
}
|
}
|
||||||
|
|
||||||
jid_destroy(jid);
|
jid_destroy(jid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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) {
|
if (pcontact != NULL) {
|
||||||
window_show_contact(current, pcontact);
|
window_show_contact(current, pcontact);
|
||||||
} else {
|
} else {
|
||||||
win_current_show("No such participant \"%s\" in room.", contact);
|
ui_current_print_line("No such participant \"%s\" in room.", contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
97
src/ui/ui.h
97
src/ui/ui.h
@ -45,28 +45,68 @@
|
|||||||
// holds console at index 0 and chat wins 1 through to 9
|
// holds console at index 0 and chat wins 1 through to 9
|
||||||
ProfWin* windows[NUM_WINS];
|
ProfWin* windows[NUM_WINS];
|
||||||
|
|
||||||
// gui startup and shutdown, resize
|
// ui startup and control
|
||||||
void ui_init(void);
|
void ui_init(void);
|
||||||
void ui_load_colours(void);
|
void ui_load_colours(void);
|
||||||
void ui_refresh(void);
|
void ui_refresh(void);
|
||||||
void ui_close(void);
|
void ui_close(void);
|
||||||
void ui_resize(const int ch, const char * const input,
|
void ui_resize(const int ch, const char * const input,
|
||||||
const int size);
|
const int size);
|
||||||
void ui_show_typing(const char * const from);
|
|
||||||
void ui_idle(void);
|
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,
|
void ui_handle_special_keys(const wint_t * const ch, const char * const inp,
|
||||||
const int size);
|
const int size);
|
||||||
void ui_switch_win(const int i);
|
void ui_switch_win(const int i);
|
||||||
gboolean ui_windows_full(void);
|
gboolean ui_windows_full(void);
|
||||||
unsigned long ui_get_idle_time(void);
|
unsigned long ui_get_idle_time(void);
|
||||||
void ui_reset_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
|
// create windows
|
||||||
void create_title_bar(void);
|
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_set_typing(gboolean is_typing);
|
||||||
void title_bar_draw(void);
|
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
|
// console window actions
|
||||||
ProfWin* cons_create(void);
|
ProfWin* cons_create(void);
|
||||||
void cons_refresh(void);
|
void cons_refresh(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user