mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Renamed window_ functions win_
This commit is contained in:
parent
1046a00405
commit
e14cd43af4
144
src/ui/console.c
144
src/ui/console.c
@ -49,7 +49,7 @@ ProfWin *
|
||||
cons_create(void)
|
||||
{
|
||||
int cols = getmaxx(stdscr);
|
||||
console = window_create(CONS_WIN_TITLE, cols, WIN_CONSOLE);
|
||||
console = win_create(CONS_WIN_TITLE, cols, WIN_CONSOLE);
|
||||
dirty = FALSE;
|
||||
return console;
|
||||
}
|
||||
@ -68,7 +68,7 @@ cons_refresh(void)
|
||||
void
|
||||
cons_show_time(void)
|
||||
{
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
}
|
||||
|
||||
void
|
||||
@ -90,7 +90,7 @@ cons_debug(const char * const msg, ...)
|
||||
va_start(arg, msg);
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, msg, arg);
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "%s\n", fmt_msg->str);
|
||||
g_string_free(fmt_msg, TRUE);
|
||||
va_end(arg);
|
||||
@ -112,7 +112,7 @@ cons_show(const char * const msg, ...)
|
||||
va_start(arg, msg);
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, msg, arg);
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "%s\n", fmt_msg->str);
|
||||
g_string_free(fmt_msg, TRUE);
|
||||
va_end(arg);
|
||||
@ -127,7 +127,7 @@ cons_show_error(const char * const msg, ...)
|
||||
va_start(arg, msg);
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, msg, arg);
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_ERROR);
|
||||
wprintw(console->win, "%s\n", fmt_msg->str);
|
||||
wattroff(console->win, COLOUR_ERROR);
|
||||
@ -143,7 +143,7 @@ cons_show_error(const char * const msg, ...)
|
||||
void
|
||||
cons_show_typing(const char * const short_from)
|
||||
{
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_TYPING);
|
||||
wprintw(console->win, "!! %s is typing a message...\n", short_from);
|
||||
wattroff(console->win, COLOUR_TYPING);
|
||||
@ -152,7 +152,7 @@ cons_show_typing(const char * const short_from)
|
||||
void
|
||||
cons_show_incoming_message(const char * const short_from, const int win_index)
|
||||
{
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_INCOMING);
|
||||
wprintw(console->win, "<< incoming from %s (%d)\n", short_from, win_index + 1);
|
||||
wattroff(console->win, COLOUR_INCOMING);
|
||||
@ -167,7 +167,7 @@ cons_about(void)
|
||||
if (prefs_get_boolean(PREF_SPLASH)) {
|
||||
_cons_splash_logo();
|
||||
} else {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
|
||||
if (strcmp(PACKAGE_STATUS, "development") == 0) {
|
||||
wprintw(console->win, "Welcome to Profanity, version %sdev\n", PACKAGE_VERSION);
|
||||
@ -176,21 +176,21 @@ cons_about(void)
|
||||
}
|
||||
}
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "Copyright (C) 2012, 2013 James Booth <%s>.\n", PACKAGE_BUGREPORT);
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "\n");
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "This is free software; you are free to change and redistribute it.\n");
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "There is NO WARRANTY, to the extent permitted by law.\n");
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "\n");
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "Type '/help' to show complete help.\n");
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "\n");
|
||||
|
||||
if (prefs_get_boolean(PREF_VERCHECK)) {
|
||||
@ -215,12 +215,12 @@ cons_check_version(gboolean not_available_msg)
|
||||
|
||||
if (relase_valid) {
|
||||
if (release_is_new(latest_release)) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "A new version of Profanity is available: %s", latest_release);
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "Check <http://www.profanity.im> for details.\n");
|
||||
free(latest_release);
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "\n");
|
||||
} else {
|
||||
if (not_available_msg) {
|
||||
@ -240,15 +240,15 @@ cons_check_version(gboolean not_available_msg)
|
||||
void
|
||||
cons_show_login_success(ProfAccount *account)
|
||||
{
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "%s logged in successfully, ", account->jid);
|
||||
|
||||
resource_presence_t presence = accounts_get_login_presence(account->name);
|
||||
const char *presence_str = string_from_resource_presence(presence);
|
||||
|
||||
window_presence_colour_on(console, presence_str);
|
||||
win_presence_colour_on(console, presence_str);
|
||||
wprintw(console->win, "%s", presence_str);
|
||||
window_presence_colour_off(console, presence_str);
|
||||
win_presence_colour_off(console, presence_str);
|
||||
wprintw(console->win, " (priority %d)",
|
||||
accounts_get_priority_for_presence_type(account->name, presence));
|
||||
wprintw(console->win, ".\n");
|
||||
@ -262,7 +262,7 @@ cons_show_wins(void)
|
||||
|
||||
cons_show("");
|
||||
cons_show("Active windows:");
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "1: Console\n");
|
||||
|
||||
for (i = 1; i < NUM_WINS; i++) {
|
||||
@ -275,7 +275,7 @@ cons_show_wins(void)
|
||||
for (i = 1; i < NUM_WINS; i++) {
|
||||
if (windows[i] != NULL) {
|
||||
ProfWin *window = windows[i];
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
|
||||
switch (window->type)
|
||||
{
|
||||
@ -342,19 +342,19 @@ cons_show_info(PContact pcontact)
|
||||
GDateTime *last_activity = p_contact_last_activity(pcontact);
|
||||
WINDOW *win = console->win;
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, "\n");
|
||||
window_print_time(console, '-');
|
||||
window_presence_colour_on(console, presence);
|
||||
win_print_time(console, '-');
|
||||
win_presence_colour_on(console, presence);
|
||||
wprintw(win, "%s", barejid);
|
||||
if (name != NULL) {
|
||||
wprintw(win, " (%s)", name);
|
||||
}
|
||||
window_presence_colour_off(console, presence);
|
||||
win_presence_colour_off(console, presence);
|
||||
wprintw(win, ":\n");
|
||||
|
||||
if (sub != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, "Subscription: %s\n", sub);
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ cons_show_info(PContact pcontact)
|
||||
GDateTime *now = g_date_time_new_now_local();
|
||||
GTimeSpan span = g_date_time_difference(now, last_activity);
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, "Last activity: ");
|
||||
|
||||
int hours = span / G_TIME_SPAN_HOUR;
|
||||
@ -384,7 +384,7 @@ cons_show_info(PContact pcontact)
|
||||
}
|
||||
|
||||
if (resources != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, "Resources:\n");
|
||||
|
||||
// sort in order of availabiltiy
|
||||
@ -399,21 +399,21 @@ cons_show_info(PContact pcontact)
|
||||
while (ordered_resources != NULL) {
|
||||
Resource *resource = ordered_resources->data;
|
||||
const char *resource_presence = string_from_resource_presence(resource->presence);
|
||||
window_print_time(console, '-');
|
||||
window_presence_colour_on(console, resource_presence);
|
||||
win_print_time(console, '-');
|
||||
win_presence_colour_on(console, resource_presence);
|
||||
wprintw(win, " %s (%d), %s", resource->name, resource->priority, resource_presence);
|
||||
if (resource->status != NULL) {
|
||||
wprintw(win, ", \"%s\"", resource->status);
|
||||
}
|
||||
wprintw(win, "\n");
|
||||
window_presence_colour_off(console, resource_presence);
|
||||
win_presence_colour_off(console, resource_presence);
|
||||
|
||||
if (resource->caps_str != NULL) {
|
||||
Capabilities *caps = caps_get(resource->caps_str);
|
||||
if (caps != NULL) {
|
||||
// show identity
|
||||
if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, " Identity: ");
|
||||
if (caps->name != NULL) {
|
||||
wprintw(win, "%s", caps->name);
|
||||
@ -433,7 +433,7 @@ cons_show_info(PContact pcontact)
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->software != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, " Software: %s", caps->software);
|
||||
}
|
||||
if (caps->software_version != NULL) {
|
||||
@ -443,7 +443,7 @@ cons_show_info(PContact pcontact)
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->os != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, " OS: %s", caps->os);
|
||||
}
|
||||
if (caps->os_version != NULL) {
|
||||
@ -470,10 +470,10 @@ cons_show_caps(const char * const contact, Resource *resource)
|
||||
WINDOW *win = console->win;
|
||||
cons_show("");
|
||||
const char *resource_presence = string_from_resource_presence(resource->presence);
|
||||
window_print_time(console, '-');
|
||||
window_presence_colour_on(console, resource_presence);
|
||||
win_print_time(console, '-');
|
||||
win_presence_colour_on(console, resource_presence);
|
||||
wprintw(console->win, "%s", contact);
|
||||
window_presence_colour_off(console, resource_presence);
|
||||
win_presence_colour_off(console, resource_presence);
|
||||
wprintw(win, ":\n");
|
||||
|
||||
if (resource->caps_str != NULL) {
|
||||
@ -481,7 +481,7 @@ cons_show_caps(const char * const contact, Resource *resource)
|
||||
if (caps != NULL) {
|
||||
// show identity
|
||||
if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, "Identity: ");
|
||||
if (caps->name != NULL) {
|
||||
wprintw(win, "%s", caps->name);
|
||||
@ -501,7 +501,7 @@ cons_show_caps(const char * const contact, Resource *resource)
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->software != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, "Software: %s", caps->software);
|
||||
}
|
||||
if (caps->software_version != NULL) {
|
||||
@ -511,7 +511,7 @@ cons_show_caps(const char * const contact, Resource *resource)
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->os != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, "OS: %s", caps->os);
|
||||
}
|
||||
if (caps->os_version != NULL) {
|
||||
@ -522,11 +522,11 @@ cons_show_caps(const char * const contact, Resource *resource)
|
||||
}
|
||||
|
||||
if (caps->features != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, "Features:\n");
|
||||
GSList *feature = caps->features;
|
||||
while (feature != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, " %s\n", feature->data);
|
||||
feature = g_slist_next(feature);
|
||||
}
|
||||
@ -546,10 +546,10 @@ cons_show_software_version(const char * const jid, const char * const presence,
|
||||
{
|
||||
if ((name != NULL) || (version != NULL) || (os != NULL)) {
|
||||
cons_show("");
|
||||
window_print_time(console, '-');
|
||||
window_presence_colour_on(console, presence);
|
||||
win_print_time(console, '-');
|
||||
win_presence_colour_on(console, presence);
|
||||
wprintw(console->win, "%s", jid);
|
||||
window_presence_colour_off(console, presence);
|
||||
win_presence_colour_off(console, presence);
|
||||
wprintw(console->win, ":\n");
|
||||
}
|
||||
if (name != NULL) {
|
||||
@ -575,7 +575,7 @@ cons_show_room_list(GSList *rooms, const char * const conference_node)
|
||||
cons_show("Chat rooms at %s:", conference_node);
|
||||
while (rooms != NULL) {
|
||||
DiscoItem *room = rooms->data;
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, " %s", room->jid);
|
||||
if (room->name != NULL) {
|
||||
wprintw(console->win, ", (%s)", room->name);
|
||||
@ -646,7 +646,7 @@ cons_show_disco_items(GSList *items, const char * const jid)
|
||||
cons_show("Service discovery items for %s:", jid);
|
||||
while (items != NULL) {
|
||||
DiscoItem *item = items->data;
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, " %s", item->jid);
|
||||
if (item->name != NULL) {
|
||||
wprintw(console->win, ", (%s)", item->name);
|
||||
@ -670,7 +670,7 @@ cons_show_status(const char * const contact)
|
||||
PContact pcontact = contact_list_get_contact(contact);
|
||||
|
||||
if (pcontact != NULL) {
|
||||
window_show_contact(console, pcontact);
|
||||
win_show_contact(console, pcontact);
|
||||
} else {
|
||||
cons_show("No such contact \"%s\" in roster.", contact);
|
||||
}
|
||||
@ -723,10 +723,10 @@ cons_show_account_list(gchar **accounts)
|
||||
if ((jabber_get_connection_status() == JABBER_CONNECTED) &&
|
||||
(g_strcmp0(jabber_get_account_name(), accounts[i]) == 0)) {
|
||||
resource_presence_t presence = accounts_get_last_presence(accounts[i]);
|
||||
window_print_time(console, '-');
|
||||
window_presence_colour_on(console, string_from_resource_presence(presence));
|
||||
win_print_time(console, '-');
|
||||
win_presence_colour_on(console, string_from_resource_presence(presence));
|
||||
wprintw(console->win, "%s\n", accounts[i]);
|
||||
window_presence_colour_off(console, string_from_resource_presence(presence));
|
||||
win_presence_colour_off(console, string_from_resource_presence(presence));
|
||||
} else {
|
||||
cons_show(accounts[i]);
|
||||
}
|
||||
@ -777,7 +777,7 @@ cons_show_account(ProfAccount *account)
|
||||
|
||||
WINDOW *win = console->win;
|
||||
if (resources != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, "Resources:\n");
|
||||
|
||||
// sort in order of availabiltiy
|
||||
@ -792,21 +792,21 @@ cons_show_account(ProfAccount *account)
|
||||
while (ordered_resources != NULL) {
|
||||
Resource *resource = ordered_resources->data;
|
||||
const char *resource_presence = string_from_resource_presence(resource->presence);
|
||||
window_print_time(console, '-');
|
||||
window_presence_colour_on(console, resource_presence);
|
||||
win_print_time(console, '-');
|
||||
win_presence_colour_on(console, resource_presence);
|
||||
wprintw(win, " %s (%d), %s", resource->name, resource->priority, resource_presence);
|
||||
if (resource->status != NULL) {
|
||||
wprintw(win, ", \"%s\"", resource->status);
|
||||
}
|
||||
wprintw(win, "\n");
|
||||
window_presence_colour_off(console, resource_presence);
|
||||
win_presence_colour_off(console, resource_presence);
|
||||
|
||||
if (resource->caps_str != NULL) {
|
||||
Capabilities *caps = caps_get(resource->caps_str);
|
||||
if (caps != NULL) {
|
||||
// show identity
|
||||
if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, " Identity: ");
|
||||
if (caps->name != NULL) {
|
||||
wprintw(win, "%s", caps->name);
|
||||
@ -826,7 +826,7 @@ cons_show_account(ProfAccount *account)
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->software != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, " Software: %s", caps->software);
|
||||
}
|
||||
if (caps->software_version != NULL) {
|
||||
@ -836,7 +836,7 @@ cons_show_account(ProfAccount *account)
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->os != NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(win, " OS: %s", caps->os);
|
||||
}
|
||||
if (caps->os_version != NULL) {
|
||||
@ -1208,7 +1208,7 @@ cons_show_contacts(GSList *list)
|
||||
while(curr) {
|
||||
PContact contact = curr->data;
|
||||
if (strcmp(p_contact_subscription(contact), "none") != 0) {
|
||||
window_show_contact(console, contact);
|
||||
win_show_contact(console, contact);
|
||||
}
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
@ -1222,47 +1222,47 @@ cons_show_contacts(GSList *list)
|
||||
static void
|
||||
_cons_splash_logo(void)
|
||||
{
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "Welcome to\n");
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_SPLASH);
|
||||
wprintw(console->win, " ___ _ \n");
|
||||
wattroff(console->win, COLOUR_SPLASH);
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_SPLASH);
|
||||
wprintw(console->win, " / __) (_)_ \n");
|
||||
wattroff(console->win, COLOUR_SPLASH);
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_SPLASH);
|
||||
wprintw(console->win, " ____ ____ ___ | |__ ____ ____ _| |_ _ _ \n");
|
||||
wattroff(console->win, COLOUR_SPLASH);
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_SPLASH);
|
||||
wprintw(console->win, "| _ \\ / ___) _ \\| __) _ | _ \\| | _) | | |\n");
|
||||
wattroff(console->win, COLOUR_SPLASH);
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_SPLASH);
|
||||
wprintw(console->win, "| | | | | | |_| | | ( ( | | | | | | |_| |_| |\n");
|
||||
wattroff(console->win, COLOUR_SPLASH);
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_SPLASH);
|
||||
wprintw(console->win, "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |\n");
|
||||
wattroff(console->win, COLOUR_SPLASH);
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wattron(console->win, COLOUR_SPLASH);
|
||||
wprintw(console->win, "|_| (____/ \n");
|
||||
wattroff(console->win, COLOUR_SPLASH);
|
||||
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
wprintw(console->win, "\n");
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
if (strcmp(PACKAGE_STATUS, "development") == 0) {
|
||||
wprintw(console->win, "Version %sdev\n", PACKAGE_VERSION);
|
||||
} else {
|
||||
|
@ -289,7 +289,7 @@ ui_incoming_msg(const char * const from, const char * const message,
|
||||
// no spare windows left
|
||||
if (win_index == 0) {
|
||||
if (tv_stamp == NULL) {
|
||||
window_print_time(console, '-');
|
||||
win_print_time(console, '-');
|
||||
} else {
|
||||
GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
|
||||
gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
|
||||
@ -326,7 +326,7 @@ ui_incoming_msg(const char * const from, const char * const message,
|
||||
// currently viewing chat window with sender
|
||||
if (win_index == current_index) {
|
||||
if (tv_stamp == NULL) {
|
||||
window_print_time(window, '-');
|
||||
win_print_time(window, '-');
|
||||
} else {
|
||||
GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
|
||||
gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
|
||||
@ -365,7 +365,7 @@ ui_incoming_msg(const char * const from, const char * const message,
|
||||
}
|
||||
|
||||
if (tv_stamp == NULL) {
|
||||
window_print_time(window, '-');
|
||||
win_print_time(window, '-');
|
||||
} else {
|
||||
GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
|
||||
gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
|
||||
@ -459,7 +459,7 @@ ui_disconnected(void)
|
||||
for (i = 1; i < NUM_WINS; i++) {
|
||||
if (windows[i] != NULL) {
|
||||
ProfWin *window = windows[i];
|
||||
window_print_time(window, '-');
|
||||
win_print_time(window, '-');
|
||||
wattron(window->win, COLOUR_ERROR);
|
||||
wprintw(window->win, "%s\n", "Lost connection.");
|
||||
wattroff(window->win, COLOUR_ERROR);
|
||||
@ -522,7 +522,7 @@ ui_clear_current(void)
|
||||
void
|
||||
ui_close_current(void)
|
||||
{
|
||||
window_free(current);
|
||||
win_free(current);
|
||||
windows[current_index] = NULL;
|
||||
|
||||
// set it as inactive in the status bar
|
||||
@ -555,7 +555,7 @@ ui_current_print_line(const char * const msg, ...)
|
||||
va_start(arg, msg);
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, msg, arg);
|
||||
window_print_time(current, '-');
|
||||
win_print_time(current, '-');
|
||||
wprintw(current->win, "%s\n", fmt_msg->str);
|
||||
g_string_free(fmt_msg, TRUE);
|
||||
va_end(arg);
|
||||
@ -566,7 +566,7 @@ ui_current_print_line(const char * const msg, ...)
|
||||
void
|
||||
ui_current_error_line(const char * const msg)
|
||||
{
|
||||
window_print_time(current, '-');
|
||||
win_print_time(current, '-');
|
||||
wattron(current->win, COLOUR_ERROR);
|
||||
wprintw(current->win, "%s\n", msg);
|
||||
wattroff(current->win, COLOUR_ERROR);
|
||||
@ -606,7 +606,7 @@ ui_print_error_from_recipient(const char * const from, const char *err_msg)
|
||||
// chat window exists
|
||||
if (win_index < NUM_WINS) {
|
||||
window = windows[win_index];
|
||||
window_print_time(window, '-');
|
||||
win_print_time(window, '-');
|
||||
_win_show_error_msg(window->win, err_msg);
|
||||
if (win_index == current_index) {
|
||||
dirty = TRUE;
|
||||
@ -636,7 +636,7 @@ ui_print_system_msg_from_recipient(const char * const from, const char *message)
|
||||
}
|
||||
window = windows[win_index];
|
||||
|
||||
window_print_time(window, '-');
|
||||
win_print_time(window, '-');
|
||||
wprintw(window->win, "*%s %s\n", bare_jid, message);
|
||||
|
||||
// this is the current window
|
||||
@ -658,7 +658,7 @@ ui_recipient_gone(const char * const from)
|
||||
// chat window exists
|
||||
if (win_index < NUM_WINS) {
|
||||
window = windows[win_index];
|
||||
window_print_time(window, '-');
|
||||
win_print_time(window, '-');
|
||||
wattron(window->win, COLOUR_GONE);
|
||||
wprintw(window->win, "*%s ", from);
|
||||
wprintw(window->win, "has left the conversation.");
|
||||
@ -752,7 +752,7 @@ ui_outgoing_msg(const char * const from, const char * const to,
|
||||
window = windows[win_index];
|
||||
}
|
||||
|
||||
window_print_time(window, '-');
|
||||
win_print_time(window, '-');
|
||||
if (strncmp(message, "/me ", 4) == 0) {
|
||||
wattron(window->win, COLOUR_ME);
|
||||
wprintw(window->win, "*%s ", from);
|
||||
@ -785,7 +785,7 @@ ui_room_roster(const char * const room, GList *roster, const char * const presen
|
||||
int win_index = _find_prof_win_index(room);
|
||||
ProfWin *window = windows[win_index];
|
||||
|
||||
window_print_time(window, '!');
|
||||
win_print_time(window, '!');
|
||||
if ((roster == NULL) || (g_list_length(roster) == 0)) {
|
||||
wattron(window->win, COLOUR_ROOMINFO);
|
||||
if (presence == NULL) {
|
||||
@ -809,9 +809,9 @@ ui_room_roster(const char * const room, GList *roster, const char * const presen
|
||||
const char const *nick = p_contact_barejid(member);
|
||||
const char const *show = p_contact_presence(member);
|
||||
|
||||
window_presence_colour_on(window, show);
|
||||
win_presence_colour_on(window, show);
|
||||
wprintw(window->win, "%s", nick);
|
||||
window_presence_colour_off(window, show);
|
||||
win_presence_colour_off(window, show);
|
||||
|
||||
if (roster->next != NULL) {
|
||||
wprintw(window->win, ", ");
|
||||
@ -834,7 +834,7 @@ 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];
|
||||
|
||||
window_print_time(window, '!');
|
||||
win_print_time(window, '!');
|
||||
wattron(window->win, COLOUR_OFFLINE);
|
||||
wprintw(window->win, "<- %s has left the room.\n", nick);
|
||||
wattroff(window->win, COLOUR_OFFLINE);
|
||||
@ -850,7 +850,7 @@ ui_room_member_online(const char * const room, const char * const nick,
|
||||
int win_index = _find_prof_win_index(room);
|
||||
ProfWin *window = windows[win_index];
|
||||
|
||||
window_print_time(window, '!');
|
||||
win_print_time(window, '!');
|
||||
wattron(window->win, COLOUR_ONLINE);
|
||||
wprintw(window->win, "-> %s has joined the room.\n", nick);
|
||||
wattroff(window->win, COLOUR_ONLINE);
|
||||
@ -880,7 +880,7 @@ ui_room_member_nick_change(const char * const room,
|
||||
int win_index = _find_prof_win_index(room);
|
||||
ProfWin *window = windows[win_index];
|
||||
|
||||
window_print_time(window, '!');
|
||||
win_print_time(window, '!');
|
||||
wattron(window->win, COLOUR_THEM);
|
||||
wprintw(window->win, "** %s is now known as %s\n", old_nick, nick);
|
||||
wattroff(window->win, COLOUR_THEM);
|
||||
@ -895,7 +895,7 @@ 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];
|
||||
|
||||
window_print_time(window, '!');
|
||||
win_print_time(window, '!');
|
||||
wattron(window->win, COLOUR_ME);
|
||||
wprintw(window->win, "** You are now known as %s\n", nick);
|
||||
wattroff(window->win, COLOUR_ME);
|
||||
@ -937,7 +937,7 @@ ui_room_message(const char * const room_jid, const char * const nick,
|
||||
int win_index = _find_prof_win_index(room_jid);
|
||||
ProfWin *window = windows[win_index];
|
||||
|
||||
window_print_time(window, '-');
|
||||
win_print_time(window, '-');
|
||||
if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
|
||||
if (strncmp(message, "/me ", 4) == 0) {
|
||||
wattron(window->win, COLOUR_THEM);
|
||||
@ -1001,7 +1001,7 @@ 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];
|
||||
|
||||
window_print_time(window, '!');
|
||||
win_print_time(window, '!');
|
||||
wattron(window->win, COLOUR_ROOMINFO);
|
||||
wprintw(window->win, "Room subject: ");
|
||||
wattroff(window->win, COLOUR_ROOMINFO);
|
||||
@ -1024,7 +1024,7 @@ 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];
|
||||
|
||||
window_print_time(window, '!');
|
||||
win_print_time(window, '!');
|
||||
wattron(window->win, COLOUR_ROOMINFO);
|
||||
wprintw(window->win, "Room message: ");
|
||||
wattroff(window->win, COLOUR_ROOMINFO);
|
||||
@ -1048,7 +1048,7 @@ ui_status(void)
|
||||
PContact pcontact = contact_list_get_contact(recipient);
|
||||
|
||||
if (pcontact != NULL) {
|
||||
window_show_contact(current, pcontact);
|
||||
win_show_contact(current, pcontact);
|
||||
} else {
|
||||
ui_current_print_line("Error getting contact info.");
|
||||
}
|
||||
@ -1062,7 +1062,7 @@ ui_status_private(void)
|
||||
PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||
|
||||
if (pcontact != NULL) {
|
||||
window_show_contact(current, pcontact);
|
||||
win_show_contact(current, pcontact);
|
||||
} else {
|
||||
ui_current_print_line("Error getting contact info.");
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ ui_status_room(const char * const contact)
|
||||
PContact pcontact = muc_get_participant(ui_current_recipient(), contact);
|
||||
|
||||
if (pcontact != NULL) {
|
||||
window_show_contact(current, pcontact);
|
||||
win_show_contact(current, pcontact);
|
||||
} else {
|
||||
ui_current_print_line("No such participant \"%s\" in room.", contact);
|
||||
}
|
||||
@ -1242,7 +1242,7 @@ _new_prof_win(const char * const contact, win_type_t type)
|
||||
|
||||
if (i != NUM_WINS) {
|
||||
int cols = getmaxx(stdscr);
|
||||
windows[i] = window_create(contact, cols, type);
|
||||
windows[i] = win_create(contact, cols, type);
|
||||
return i;
|
||||
} else {
|
||||
return 0;
|
||||
@ -1318,7 +1318,7 @@ _show_status_string(ProfWin *window, const char * const from,
|
||||
if (!prefs_get_boolean(PREF_STATUSES))
|
||||
return;
|
||||
|
||||
window_print_time(window, '-');
|
||||
win_print_time(window, '-');
|
||||
|
||||
if (show != NULL) {
|
||||
if (strcmp(show, "away") == 0) {
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define CONS_WIN_TITLE "_cons"
|
||||
|
||||
ProfWin*
|
||||
window_create(const char * const title, int cols, win_type_t type)
|
||||
win_create(const char * const title, int cols, win_type_t type)
|
||||
{
|
||||
ProfWin *new_win = malloc(sizeof(struct prof_win_t));
|
||||
new_win->from = strdup(title);
|
||||
@ -55,7 +55,7 @@ window_create(const char * const title, int cols, win_type_t type)
|
||||
}
|
||||
|
||||
void
|
||||
window_free(ProfWin* window)
|
||||
win_free(ProfWin* window)
|
||||
{
|
||||
delwin(window->win);
|
||||
free(window->from);
|
||||
@ -66,7 +66,7 @@ window_free(ProfWin* window)
|
||||
}
|
||||
|
||||
void
|
||||
window_print_time(ProfWin* window, char show_char)
|
||||
win_print_time(ProfWin* window, char show_char)
|
||||
{
|
||||
GDateTime *time = g_date_time_new_now_local();
|
||||
gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
|
||||
@ -78,7 +78,7 @@ window_print_time(ProfWin* window, char show_char)
|
||||
}
|
||||
|
||||
void
|
||||
window_presence_colour_on(ProfWin *window, const char * const presence)
|
||||
win_presence_colour_on(ProfWin *window, const char * const presence)
|
||||
{
|
||||
if (g_strcmp0(presence, "online") == 0) {
|
||||
wattron(window->win, COLOUR_ONLINE);
|
||||
@ -96,7 +96,7 @@ window_presence_colour_on(ProfWin *window, const char * const presence)
|
||||
}
|
||||
|
||||
void
|
||||
window_presence_colour_off(ProfWin *window, const char * const presence)
|
||||
win_presence_colour_off(ProfWin *window, const char * const presence)
|
||||
{
|
||||
if (g_strcmp0(presence, "online") == 0) {
|
||||
wattroff(window->win, COLOUR_ONLINE);
|
||||
@ -114,7 +114,7 @@ window_presence_colour_off(ProfWin *window, const char * const presence)
|
||||
}
|
||||
|
||||
void
|
||||
window_show_contact(ProfWin *window, PContact contact)
|
||||
win_show_contact(ProfWin *window, PContact contact)
|
||||
{
|
||||
const char *barejid = p_contact_barejid(contact);
|
||||
const char *name = p_contact_name(contact);
|
||||
@ -122,8 +122,8 @@ window_show_contact(ProfWin *window, PContact contact)
|
||||
const char *status = p_contact_status(contact);
|
||||
GDateTime *last_activity = p_contact_last_activity(contact);
|
||||
|
||||
window_print_time(window, '-');
|
||||
window_presence_colour_on(window, presence);
|
||||
win_print_time(window, '-');
|
||||
win_presence_colour_on(window, presence);
|
||||
wprintw(window->win, "%s", barejid);
|
||||
|
||||
if (name != NULL) {
|
||||
@ -157,5 +157,5 @@ window_show_contact(ProfWin *window, PContact contact)
|
||||
}
|
||||
|
||||
wprintw(window->win, "\n");
|
||||
window_presence_colour_off(window, presence);
|
||||
win_presence_colour_off(window, presence);
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ typedef struct prof_win_t {
|
||||
int history_shown;
|
||||
} ProfWin;
|
||||
|
||||
ProfWin* window_create(const char * const title, int cols, win_type_t type);
|
||||
void window_free(ProfWin *window);
|
||||
ProfWin* win_create(const char * const title, int cols, win_type_t type);
|
||||
void win_free(ProfWin *window);
|
||||
|
||||
void window_print_time(ProfWin *window, char show_char);
|
||||
void window_presence_colour_on(ProfWin *window, const char * const presence);
|
||||
void window_presence_colour_off(ProfWin *window, const char * const presence);
|
||||
void window_show_contact(ProfWin *window, PContact contact);
|
||||
void win_print_time(ProfWin *window, char show_char);
|
||||
void win_presence_colour_on(ProfWin *window, const char * const presence);
|
||||
void win_presence_colour_off(ProfWin *window, const char * const presence);
|
||||
void win_show_contact(ProfWin *window, PContact contact);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user