mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 22:46:21 +00:00
OO style for ProfWin type
This commit is contained in:
@@ -280,7 +280,7 @@ ui_incoming_msg(const char * const from, const char * const message,
|
||||
// currently viewing chat window with sender
|
||||
if (wins_is_current(window)) {
|
||||
if (tv_stamp == NULL) {
|
||||
win_print_time(window, '-');
|
||||
window->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");
|
||||
@@ -319,13 +319,13 @@ ui_incoming_msg(const char * const from, const char * const message,
|
||||
}
|
||||
|
||||
if (tv_stamp == NULL) {
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
} else {
|
||||
// show users status first, when receiving message via delayed delivery
|
||||
if (win_created) {
|
||||
PContact pcontact = roster_get_contact(from);
|
||||
if (pcontact != NULL) {
|
||||
win_show_contact(window, pcontact);
|
||||
window->show_contact(window, pcontact);
|
||||
}
|
||||
}
|
||||
GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
|
||||
@@ -826,7 +826,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);
|
||||
win_print_time(current, '-');
|
||||
current->print_time(current, '-');
|
||||
wprintw(current->win, "%s\n", fmt_msg->str);
|
||||
g_string_free(fmt_msg, TRUE);
|
||||
va_end(arg);
|
||||
@@ -838,7 +838,7 @@ void
|
||||
ui_current_error_line(const char * const msg)
|
||||
{
|
||||
ProfWin *current = wins_get_current();
|
||||
win_print_time(current, '-');
|
||||
current->print_time(current, '-');
|
||||
wattron(current->win, COLOUR_ERROR);
|
||||
wprintw(current->win, "%s\n", msg);
|
||||
wattroff(current->win, COLOUR_ERROR);
|
||||
@@ -872,7 +872,7 @@ ui_print_error_from_recipient(const char * const from, const char *err_msg)
|
||||
|
||||
ProfWin *window = wins_get_by_recipient(from);
|
||||
if (window != NULL) {
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
_win_show_error_msg(window->win, err_msg);
|
||||
if (wins_is_current(window)) {
|
||||
wins_refresh_current();
|
||||
@@ -906,7 +906,7 @@ ui_print_system_msg_from_recipient(const char * const from, const char *message)
|
||||
}
|
||||
}
|
||||
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
wprintw(window->win, "*%s %s\n", bare_jid, message);
|
||||
|
||||
// this is the current window
|
||||
@@ -931,7 +931,7 @@ ui_recipient_gone(const char * const barejid)
|
||||
|
||||
ProfWin *window = wins_get_by_recipient(barejid);
|
||||
if (window != NULL) {
|
||||
win_print_time(window, '!');
|
||||
window->print_time(window, '!');
|
||||
wattron(window->win, COLOUR_GONE);
|
||||
wprintw(window->win, "<- %s ", display_usr);
|
||||
wprintw(window->win, "has left the conversation.");
|
||||
@@ -988,7 +988,7 @@ ui_create_duck_win(void)
|
||||
ProfWin *window = wins_new("DuckDuckGo search", WIN_DUCK);
|
||||
int num = wins_get_num(window);
|
||||
ui_switch_win(num);
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
wprintw(window->win, "Type ':help' to find out more.\n");
|
||||
}
|
||||
|
||||
@@ -1007,9 +1007,9 @@ ui_duck(const char * const query)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient("DuckDuckGo search");
|
||||
if (window != NULL) {
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
wprintw(window->win, "\n");
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
wattron(window->win, COLOUR_ME);
|
||||
wprintw(window->win, "Query : ");
|
||||
wattroff(window->win, COLOUR_ME);
|
||||
@@ -1024,7 +1024,7 @@ ui_duck_result(const char * const result)
|
||||
ProfWin *window = wins_get_by_recipient("DuckDuckGo search");
|
||||
|
||||
if (window != NULL) {
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
wattron(window->win, COLOUR_THEM);
|
||||
wprintw(window->win, "Result : ");
|
||||
wattroff(window->win, COLOUR_THEM);
|
||||
@@ -1035,7 +1035,7 @@ ui_duck_result(const char * const result)
|
||||
gunichar unichar = g_utf8_get_char(ptr);
|
||||
if (unichar == '\n') {
|
||||
wprintw(window->win, "\n");
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
} else {
|
||||
gchar *string = g_ucs4_to_utf8(&unichar, 1, NULL, NULL, NULL);
|
||||
if (string != NULL) {
|
||||
@@ -1089,7 +1089,7 @@ ui_outgoing_msg(const char * const from, const char * const to,
|
||||
num = wins_get_num(window);
|
||||
}
|
||||
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
if (strncmp(message, "/me ", 4) == 0) {
|
||||
wattron(window->win, COLOUR_ME);
|
||||
wprintw(window->win, "*%s ", from);
|
||||
@@ -1123,7 +1123,7 @@ ui_room_roster(const char * const room, GList *roster, const char * const presen
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
|
||||
win_print_time(window, '!');
|
||||
window->print_time(window, '!');
|
||||
if ((roster == NULL) || (g_list_length(roster) == 0)) {
|
||||
wattron(window->win, COLOUR_ROOMINFO);
|
||||
if (presence == NULL) {
|
||||
@@ -1153,9 +1153,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);
|
||||
|
||||
win_presence_colour_on(window, show);
|
||||
window->presence_colour_on(window, show);
|
||||
wprintw(window->win, "%s", nick);
|
||||
win_presence_colour_off(window, show);
|
||||
window->presence_colour_off(window, show);
|
||||
|
||||
if (roster->next != NULL) {
|
||||
wprintw(window->win, ", ");
|
||||
@@ -1178,7 +1178,7 @@ ui_room_member_offline(const char * const room, const char * const nick)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
|
||||
win_print_time(window, '!');
|
||||
window->print_time(window, '!');
|
||||
wattron(window->win, COLOUR_OFFLINE);
|
||||
wprintw(window->win, "<- %s has left the room.\n", nick);
|
||||
wattroff(window->win, COLOUR_OFFLINE);
|
||||
@@ -1194,7 +1194,7 @@ ui_room_member_online(const char * const room, const char * const nick,
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
|
||||
win_print_time(window, '!');
|
||||
window->print_time(window, '!');
|
||||
wattron(window->win, COLOUR_ONLINE);
|
||||
wprintw(window->win, "-> %s has joined the room.\n", nick);
|
||||
wattroff(window->win, COLOUR_ONLINE);
|
||||
@@ -1225,7 +1225,7 @@ ui_room_member_nick_change(const char * const room,
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
|
||||
win_print_time(window, '!');
|
||||
window->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);
|
||||
@@ -1240,7 +1240,7 @@ ui_room_nick_change(const char * const room, const char * const nick)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
|
||||
win_print_time(window, '!');
|
||||
window->print_time(window, '!');
|
||||
wattron(window->win, COLOUR_ME);
|
||||
wprintw(window->win, "** You are now known as %s\n", nick);
|
||||
wattroff(window->win, COLOUR_ME);
|
||||
@@ -1283,7 +1283,7 @@ ui_room_message(const char * const room_jid, const char * const nick,
|
||||
ProfWin *window = wins_get_by_recipient(room_jid);
|
||||
int num = wins_get_num(window);
|
||||
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
|
||||
if (strncmp(message, "/me ", 4) == 0) {
|
||||
wattron(window->win, COLOUR_THEM);
|
||||
@@ -1354,7 +1354,7 @@ ui_room_subject(const char * const room_jid, const char * const subject)
|
||||
ProfWin *window = wins_get_by_recipient(room_jid);
|
||||
int num = wins_get_num(window);
|
||||
|
||||
win_print_time(window, '!');
|
||||
window->print_time(window, '!');
|
||||
wattron(window->win, COLOUR_ROOMINFO);
|
||||
wprintw(window->win, "Room subject: ");
|
||||
wattroff(window->win, COLOUR_ROOMINFO);
|
||||
@@ -1377,7 +1377,7 @@ ui_room_broadcast(const char * const room_jid, const char * const message)
|
||||
ProfWin *window = wins_get_by_recipient(room_jid);
|
||||
int num = wins_get_num(window);
|
||||
|
||||
win_print_time(window, '!');
|
||||
window->print_time(window, '!');
|
||||
wattron(window->win, COLOUR_ROOMINFO);
|
||||
wprintw(window->win, "Room message: ");
|
||||
wattroff(window->win, COLOUR_ROOMINFO);
|
||||
@@ -1402,7 +1402,7 @@ ui_status(void)
|
||||
ProfWin *current = wins_get_current();
|
||||
|
||||
if (pcontact != NULL) {
|
||||
win_show_contact(current, pcontact);
|
||||
current->show_contact(current, pcontact);
|
||||
} else {
|
||||
ui_current_print_line("Error getting contact info.");
|
||||
}
|
||||
@@ -1416,7 +1416,7 @@ ui_status_private(void)
|
||||
ProfWin *current = wins_get_current();
|
||||
|
||||
if (pcontact != NULL) {
|
||||
win_show_contact(current, pcontact);
|
||||
current->show_contact(current, pcontact);
|
||||
} else {
|
||||
ui_current_print_line("Error getting contact info.");
|
||||
}
|
||||
@@ -1431,7 +1431,7 @@ ui_status_room(const char * const contact)
|
||||
ProfWin *current = wins_get_current();
|
||||
|
||||
if (pcontact != NULL) {
|
||||
win_show_contact(current, pcontact);
|
||||
current->show_contact(current, pcontact);
|
||||
} else {
|
||||
ui_current_print_line("No such participant \"%s\" in room.", contact);
|
||||
}
|
||||
@@ -1543,7 +1543,7 @@ _show_status_string(ProfWin *window, const char * const from,
|
||||
if (!prefs_get_boolean(PREF_STATUSES))
|
||||
return;
|
||||
|
||||
win_print_time(window, '-');
|
||||
window->print_time(window, '-');
|
||||
|
||||
if (show != NULL) {
|
||||
if (strcmp(show, "away") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user