1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

Use class instead of base pointer

This commit is contained in:
James Booth 2014-12-21 19:40:15 +00:00
parent 13f73a30e7
commit 9a322a028f
6 changed files with 187 additions and 171 deletions

View File

@ -1605,11 +1605,12 @@ cmd_status(gchar **args, struct cmd_help_t help)
case WIN_MUC: case WIN_MUC:
if (usr != NULL) { if (usr != NULL) {
ProfMucWin *mucwin = wins_get_current_muc(); ProfMucWin *mucwin = wins_get_current_muc();
ProfWin *window = (ProfWin*) mucwin;
Occupant *occupant = muc_roster_item(mucwin->roomjid, usr); Occupant *occupant = muc_roster_item(mucwin->roomjid, usr);
if (occupant) { if (occupant) {
win_show_occupant(&mucwin->super, occupant); win_show_occupant(window, occupant);
} else { } else {
win_save_vprint(&mucwin->super, '-', NULL, 0, 0, "", "No such participant \"%s\" in room.", usr); win_save_vprint(window, '-', NULL, 0, 0, "", "No such participant \"%s\" in room.", usr);
} }
} else { } else {
ui_current_print_line("You must specify a nickname."); ui_current_print_line("You must specify a nickname.");
@ -1620,11 +1621,12 @@ cmd_status(gchar **args, struct cmd_help_t help)
ui_current_print_line("No parameter required when in chat."); ui_current_print_line("No parameter required when in chat.");
} else { } else {
ProfChatWin *chatwin = wins_get_current_chat(); ProfChatWin *chatwin = wins_get_current_chat();
ProfWin *window = (ProfWin*) chatwin;
PContact pcontact = roster_get_contact(chatwin->barejid); PContact pcontact = roster_get_contact(chatwin->barejid);
if (pcontact != NULL) { if (pcontact != NULL) {
win_show_contact(&chatwin->super, pcontact); win_show_contact(window, pcontact);
} else { } else {
win_save_println(&chatwin->super, "Error getting contact info."); win_save_println(window, "Error getting contact info.");
} }
} }
break; break;
@ -1633,12 +1635,13 @@ cmd_status(gchar **args, struct cmd_help_t help)
ui_current_print_line("No parameter required when in chat."); ui_current_print_line("No parameter required when in chat.");
} else { } else {
ProfPrivateWin *privatewin = wins_get_current_private(); ProfPrivateWin *privatewin = wins_get_current_private();
ProfWin *window = (ProfWin*) privatewin;
Jid *jid = jid_create(privatewin->fulljid); Jid *jid = jid_create(privatewin->fulljid);
Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart); Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart);
if (occupant) { if (occupant) {
win_show_occupant(&privatewin->super, occupant); win_show_occupant(window, occupant);
} else { } else {
win_save_println(&privatewin->super, "Error getting contact info."); win_save_println(window, "Error getting contact info.");
} }
jid_destroy(jid); jid_destroy(jid);
} }
@ -1700,11 +1703,12 @@ cmd_info(gchar **args, struct cmd_help_t help)
ui_current_print_line("No parameter required when in chat."); ui_current_print_line("No parameter required when in chat.");
} else { } else {
ProfChatWin *chatwin = wins_get_current_chat(); ProfChatWin *chatwin = wins_get_current_chat();
ProfWin *window = (ProfWin*) chatwin;
PContact pcontact = roster_get_contact(chatwin->barejid); PContact pcontact = roster_get_contact(chatwin->barejid);
if (pcontact != NULL) { if (pcontact != NULL) {
win_show_info(&chatwin->super, pcontact); win_show_info(window, pcontact);
} else { } else {
win_save_println(&chatwin->super, "Error getting contact info."); win_save_println(window, "Error getting contact info.");
} }
} }
break; break;
@ -1713,12 +1717,13 @@ cmd_info(gchar **args, struct cmd_help_t help)
ui_current_print_line("No parameter required when in chat."); ui_current_print_line("No parameter required when in chat.");
} else { } else {
ProfPrivateWin *privatewin = wins_get_current_private(); ProfPrivateWin *privatewin = wins_get_current_private();
ProfWin *window = (ProfWin*) privatewin;
Jid *jid = jid_create(privatewin->fulljid); Jid *jid = jid_create(privatewin->fulljid);
Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart); Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart);
if (occupant) { if (occupant) {
win_show_occupant_info(&privatewin->super, jid->barejid, occupant); win_show_occupant_info(window, jid->barejid, occupant);
} else { } else {
win_save_println(&privatewin->super, "Error getting contact info."); win_save_println(window, "Error getting contact info.");
} }
jid_destroy(jid); jid_destroy(jid);
} }
@ -2278,7 +2283,7 @@ cmd_form(gchar **args, struct cmd_help_t help)
help_text = command->help.long_help; help_text = command->help.long_help;
} }
ui_show_lines(&confwin->super, help_text); ui_show_lines((ProfWin*) confwin, help_text);
} }
ui_current_print_line(""); ui_current_print_line("");
return TRUE; return TRUE;
@ -2338,7 +2343,7 @@ cmd_kick(gchar **args, struct cmd_help_t help)
char *reason = args[1]; char *reason = args[1];
iq_room_kick_occupant(mucwin->roomjid, nick, reason); iq_room_kick_occupant(mucwin->roomjid, nick, reason);
} else { } else {
win_save_vprint(&mucwin->super, '!', NULL, 0, 0, "", "Occupant does not exist: %s", nick); win_save_vprint((ProfWin*) mucwin, '!', NULL, 0, 0, "", "Occupant does not exist: %s", nick);
} }
} else { } else {
cons_show("Usage: %s", help.usage); cons_show("Usage: %s", help.usage);
@ -2392,14 +2397,15 @@ cmd_subject(gchar **args, struct cmd_help_t help)
} }
ProfMucWin *mucwin = wins_get_current_muc(); ProfMucWin *mucwin = wins_get_current_muc();
ProfWin *window = (ProfWin*) mucwin;
if (args[0] == NULL) { if (args[0] == NULL) {
char *subject = muc_subject(mucwin->roomjid); char *subject = muc_subject(mucwin->roomjid);
if (subject) { if (subject) {
win_save_vprint(&mucwin->super, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: "); win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: ");
win_save_vprint(&mucwin->super, '!', NULL, NO_DATE, 0, "", "%s", subject); win_save_vprint(window, '!', NULL, NO_DATE, 0, "", "%s", subject);
} else { } else {
win_save_print(&mucwin->super, '!', NULL, 0, THEME_ROOMINFO, "", "Room has no subject"); win_save_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room has no subject");
} }
return TRUE; return TRUE;
} }
@ -2464,7 +2470,7 @@ cmd_affiliation(gchar **args, struct cmd_help_t help)
iq_room_affiliation_list(mucwin->roomjid, "member"); iq_room_affiliation_list(mucwin->roomjid, "member");
iq_room_affiliation_list(mucwin->roomjid, "outcast"); iq_room_affiliation_list(mucwin->roomjid, "outcast");
} else if (g_strcmp0(affiliation, "none") == 0) { } else if (g_strcmp0(affiliation, "none") == 0) {
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "Cannot list users with no affiliation."); win_save_print((ProfWin*) mucwin, '!', NULL, 0, 0, "", "Cannot list users with no affiliation.");
} else { } else {
iq_room_affiliation_list(mucwin->roomjid, affiliation); iq_room_affiliation_list(mucwin->roomjid, affiliation);
} }
@ -2532,7 +2538,7 @@ cmd_role(gchar **args, struct cmd_help_t help)
iq_room_role_list(mucwin->roomjid, "participant"); iq_room_role_list(mucwin->roomjid, "participant");
iq_room_role_list(mucwin->roomjid, "visitor"); iq_room_role_list(mucwin->roomjid, "visitor");
} else if (g_strcmp0(role, "none") == 0) { } else if (g_strcmp0(role, "none") == 0) {
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "Cannot list users with no role."); win_save_print((ProfWin*) mucwin, '!', NULL, 0, 0, "", "Cannot list users with no role.");
} else { } else {
iq_room_role_list(mucwin->roomjid, role); iq_room_role_list(mucwin->roomjid, role);
} }
@ -2584,7 +2590,8 @@ cmd_room(gchar **args, struct cmd_help_t help)
} }
ProfMucWin *mucwin = wins_get_current_muc(); ProfMucWin *mucwin = wins_get_current_muc();
int num = wins_get_num(&mucwin->super); ProfWin *window = (ProfWin*) mucwin;
int num = wins_get_num(window);
int ui_index = num; int ui_index = num;
if (ui_index == 10) { if (ui_index == 10) {
@ -2594,12 +2601,12 @@ cmd_room(gchar **args, struct cmd_help_t help)
if (g_strcmp0(args[0], "accept") == 0) { if (g_strcmp0(args[0], "accept") == 0) {
gboolean requires_config = muc_requires_config(mucwin->roomjid); gboolean requires_config = muc_requires_config(mucwin->roomjid);
if (!requires_config) { if (!requires_config) {
win_save_print(&mucwin->super, '!', NULL, 0, THEME_ROOMINFO, "", "Current room does not require configuration."); win_save_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Current room does not require configuration.");
return TRUE; return TRUE;
} else { } else {
iq_confirm_instant_room(mucwin->roomjid); iq_confirm_instant_room(mucwin->roomjid);
muc_set_requires_config(mucwin->roomjid, FALSE); muc_set_requires_config(mucwin->roomjid, FALSE);
win_save_print(&mucwin->super, '!', NULL, 0, THEME_ROOMINFO, "", "Room unlocked."); win_save_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room unlocked.");
return TRUE; return TRUE;
} }
} }
@ -2616,7 +2623,7 @@ cmd_room(gchar **args, struct cmd_help_t help)
g_string_free(win_title, TRUE); g_string_free(win_title, TRUE);
if (confwin != NULL) { if (confwin != NULL) {
num = wins_get_num(&confwin->super); num = wins_get_num(window);
ui_switch_win(num); ui_switch_win(num);
} else { } else {
iq_request_room_config_form(mucwin->roomjid); iq_request_room_config_form(mucwin->roomjid);

View File

@ -270,6 +270,7 @@ static void
_ui_contact_typing(const char * const barejid) _ui_contact_typing(const char * const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
ProfWin *window = (ProfWin*) chatwin;
if (prefs_get_boolean(PREF_INTYPE)) { if (prefs_get_boolean(PREF_INTYPE)) {
// no chat window for user // no chat window for user
@ -277,22 +278,22 @@ _ui_contact_typing(const char * const barejid)
cons_show_typing(barejid); cons_show_typing(barejid);
// have chat window but not currently in it // have chat window but not currently in it
} else if (!wins_is_current(&chatwin->super)) { } else if (!wins_is_current(window)) {
cons_show_typing(barejid); cons_show_typing(barejid);
// in chat window with user // in chat window with user
} else { } else {
title_bar_set_typing(TRUE); title_bar_set_typing(TRUE);
int num = wins_get_num(&chatwin->super); int num = wins_get_num(window);
status_bar_active(num); status_bar_active(num);
} }
} }
if (prefs_get_boolean(PREF_NOTIFY_TYPING)) { if (prefs_get_boolean(PREF_NOTIFY_TYPING)) {
gboolean is_current = FALSE; gboolean is_current = FALSE;
if (&chatwin->super != NULL) { if (window) {
is_current = wins_is_current(&chatwin->super); is_current = wins_is_current(window);
} }
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_TYPING_CURRENT)) ) { if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_TYPING_CURRENT)) ) {
PContact contact = roster_get_contact(barejid); PContact contact = roster_get_contact(barejid);
@ -349,11 +350,13 @@ _ui_incoming_msg(const char * const barejid, const char * const message, GTimeVa
win_created = TRUE; win_created = TRUE;
} }
int num = wins_get_num(&chatwin->super); ProfWin *window = (ProfWin*) chatwin;
int num = wins_get_num(window);
// currently viewing chat window with sender // currently viewing chat window with sender
if (wins_is_current(&chatwin->super)) { if (wins_is_current(window)) {
win_print_incoming_message(&chatwin->super, tv_stamp, display_from, message); win_print_incoming_message(window, tv_stamp, display_from, message);
title_bar_set_typing(FALSE); title_bar_set_typing(FALSE);
status_bar_active(num); status_bar_active(num);
@ -366,7 +369,7 @@ _ui_incoming_msg(const char * const barejid, const char * const message, GTimeVa
flash(); flash();
} }
chatwin->super.unread++; window->unread++;
if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) { if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
_win_show_history(num, barejid); _win_show_history(num, barejid);
} }
@ -375,11 +378,11 @@ _ui_incoming_msg(const char * const barejid, const char * const message, GTimeVa
if ((tv_stamp != NULL) && (win_created)) { if ((tv_stamp != NULL) && (win_created)) {
PContact pcontact = roster_get_contact(barejid); PContact pcontact = roster_get_contact(barejid);
if (pcontact != NULL) { if (pcontact != NULL) {
win_show_contact(&chatwin->super, pcontact); win_show_contact(window, pcontact);
} }
} }
win_print_incoming_message(&chatwin->super, tv_stamp, display_from, message); win_print_incoming_message(window, tv_stamp, display_from, message);
} }
int ui_index = num; int ui_index = num;
@ -392,7 +395,7 @@ _ui_incoming_msg(const char * const barejid, const char * const message, GTimeVa
} }
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) { if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) {
gboolean is_current = wins_is_current(&chatwin->super); gboolean is_current = wins_is_current(window);
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) ) { if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) ) {
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT)) { if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT)) {
notify_message(display_from, ui_index, message); notify_message(display_from, ui_index, message);
@ -417,11 +420,12 @@ _ui_incoming_private_msg(const char * const fulljid, const char * const message,
privatewin = (ProfPrivateWin*)window; privatewin = (ProfPrivateWin*)window;
} }
int num = wins_get_num(&privatewin->super); ProfWin *window = (ProfWin*) privatewin;
int num = wins_get_num(window);
// currently viewing chat window with sender // currently viewing chat window with sender
if (wins_is_current(&privatewin->super)) { if (wins_is_current(window)) {
win_print_incoming_message(&privatewin->super, tv_stamp, display_from, message); win_print_incoming_message(window, tv_stamp, display_from, message);
title_bar_set_typing(FALSE); title_bar_set_typing(FALSE);
status_bar_active(num); status_bar_active(num);
@ -434,12 +438,12 @@ _ui_incoming_private_msg(const char * const fulljid, const char * const message,
flash(); flash();
} }
privatewin->super.unread++; window->unread++;
if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) { if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
_win_show_history(num, fulljid); _win_show_history(num, fulljid);
} }
win_print_incoming_message(&privatewin->super, tv_stamp, display_from, message); win_print_incoming_message(window, tv_stamp, display_from, message);
} }
int ui_index = num; int ui_index = num;
@ -452,7 +456,7 @@ _ui_incoming_private_msg(const char * const fulljid, const char * const message,
} }
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) { if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) {
gboolean is_current = wins_is_current(&privatewin->super); gboolean is_current = wins_is_current(window);
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) ) { if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) ) {
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT)) { if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT)) {
notify_message(display_from, ui_index, message); notify_message(display_from, ui_index, message);
@ -580,8 +584,7 @@ _ui_handle_recipient_not_found(const char * const recipient, const char * const
ProfChatWin *chatwin = wins_get_chat(recipient); ProfChatWin *chatwin = wins_get_chat(recipient);
if (chatwin) { if (chatwin) {
cons_show_error("Recipient %s not found: %s", recipient, err_msg); cons_show_error("Recipient %s not found: %s", recipient, err_msg);
// TODO change super references to superclass cast win_save_vprint((ProfWin*) chatwin, '!', NULL, 0, THEME_ERROR, "", "Recipient %s not found: %s", recipient, err_msg);
win_save_vprint(&chatwin->super, '!', NULL, 0, THEME_ERROR, "", "Recipient %s not found: %s", recipient, err_msg);
return; return;
} }
@ -589,7 +592,7 @@ _ui_handle_recipient_not_found(const char * const recipient, const char * const
ProfMucWin *mucwin = wins_get_muc(recipient); ProfMucWin *mucwin = wins_get_muc(recipient);
if (mucwin) { if (mucwin) {
cons_show_error("Room %s not found: %s", recipient, err_msg); cons_show_error("Room %s not found: %s", recipient, err_msg);
win_save_vprint(&mucwin->super, '!', NULL, 0, THEME_ERROR, "", "Room %s not found: %s", recipient, err_msg); win_save_vprint((ProfWin*) mucwin, '!', NULL, 0, THEME_ERROR, "", "Room %s not found: %s", recipient, err_msg);
return; return;
} }
@ -597,7 +600,7 @@ _ui_handle_recipient_not_found(const char * const recipient, const char * const
ProfPrivateWin *privatewin = wins_get_private(recipient); ProfPrivateWin *privatewin = wins_get_private(recipient);
if (privatewin) { if (privatewin) {
cons_show_error("Recipient %s not found: %s", recipient, err_msg); cons_show_error("Recipient %s not found: %s", recipient, err_msg);
win_save_vprint(&privatewin->super, '!', NULL, 0, THEME_ERROR, "", "Recipient %s not found: %s", recipient, err_msg); win_save_vprint((ProfWin*) privatewin, '!', NULL, 0, THEME_ERROR, "", "Recipient %s not found: %s", recipient, err_msg);
return; return;
} }
@ -2342,42 +2345,44 @@ _ui_show_room_info(ProfMucWin *mucwin)
char *role = muc_role_str(mucwin->roomjid); char *role = muc_role_str(mucwin->roomjid);
char *affiliation = muc_affiliation_str(mucwin->roomjid); char *affiliation = muc_affiliation_str(mucwin->roomjid);
win_save_vprint(&mucwin->super, '!', NULL, 0, 0, "", "Room: %s", mucwin->roomjid); ProfWin *window = (ProfWin*) mucwin;
win_save_vprint(&mucwin->super, '!', NULL, 0, 0, "", "Affiliation: %s", affiliation); win_save_vprint(window, '!', NULL, 0, 0, "", "Room: %s", mucwin->roomjid);
win_save_vprint(&mucwin->super, '!', NULL, 0, 0, "", "Role: %s", role); win_save_vprint(window, '!', NULL, 0, 0, "", "Affiliation: %s", affiliation);
win_save_print(&mucwin->super, '-', NULL, 0, 0, "", ""); win_save_vprint(window, '!', NULL, 0, 0, "", "Role: %s", role);
win_save_print(window, '-', NULL, 0, 0, "", "");
} }
static void static void
_ui_show_room_role_list(ProfMucWin *mucwin, muc_role_t role) _ui_show_room_role_list(ProfMucWin *mucwin, muc_role_t role)
{ {
ProfWin *window = (ProfWin*) mucwin;
GSList *occupants = muc_occupants_by_role(mucwin->roomjid, role); GSList *occupants = muc_occupants_by_role(mucwin->roomjid, role);
if (!occupants) { if (!occupants) {
switch (role) { switch (role) {
case MUC_ROLE_MODERATOR: case MUC_ROLE_MODERATOR:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "No moderators found."); win_save_print(window, '!', NULL, 0, 0, "", "No moderators found.");
break; break;
case MUC_ROLE_PARTICIPANT: case MUC_ROLE_PARTICIPANT:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "No participants found."); win_save_print(window, '!', NULL, 0, 0, "", "No participants found.");
break; break;
case MUC_ROLE_VISITOR: case MUC_ROLE_VISITOR:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "No visitors found."); win_save_print(window, '!', NULL, 0, 0, "", "No visitors found.");
break; break;
default: default:
break; break;
} }
win_save_print(&mucwin->super, '-', NULL, 0, 0, "", ""); win_save_print(window, '-', NULL, 0, 0, "", "");
} else { } else {
switch (role) { switch (role) {
case MUC_ROLE_MODERATOR: case MUC_ROLE_MODERATOR:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "Moderators:"); win_save_print(window, '!', NULL, 0, 0, "", "Moderators:");
break; break;
case MUC_ROLE_PARTICIPANT: case MUC_ROLE_PARTICIPANT:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "Participants:"); win_save_print(window, '!', NULL, 0, 0, "", "Participants:");
break; break;
case MUC_ROLE_VISITOR: case MUC_ROLE_VISITOR:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "Visitors:"); win_save_print(window, '!', NULL, 0, 0, "", "Visitors:");
break; break;
default: default:
break; break;
@ -2388,55 +2393,56 @@ _ui_show_room_role_list(ProfMucWin *mucwin, muc_role_t role)
Occupant *occupant = curr_occupant->data; Occupant *occupant = curr_occupant->data;
if (occupant->role == role) { if (occupant->role == role) {
if (occupant->jid) { if (occupant->jid) {
win_save_vprint(&mucwin->super, '!', NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid); win_save_vprint(window, '!', NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid);
} else { } else {
win_save_vprint(&mucwin->super, '!', NULL, 0, 0, "", " %s", occupant->nick); win_save_vprint(window, '!', NULL, 0, 0, "", " %s", occupant->nick);
} }
} }
curr_occupant = g_slist_next(curr_occupant); curr_occupant = g_slist_next(curr_occupant);
} }
win_save_print(&mucwin->super, '-', NULL, 0, 0, "", ""); win_save_print(window, '-', NULL, 0, 0, "", "");
} }
} }
static void static void
_ui_show_room_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation) _ui_show_room_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation)
{ {
ProfWin *window = (ProfWin*) mucwin;
GSList *occupants = muc_occupants_by_affiliation(mucwin->roomjid, affiliation); GSList *occupants = muc_occupants_by_affiliation(mucwin->roomjid, affiliation);
if (!occupants) { if (!occupants) {
switch (affiliation) { switch (affiliation) {
case MUC_AFFILIATION_OWNER: case MUC_AFFILIATION_OWNER:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "No owners found."); win_save_print(window, '!', NULL, 0, 0, "", "No owners found.");
break; break;
case MUC_AFFILIATION_ADMIN: case MUC_AFFILIATION_ADMIN:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "No admins found."); win_save_print(window, '!', NULL, 0, 0, "", "No admins found.");
break; break;
case MUC_AFFILIATION_MEMBER: case MUC_AFFILIATION_MEMBER:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "No members found."); win_save_print(window, '!', NULL, 0, 0, "", "No members found.");
break; break;
case MUC_AFFILIATION_OUTCAST: case MUC_AFFILIATION_OUTCAST:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "No outcasts found."); win_save_print(window, '!', NULL, 0, 0, "", "No outcasts found.");
break; break;
default: default:
break; break;
} }
win_save_print(&mucwin->super, '-', NULL, 0, 0, "", ""); win_save_print(window, '-', NULL, 0, 0, "", "");
} else { } else {
switch (affiliation) { switch (affiliation) {
case MUC_AFFILIATION_OWNER: case MUC_AFFILIATION_OWNER:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "Owners:"); win_save_print(window, '!', NULL, 0, 0, "", "Owners:");
break; break;
case MUC_AFFILIATION_ADMIN: case MUC_AFFILIATION_ADMIN:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "Admins:"); win_save_print(window, '!', NULL, 0, 0, "", "Admins:");
break; break;
case MUC_AFFILIATION_MEMBER: case MUC_AFFILIATION_MEMBER:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "Members:"); win_save_print(window, '!', NULL, 0, 0, "", "Members:");
break; break;
case MUC_AFFILIATION_OUTCAST: case MUC_AFFILIATION_OUTCAST:
win_save_print(&mucwin->super, '!', NULL, 0, 0, "", "Outcasts:"); win_save_print(window, '!', NULL, 0, 0, "", "Outcasts:");
break; break;
default: default:
break; break;
@ -2447,16 +2453,16 @@ _ui_show_room_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation
Occupant *occupant = curr_occupant->data; Occupant *occupant = curr_occupant->data;
if (occupant->affiliation == affiliation) { if (occupant->affiliation == affiliation) {
if (occupant->jid) { if (occupant->jid) {
win_save_vprint(&mucwin->super, '!', NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid); win_save_vprint(window, '!', NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid);
} else { } else {
win_save_vprint(&mucwin->super, '!', NULL, 0, 0, "", " %s", occupant->nick); win_save_vprint(window, '!', NULL, 0, 0, "", " %s", occupant->nick);
} }
} }
curr_occupant = g_slist_next(curr_occupant); curr_occupant = g_slist_next(curr_occupant);
} }
win_save_print(&mucwin->super, '-', NULL, 0, 0, "", ""); win_save_print(window, '-', NULL, 0, 0, "", "");
} }
} }
@ -2594,16 +2600,17 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
static void static void
_ui_show_form(ProfMucConfWin *confwin) _ui_show_form(ProfMucConfWin *confwin)
{ {
ProfWin *window = (ProfWin*) confwin;
if (confwin->form->title != NULL) { if (confwin->form->title != NULL) {
win_save_print(&confwin->super, '-', NULL, NO_EOL, 0, "", "Form title: "); win_save_print(window, '-', NULL, NO_EOL, 0, "", "Form title: ");
win_save_print(&confwin->super, '-', NULL, NO_DATE, 0, "", confwin->form->title); win_save_print(window, '-', NULL, NO_DATE, 0, "", confwin->form->title);
} else { } else {
gchar **split_recipient = g_strsplit(confwin->from, " ", 2); gchar **split_recipient = g_strsplit(confwin->from, " ", 2);
char *roomjid = split_recipient[0]; char *roomjid = split_recipient[0];
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", "Configuration for room %s.", roomjid); win_save_vprint(window, '-', NULL, 0, 0, "", "Configuration for room %s.", roomjid);
g_strfreev(split_recipient); g_strfreev(split_recipient);
} }
win_save_print(&confwin->super, '-', NULL, 0, 0, "", ""); win_save_print(window, '-', NULL, 0, 0, "", "");
ui_show_form_help(confwin); ui_show_form_help(confwin);
@ -2615,11 +2622,11 @@ _ui_show_form(ProfMucConfWin *confwin)
if ((g_strcmp0(field->type, "fixed") == 0) && field->values) { if ((g_strcmp0(field->type, "fixed") == 0) && field->values) {
if (field->values) { if (field->values) {
char *value = field->values->data; char *value = field->values->data;
win_save_print(&confwin->super, '-', NULL, 0, 0, "", value); win_save_print(window, '-', NULL, 0, 0, "", value);
} }
} else if (g_strcmp0(field->type, "hidden") != 0 && field->var) { } else if (g_strcmp0(field->type, "hidden") != 0 && field->var) {
char *tag = g_hash_table_lookup(confwin->form->var_to_tag, field->var); char *tag = g_hash_table_lookup(confwin->form->var_to_tag, field->var);
_ui_handle_form_field(&confwin->super, tag, field); _ui_handle_form_field(window, tag, field);
} }
curr_field = g_slist_next(curr_field); curr_field = g_slist_next(curr_field);
@ -2755,18 +2762,19 @@ _ui_handle_room_config_submit_result_error(const char * const roomjid, const cha
static void static void
_ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) _ui_show_form_field_help(ProfMucConfWin *confwin, char *tag)
{ {
ProfWin *window = (ProfWin*) confwin;
FormField *field = form_get_field_by_tag(confwin->form, tag); FormField *field = form_get_field_by_tag(confwin->form, tag);
if (field != NULL) { if (field != NULL) {
win_save_print(&confwin->super, '-', NULL, NO_EOL, 0, "", field->label); win_save_print(window, '-', NULL, NO_EOL, 0, "", field->label);
if (field->required) { if (field->required) {
win_save_print(&confwin->super, '-', NULL, NO_DATE, 0, "", " (Required):"); win_save_print(window, '-', NULL, NO_DATE, 0, "", " (Required):");
} else { } else {
win_save_print(&confwin->super, '-', NULL, NO_DATE, 0, "", ":"); win_save_print(window, '-', NULL, NO_DATE, 0, "", ":");
} }
if (field->description != NULL) { if (field->description != NULL) {
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Description : %s", field->description); win_save_vprint(window, '-', NULL, 0, 0, "", " Description : %s", field->description);
} }
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Type : %s", field->type); win_save_vprint(window, '-', NULL, 0, 0, "", " Type : %s", field->type);
int num_values = 0; int num_values = 0;
GSList *curr_option = NULL; GSList *curr_option = NULL;
@ -2775,51 +2783,51 @@ _ui_show_form_field_help(ProfMucConfWin *confwin, char *tag)
switch (field->type_t) { switch (field->type_t) {
case FIELD_TEXT_SINGLE: case FIELD_TEXT_SINGLE:
case FIELD_TEXT_PRIVATE: case FIELD_TEXT_PRIVATE:
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Set : /%s <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Set : /%s <value>", tag);
win_save_print(&confwin->super, '-', NULL, 0, 0, "", " Where : <value> is any text"); win_save_print(window, '-', NULL, 0, 0, "", " Where : <value> is any text");
break; break;
case FIELD_TEXT_MULTI: case FIELD_TEXT_MULTI:
num_values = form_get_value_count(confwin->form, tag); num_values = form_get_value_count(confwin->form, tag);
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Add : /%s add <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Add : /%s add <value>", tag);
win_save_print(&confwin->super, '-', NULL, 0, 0, "", " Where : <value> is any text"); win_save_print(window, '-', NULL, 0, 0, "", " Where : <value> is any text");
if (num_values > 0) { if (num_values > 0) {
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag);
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Where : <value> between 'val1' and 'val%d'", num_values); win_save_vprint(window, '-', NULL, 0, 0, "", " Where : <value> between 'val1' and 'val%d'", num_values);
} }
break; break;
case FIELD_BOOLEAN: case FIELD_BOOLEAN:
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Set : /%s <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Set : /%s <value>", tag);
win_save_print(&confwin->super, '-', NULL, 0, 0, "", " Where : <value> is either 'on' or 'off'"); win_save_print(window, '-', NULL, 0, 0, "", " Where : <value> is either 'on' or 'off'");
break; break;
case FIELD_LIST_SINGLE: case FIELD_LIST_SINGLE:
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Set : /%s <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Set : /%s <value>", tag);
win_save_print(&confwin->super, '-', NULL, 0, 0, "", " Where : <value> is one of"); win_save_print(window, '-', NULL, 0, 0, "", " Where : <value> is one of");
curr_option = field->options; curr_option = field->options;
while (curr_option != NULL) { while (curr_option != NULL) {
option = curr_option->data; option = curr_option->data;
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " %s", option->value); win_save_vprint(window, '-', NULL, 0, 0, "", " %s", option->value);
curr_option = g_slist_next(curr_option); curr_option = g_slist_next(curr_option);
} }
break; break;
case FIELD_LIST_MULTI: case FIELD_LIST_MULTI:
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Add : /%s add <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Add : /%s add <value>", tag);
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag);
win_save_print(&confwin->super, '-', NULL, 0, 0, "", " Where : <value> is one of"); win_save_print(window, '-', NULL, 0, 0, "", " Where : <value> is one of");
curr_option = field->options; curr_option = field->options;
while (curr_option != NULL) { while (curr_option != NULL) {
option = curr_option->data; option = curr_option->data;
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " %s", option->value); win_save_vprint(window, '-', NULL, 0, 0, "", " %s", option->value);
curr_option = g_slist_next(curr_option); curr_option = g_slist_next(curr_option);
} }
break; break;
case FIELD_JID_SINGLE: case FIELD_JID_SINGLE:
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Set : /%s <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Set : /%s <value>", tag);
win_save_print(&confwin->super, '-', NULL, 0, 0, "", " Where : <value> is a valid Jabber ID"); win_save_print(window, '-', NULL, 0, 0, "", " Where : <value> is a valid Jabber ID");
break; break;
case FIELD_JID_MULTI: case FIELD_JID_MULTI:
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Add : /%s add <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Add : /%s add <value>", tag);
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag); win_save_vprint(window, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag);
win_save_print(&confwin->super, '-', NULL, 0, 0, "", " Where : <value> is a valid Jabber ID"); win_save_print(window, '-', NULL, 0, 0, "", " Where : <value> is a valid Jabber ID");
break; break;
case FIELD_FIXED: case FIELD_FIXED:
case FIELD_UNKNOWN: case FIELD_UNKNOWN:
@ -2828,7 +2836,7 @@ _ui_show_form_field_help(ProfMucConfWin *confwin, char *tag)
break; break;
} }
} else { } else {
win_save_vprint(&confwin->super, '-', NULL, 0, 0, "", "No such field %s", tag); win_save_vprint(window, '-', NULL, 0, 0, "", "No such field %s", tag);
} }
} }
@ -2836,9 +2844,10 @@ static void
_ui_show_form_help(ProfMucConfWin *confwin) _ui_show_form_help(ProfMucConfWin *confwin)
{ {
if (confwin->form->instructions != NULL) { if (confwin->form->instructions != NULL) {
win_save_print(&confwin->super, '-', NULL, 0, 0, "", "Supplied instructions:"); ProfWin *window = (ProfWin*) confwin;
win_save_print(&confwin->super, '-', NULL, 0, 0, "", confwin->form->instructions); win_save_print(window, '-', NULL, 0, 0, "", "Supplied instructions:");
win_save_print(&confwin->super, '-', NULL, 0, 0, "", ""); win_save_print(window, '-', NULL, 0, 0, "", confwin->form->instructions);
win_save_print(window, '-', NULL, 0, 0, "", "");
} }
} }

View File

@ -61,7 +61,7 @@ _occupantswin_occupants(const char * const roomjid)
if (mucwin) { if (mucwin) {
GList *occupants = muc_roster(roomjid); GList *occupants = muc_roster(roomjid);
if (occupants) { if (occupants) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)mucwin->super.layout; ProfLayoutSplit *layout = (ProfLayoutSplit*)mucwin->window.layout;
assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK); assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);
werase(layout->subwin); werase(layout->subwin);

View File

@ -83,15 +83,15 @@ _win_create_simple_layout(void)
int cols = getmaxx(stdscr); int cols = getmaxx(stdscr);
ProfLayoutSimple *layout = malloc(sizeof(ProfLayoutSimple)); ProfLayoutSimple *layout = malloc(sizeof(ProfLayoutSimple));
layout->super.type = LAYOUT_SIMPLE; layout->base.type = LAYOUT_SIMPLE;
layout->super.win = newpad(PAD_SIZE, cols); layout->base.win = newpad(PAD_SIZE, cols);
wbkgd(layout->super.win, theme_attrs(THEME_TEXT)); wbkgd(layout->base.win, theme_attrs(THEME_TEXT));
layout->super.buffer = buffer_create(); layout->base.buffer = buffer_create();
layout->super.y_pos = 0; layout->base.y_pos = 0;
layout->super.paged = 0; layout->base.paged = 0;
scrollok(layout->super.win, TRUE); scrollok(layout->base.win, TRUE);
return &layout->super; return &layout->base;
} }
static ProfLayout* static ProfLayout*
@ -100,40 +100,40 @@ _win_create_split_layout(void)
int cols = getmaxx(stdscr); int cols = getmaxx(stdscr);
ProfLayoutSplit *layout = malloc(sizeof(ProfLayoutSplit)); ProfLayoutSplit *layout = malloc(sizeof(ProfLayoutSplit));
layout->super.type = LAYOUT_SPLIT; layout->base.type = LAYOUT_SPLIT;
layout->super.win = newpad(PAD_SIZE, cols); layout->base.win = newpad(PAD_SIZE, cols);
wbkgd(layout->super.win, theme_attrs(THEME_TEXT)); wbkgd(layout->base.win, theme_attrs(THEME_TEXT));
layout->super.buffer = buffer_create(); layout->base.buffer = buffer_create();
layout->super.y_pos = 0; layout->base.y_pos = 0;
layout->super.paged = 0; layout->base.paged = 0;
scrollok(layout->super.win, TRUE); scrollok(layout->base.win, TRUE);
layout->subwin = NULL; layout->subwin = NULL;
layout->sub_y_pos = 0; layout->sub_y_pos = 0;
layout->memcheck = LAYOUT_SPLIT_MEMCHECK; layout->memcheck = LAYOUT_SPLIT_MEMCHECK;
return &layout->super; return &layout->base;
} }
ProfWin* ProfWin*
win_create_console(void) win_create_console(void)
{ {
ProfConsoleWin *new_win = malloc(sizeof(ProfConsoleWin)); ProfConsoleWin *new_win = malloc(sizeof(ProfConsoleWin));
new_win->super.type = WIN_CONSOLE; new_win->window.type = WIN_CONSOLE;
new_win->super.layout = _win_create_split_layout(); new_win->window.layout = _win_create_split_layout();
new_win->super.unread = 0; new_win->window.unread = 0;
new_win->from = strdup(CONS_WIN_TITLE); new_win->from = strdup(CONS_WIN_TITLE);
return &new_win->super; return &new_win->window;
} }
ProfWin* ProfWin*
win_create_chat(const char * const barejid) win_create_chat(const char * const barejid)
{ {
ProfChatWin *new_win = malloc(sizeof(ProfChatWin)); ProfChatWin *new_win = malloc(sizeof(ProfChatWin));
new_win->super.type = WIN_CHAT; new_win->window.type = WIN_CHAT;
new_win->super.layout = _win_create_simple_layout(); new_win->window.layout = _win_create_simple_layout();
new_win->super.unread = 0; new_win->window.unread = 0;
new_win->barejid = strdup(barejid); new_win->barejid = strdup(barejid);
new_win->resource = NULL; new_win->resource = NULL;
@ -143,7 +143,7 @@ win_create_chat(const char * const barejid)
new_win->memcheck = PROFCHATWIN_MEMCHECK; new_win->memcheck = PROFCHATWIN_MEMCHECK;
return &new_win->super; return &new_win->window;
} }
ProfWin* ProfWin*
@ -152,80 +152,80 @@ win_create_muc(const char * const roomjid)
ProfMucWin *new_win = malloc(sizeof(ProfMucWin)); ProfMucWin *new_win = malloc(sizeof(ProfMucWin));
int cols = getmaxx(stdscr); int cols = getmaxx(stdscr);
new_win->super.type = WIN_MUC; new_win->window.type = WIN_MUC;
ProfLayoutSplit *layout = malloc(sizeof(ProfLayoutSplit)); ProfLayoutSplit *layout = malloc(sizeof(ProfLayoutSplit));
layout->super.type = LAYOUT_SPLIT; layout->base.type = LAYOUT_SPLIT;
if (prefs_get_boolean(PREF_OCCUPANTS)) { if (prefs_get_boolean(PREF_OCCUPANTS)) {
int subwin_cols = win_occpuants_cols(); int subwin_cols = win_occpuants_cols();
layout->super.win = newpad(PAD_SIZE, cols - subwin_cols); layout->base.win = newpad(PAD_SIZE, cols - subwin_cols);
wbkgd(layout->super.win, theme_attrs(THEME_TEXT)); wbkgd(layout->base.win, theme_attrs(THEME_TEXT));
layout->subwin = newpad(PAD_SIZE, subwin_cols);; layout->subwin = newpad(PAD_SIZE, subwin_cols);;
wbkgd(layout->subwin, theme_attrs(THEME_TEXT)); wbkgd(layout->subwin, theme_attrs(THEME_TEXT));
} else { } else {
layout->super.win = newpad(PAD_SIZE, (cols)); layout->base.win = newpad(PAD_SIZE, (cols));
wbkgd(layout->super.win, theme_attrs(THEME_TEXT)); wbkgd(layout->base.win, theme_attrs(THEME_TEXT));
layout->subwin = NULL; layout->subwin = NULL;
} }
layout->sub_y_pos = 0; layout->sub_y_pos = 0;
layout->memcheck = LAYOUT_SPLIT_MEMCHECK; layout->memcheck = LAYOUT_SPLIT_MEMCHECK;
layout->super.buffer = buffer_create(); layout->base.buffer = buffer_create();
layout->super.y_pos = 0; layout->base.y_pos = 0;
layout->super.paged = 0; layout->base.paged = 0;
scrollok(layout->super.win, TRUE); scrollok(layout->base.win, TRUE);
new_win->super.layout = (ProfLayout*)layout; new_win->window.layout = (ProfLayout*)layout;
new_win->roomjid = strdup(roomjid); new_win->roomjid = strdup(roomjid);
new_win->super.unread = 0; new_win->window.unread = 0;
new_win->memcheck = PROFMUCWIN_MEMCHECK; new_win->memcheck = PROFMUCWIN_MEMCHECK;
return &new_win->super; return &new_win->window;
} }
ProfWin* ProfWin*
win_create_muc_config(const char * const title, DataForm *form) win_create_muc_config(const char * const title, DataForm *form)
{ {
ProfMucConfWin *new_win = malloc(sizeof(ProfMucConfWin)); ProfMucConfWin *new_win = malloc(sizeof(ProfMucConfWin));
new_win->super.type = WIN_MUC_CONFIG; new_win->window.type = WIN_MUC_CONFIG;
new_win->super.layout = _win_create_simple_layout(); new_win->window.layout = _win_create_simple_layout();
new_win->super.unread = 0; new_win->window.unread = 0;
new_win->from = strdup(title); new_win->from = strdup(title);
new_win->form = form; new_win->form = form;
new_win->memcheck = PROFCONFWIN_MEMCHECK; new_win->memcheck = PROFCONFWIN_MEMCHECK;
return &new_win->super; return &new_win->window;
} }
ProfWin* ProfWin*
win_create_private(const char * const fulljid) win_create_private(const char * const fulljid)
{ {
ProfPrivateWin *new_win = malloc(sizeof(ProfPrivateWin)); ProfPrivateWin *new_win = malloc(sizeof(ProfPrivateWin));
new_win->super.type = WIN_PRIVATE; new_win->window.type = WIN_PRIVATE;
new_win->super.layout = _win_create_simple_layout(); new_win->window.layout = _win_create_simple_layout();
new_win->super.unread = 0; new_win->window.unread = 0;
new_win->fulljid = strdup(fulljid); new_win->fulljid = strdup(fulljid);
new_win->memcheck = PROFPRIVATEWIN_MEMCHECK; new_win->memcheck = PROFPRIVATEWIN_MEMCHECK;
return &new_win->super; return &new_win->window;
} }
ProfWin* ProfWin*
win_create_xmlconsole(void) win_create_xmlconsole(void)
{ {
ProfXMLWin *new_win = malloc(sizeof(ProfXMLWin)); ProfXMLWin *new_win = malloc(sizeof(ProfXMLWin));
new_win->super.type = WIN_XML; new_win->window.type = WIN_XML;
new_win->super.layout = _win_create_simple_layout(); new_win->window.layout = _win_create_simple_layout();
new_win->super.unread = 0; new_win->window.unread = 0;
new_win->from = strdup(XML_WIN_TITLE); new_win->from = strdup(XML_WIN_TITLE);
return &new_win->super; return &new_win->window;
} }
void void
@ -239,7 +239,7 @@ win_hide_subwin(ProfWin *window)
layout->subwin = NULL; layout->subwin = NULL;
layout->sub_y_pos = 0; layout->sub_y_pos = 0;
int cols = getmaxx(stdscr); int cols = getmaxx(stdscr);
wresize(layout->super.win, PAD_SIZE, cols); wresize(layout->base.win, PAD_SIZE, cols);
win_redraw(window); win_redraw(window);
} else { } else {
int cols = getmaxx(stdscr); int cols = getmaxx(stdscr);
@ -267,7 +267,7 @@ win_show_subwin(ProfWin *window)
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
layout->subwin = newpad(PAD_SIZE, subwin_cols); layout->subwin = newpad(PAD_SIZE, subwin_cols);
wbkgd(layout->subwin, theme_attrs(THEME_TEXT)); wbkgd(layout->subwin, theme_attrs(THEME_TEXT));
wresize(layout->super.win, PAD_SIZE, cols - subwin_cols); wresize(layout->base.win, PAD_SIZE, cols - subwin_cols);
win_redraw(window); win_redraw(window);
} }
@ -279,8 +279,8 @@ win_free(ProfWin* window)
if (layout->subwin) { if (layout->subwin) {
delwin(layout->subwin); delwin(layout->subwin);
} }
buffer_free(layout->super.buffer); buffer_free(layout->base.buffer);
delwin(layout->super.win); delwin(layout->base.win);
} else { } else {
buffer_free(window->layout->buffer); buffer_free(window->layout->buffer);
delwin(window->layout->win); delwin(window->layout->win);
@ -374,10 +374,10 @@ win_update_virtual(ProfWin *window)
} else { } else {
subwin_cols = win_roster_cols(); subwin_cols = win_roster_cols();
} }
pnoutrefresh(layout->super.win, layout->super.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1);
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1);
} else { } else {
pnoutrefresh(layout->super.win, layout->super.y_pos, 0, 1, 0, rows-3, cols-1); pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, cols-1);
} }
} else { } else {
pnoutrefresh(window->layout->win, window->layout->y_pos, 0, 1, 0, rows-3, cols-1); pnoutrefresh(window->layout->win, window->layout->y_pos, 0, 1, 0, rows-3, cols-1);

View File

@ -76,11 +76,11 @@ typedef struct prof_layout_t {
} ProfLayout; } ProfLayout;
typedef struct prof_layout_simple_t { typedef struct prof_layout_simple_t {
ProfLayout super; ProfLayout base;
} ProfLayoutSimple; } ProfLayoutSimple;
typedef struct prof_layout_split_t { typedef struct prof_layout_split_t {
ProfLayout super; ProfLayout base;
WINDOW *subwin; WINDOW *subwin;
int sub_y_pos; int sub_y_pos;
unsigned long memcheck; unsigned long memcheck;
@ -102,12 +102,12 @@ typedef struct prof_win_t {
} ProfWin; } ProfWin;
typedef struct prof_console_win_t { typedef struct prof_console_win_t {
ProfWin super; ProfWin window;
char *from; char *from;
} ProfConsoleWin; } ProfConsoleWin;
typedef struct prof_chat_win_t { typedef struct prof_chat_win_t {
ProfWin super; ProfWin window;
char *barejid; char *barejid;
gboolean is_otr; gboolean is_otr;
gboolean is_trusted; gboolean is_trusted;
@ -117,26 +117,26 @@ typedef struct prof_chat_win_t {
} ProfChatWin; } ProfChatWin;
typedef struct prof_muc_win_t { typedef struct prof_muc_win_t {
ProfWin super; ProfWin window;
char *roomjid; char *roomjid;
unsigned long memcheck; unsigned long memcheck;
} ProfMucWin; } ProfMucWin;
typedef struct prof_mucconf_win_t { typedef struct prof_mucconf_win_t {
ProfWin super; ProfWin window;
char *from; char *from;
DataForm *form; DataForm *form;
unsigned long memcheck; unsigned long memcheck;
} ProfMucConfWin; } ProfMucConfWin;
typedef struct prof_private_win_t { typedef struct prof_private_win_t {
ProfWin super; ProfWin window;
char *fulljid; char *fulljid;
unsigned long memcheck; unsigned long memcheck;
} ProfPrivateWin; } ProfPrivateWin;
typedef struct prof_xml_win_t { typedef struct prof_xml_win_t {
ProfWin super; ProfWin window;
char *from; char *from;
} ProfXMLWin; } ProfXMLWin;

View File

@ -505,11 +505,11 @@ wins_resize_all(void)
} else if (window->type == WIN_MUC) { } else if (window->type == WIN_MUC) {
subwin_cols = win_occpuants_cols(); subwin_cols = win_occpuants_cols();
} }
wresize(layout->super.win, PAD_SIZE, cols - subwin_cols); wresize(layout->base.win, PAD_SIZE, cols - subwin_cols);
wresize(layout->subwin, PAD_SIZE, subwin_cols); wresize(layout->subwin, PAD_SIZE, subwin_cols);
rosterwin_roster(); rosterwin_roster();
} else { } else {
wresize(layout->super.win, PAD_SIZE, cols); wresize(layout->base.win, PAD_SIZE, cols);
} }
} else { } else {
wresize(window->layout->win, PAD_SIZE, cols); wresize(window->layout->win, PAD_SIZE, cols);
@ -551,12 +551,12 @@ wins_show_subwin(ProfWin *window)
if (current_win->type == WIN_MUC) { if (current_win->type == WIN_MUC) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)current_win->layout; ProfLayoutSplit *layout = (ProfLayoutSplit*)current_win->layout;
subwin_cols = win_occpuants_cols(); subwin_cols = win_occpuants_cols();
pnoutrefresh(layout->super.win, layout->super.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1);
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1);
} else if (current_win->type == WIN_CONSOLE) { } else if (current_win->type == WIN_CONSOLE) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)current_win->layout; ProfLayoutSplit *layout = (ProfLayoutSplit*)current_win->layout;
subwin_cols = win_roster_cols(); subwin_cols = win_roster_cols();
pnoutrefresh(layout->super.win, layout->super.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1);
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1);
} }
} }