static void update_split (const WDialog * h) { /* Check split has to be done before testing if it changed, since it can change due to calling check_split() as well */ check_split (&panels_layout); if (panels_layout.horizontal_split) check_options[0].widget->state = panels_layout.horizontal_equal ? 1 : 0; else check_options[0].widget->state = panels_layout.vertical_equal ? 1 : 0; widget_redraw (WIDGET (check_options[0].widget)); tty_setcolor (check_options[0].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL); widget_move (h, 6, 5); if (panels_layout.horizontal_split) tty_printf ("%03d", panels_layout.top_panel_size); else tty_printf ("%03d", panels_layout.left_panel_size); widget_move (h, 6, 17); if (panels_layout.horizontal_split) tty_printf ("%03d", height - panels_layout.top_panel_size); else tty_printf ("%03d", COLS - panels_layout.left_panel_size); widget_move (h, 6, 12); tty_print_char ('='); }
void layout_box (void) { WDialog *layout_dlg; old_layout = panels_layout; old_output_lines = output_lines; layout_dlg = init_layout (); if (dlg_run (layout_dlg) == B_ENTER) { size_t i; for (i = 0; i < (size_t) LAYOUT_OPTIONS_COUNT; i++) if (check_options[i].widget != NULL) *check_options[i].variable = check_options[i].widget->state & C_BOOL; output_lines = _output_lines; } else { /* restore layout */ panels_layout = old_layout; output_lines = old_output_lines; check_split (&panels_layout); /* FIXME: is it really needed? */ } dlg_destroy (layout_dlg); layout_change (); do_refresh (); }
virtual void run (Arg) { check_buildSeq(); check_prepend (); check_shift (); check_split (); }
static void p_quit(char *from, char **ArgList) { int one_prints = 0; char *chan = NULL; char *Reason; int netsplit = 0; int ignore; PasteArgs(ArgList, 0); if (ArgList[0]) { Reason = ArgList[0]; netsplit = check_split(from, Reason, chan); } else Reason = "?"; ignore = check_ignore(from, FromUserHost, NULL, (netsplit ? IGNORE_SPLITS : IGNORE_QUITS) | IGNORE_ALL, NULL); for (chan = walk_channels(from, 1, from_server); chan; chan = walk_channels(from, 0, -1)) { if (ignore != IGNORED) { message_from(chan, LOG_CRAP); if (do_hook(CHANNEL_SIGNOFF_LIST, "%s %s %s", chan, from, Reason)) one_prints = 1; message_from(NULL, LOG_CURRENT); } } if (one_prints) { chan = what_channel(from, from_server); ignore = check_ignore(from, FromUserHost, chan, (netsplit ? IGNORE_SPLITS : IGNORE_QUITS) | IGNORE_ALL, NULL); message_from(chan, LOG_CRAP); if ((ignore != IGNORED) && do_hook(SIGNOFF_LIST, "%s %s", from, Reason) && !netsplit) put_it("%s", convert_output_format(get_format(FORMAT_CHANNEL_SIGNOFF_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from, FromUserHost, chan, Reason)); message_from(NULL, LOG_CURRENT); } if (!netsplit) check_orig_nick(from); notify_mark(from, NULL, NULL, 0); remove_from_channel(NULL, from, from_server, netsplit, Reason); message_from(NULL, LOG_CRAP); update_all_status(curr_scr_win, NULL, 0); }
void change_screen_size (void) { #if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 #if defined TIOCGWINSZ && !defined SCO_FLAVOR extern Dlg_head *view_dlg; extern Dlg_head *edit_dlg; #ifndef NCURSES_VERSION mc_noraw_mode (); endwin (); #endif low_level_change_screen_size (); check_split (); #ifndef NCURSES_VERSION /* XSI Curses spec states that portable applications shall not invoke * initscr() more than once. This kludge could be done within the scope * of the specification by using endwin followed by a refresh (in fact, * more than one curses implementation does this); it is guaranteed to work * only with slang. */ init_curses (); #endif setup_panels (); if (current_dlg == view_dlg) view_adjust_size (view_dlg); #ifdef USE_INTERNAL_EDIT if (current_dlg == edit_dlg) edit_adjust_size (edit_dlg); #endif #ifdef RESIZABLE_MENUBAR menubar_arrange(the_menubar); #endif /* Now, force the redraw */ do_refresh (); touchwin (stdscr); #endif /* TIOCGWINSZ && !SCO_FLAVOR */ #endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */ winch_flag = 0; }
void change_screen_size (void) { #if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 #if defined TIOCGWINSZ #ifndef NCURSES_VERSION mc_noraw_mode (); endwin (); #endif low_level_change_screen_size (); check_split (); #ifndef NCURSES_VERSION /* XSI Curses spec states that portable applications shall not invoke * initscr() more than once. This kludge could be done within the scope * of the specification by using endwin followed by a refresh (in fact, * more than one curses implementation does this); it is guaranteed to work * only with slang. */ init_curses (); #endif setup_panels (); /* Inform currently running dialog */ (*current_dlg->callback) (current_dlg, DLG_RESIZE, 0); #ifdef RESIZABLE_MENUBAR menubar_arrange (the_menubar); #endif /* Now, force the redraw */ do_refresh (); touchwin (stdscr); #endif /* TIOCGWINSZ */ #endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */ winch_flag = 0; }
void setup_panels (void) { int start_y; int promptl; /* the prompt len */ if (console_flag){ int minimum; if (output_lines < 0) output_lines = 0; height = LINES - keybar_visible - command_prompt - menubar_visible - output_lines - message_visible; if (message_visible && xterm_hintbar && xterm_flag) height++; minimum = MINHEIGHT * (1 + horizontal_split); if (height < minimum){ output_lines -= minimum - height; height = minimum; } } else { height = LINES - menubar_visible - command_prompt - keybar_visible - message_visible; if (message_visible && xterm_hintbar && xterm_flag) height++; } check_split (); start_y = menubar_visible; /* The column computing is defered until panel_do_cols */ if (horizontal_split){ widget_set_size (panels [0].widget, start_y, 0, first_panel_size, 0); widget_set_size (panels [1].widget, start_y+first_panel_size, 0, height-first_panel_size, 0); } else { int first_x = first_panel_size; widget_set_size (panels [0].widget, start_y, 0, height, 0); widget_set_size (panels [1].widget, start_y, first_x, height, 0); } panel_do_cols (0); panel_do_cols (1); promptl = strlen (prompt); widget_set_size (&the_menubar->widget, 0, 0, 1, COLS); if (command_prompt) { widget_set_size (&cmdline->input.widget, LINES-1-keybar_visible, promptl, 1, COLS-promptl-(keybar_visible ? 0 : 1)); winput_set_origin (&cmdline->input, promptl, COLS-promptl-(keybar_visible ? 0 : 1)); widget_set_size (&the_prompt->widget, LINES-1-keybar_visible, 0, 1, promptl); } else { widget_set_size (&cmdline->input.widget, 0, 0, 0, 0); winput_set_origin (&cmdline->input, 0, 0); widget_set_size (&the_prompt->widget, LINES, COLS, 0, 0); } widget_set_size (&the_bar->widget, LINES-1, 0, 1, COLS); the_bar->visible = keybar_visible; /* Output window */ if (console_flag && output_lines){ output_start_y = LINES -command_prompt-keybar_visible- output_lines; show_console_contents (output_start_y, LINES-output_lines-keybar_visible-1, LINES-keybar_visible-1); } if (message_visible && (!xterm_hintbar || !xterm_flag)) widget_set_size (&the_hint->widget, height+start_y, 0, 1,COLS); else widget_set_size (&the_hint->widget, 0, 0, 0, 0); load_hint (); }
void setup_panels (void) { int start_y; if (mc_global.tty.console_flag != '\0') { int minimum; if (output_lines < 0) output_lines = 0; height = LINES - mc_global.keybar_visible - (command_prompt ? 1 : 0) - menubar_visible - output_lines - mc_global.message_visible; minimum = MINHEIGHT * (1 + panels_layout.horizontal_split); if (height < minimum) { output_lines -= minimum - height; height = minimum; } } else { height = LINES - menubar_visible - (command_prompt ? 1 : 0) - mc_global.keybar_visible - mc_global.message_visible; } check_split (&panels_layout); start_y = menubar_visible; /* The column computing is deferred until panel_do_cols */ if (panels_layout.horizontal_split) { widget_set_size (panels[0].widget, start_y, 0, panels_layout.top_panel_size, 0); widget_set_size (panels[1].widget, start_y + panels_layout.top_panel_size, 0, height - panels_layout.top_panel_size, 0); } else { widget_set_size (panels[0].widget, start_y, 0, height, 0); widget_set_size (panels[1].widget, start_y, panels_layout.left_panel_size, height, 0); } panel_do_cols (0); panel_do_cols (1); widget_set_size (WIDGET (the_menubar), 0, 0, 1, COLS); if (command_prompt) { #ifdef ENABLE_SUBSHELL if (!mc_global.tty.use_subshell || !do_load_prompt ()) #endif setup_cmdline (); } else { widget_set_size (WIDGET (cmdline), 0, 0, 0, 0); widget_set_size (WIDGET (the_prompt), LINES, COLS, 0, 0); } widget_set_size (WIDGET (the_bar), LINES - 1, 0, mc_global.keybar_visible, COLS); buttonbar_set_visible (the_bar, mc_global.keybar_visible); /* Output window */ if (mc_global.tty.console_flag != '\0' && output_lines) { output_start_y = LINES - (command_prompt ? 1 : 0) - mc_global.keybar_visible - output_lines; show_console_contents (output_start_y, LINES - output_lines - mc_global.keybar_visible - 1, LINES - mc_global.keybar_visible - 1); } if (mc_global.message_visible) widget_set_size (WIDGET (the_hint), height + start_y, 0, 1, COLS); else widget_set_size (WIDGET (the_hint), 0, 0, 0, 0); update_xterm_title_path (); }
void setup_panels (void) { int start_y; int promptl; /* the prompt len */ if (mc_global.tty.console_flag) { int minimum; if (output_lines < 0) output_lines = 0; height = LINES - mc_global.keybar_visible - command_prompt - menubar_visible - output_lines - mc_global.message_visible; minimum = MINHEIGHT * (1 + horizontal_split); if (height < minimum) { output_lines -= minimum - height; height = minimum; } } else { height = LINES - menubar_visible - command_prompt - mc_global.keybar_visible - mc_global.message_visible; } check_split (); start_y = menubar_visible; /* The column computing is defered until panel_do_cols */ if (horizontal_split) { widget_set_size (panels[0].widget, start_y, 0, first_panel_size, 0); widget_set_size (panels[1].widget, start_y + first_panel_size, 0, height - first_panel_size, 0); } else { int first_x = first_panel_size; widget_set_size (panels[0].widget, start_y, 0, height, 0); widget_set_size (panels[1].widget, start_y, first_x, height, 0); } panel_do_cols (0); panel_do_cols (1); promptl = str_term_width1 (mc_prompt); widget_set_size (&the_menubar->widget, 0, 0, 1, COLS); if (command_prompt) { widget_set_size (&cmdline->widget, LINES - 1 - mc_global.keybar_visible, promptl, 1, COLS - promptl); input_set_origin (cmdline, promptl, COLS - promptl); widget_set_size (&the_prompt->widget, LINES - 1 - mc_global.keybar_visible, 0, 1, promptl); } else { widget_set_size (&cmdline->widget, 0, 0, 0, 0); input_set_origin (cmdline, 0, 0); widget_set_size (&the_prompt->widget, LINES, COLS, 0, 0); } widget_set_size (&the_bar->widget, LINES - 1, 0, mc_global.keybar_visible, COLS); buttonbar_set_visible (the_bar, mc_global.keybar_visible); /* Output window */ if (mc_global.tty.console_flag && output_lines) { output_start_y = LINES - command_prompt - mc_global.keybar_visible - output_lines; show_console_contents (output_start_y, LINES - output_lines - mc_global.keybar_visible - 1, LINES - mc_global.keybar_visible - 1); } if (mc_global.message_visible) widget_set_size (&the_hint->widget, height + start_y, 0, 1, COLS); else widget_set_size (&the_hint->widget, 0, 0, 0, 0); update_xterm_title_path (); }
/* ** exit_client ** This is old "m_bye". Name changed, because this is not a ** protocol function, but a general server utility function. ** ** This function exits a client of *any* type (user, server, etc) ** from this server. Also, this generates all necessary prototol ** messages that this exit may cause. ** ** 1) If the client is a local client, then this implicitly ** exits all other clients depending on this connection (e.g. ** remote clients having 'from'-field that points to this. ** ** 2) If the client is a remote client, then only this is exited. ** ** For convenience, this function returns a suitable value for ** m_funtion return value: ** ** FLUSH_BUFFER if (cptr == sptr) ** 0 if (cptr != sptr) ** ** Parameters: ** ** aClient *cptr ** The local client originating the exit or NULL, if this ** exit is generated by this server for internal reasons. ** This will not get any of the generated messages. ** aClient *sptr ** Client exiting ** aClient *from ** Client firing off this Exit, never NULL! ** char *comment ** Reason for the exit */ int exit_client(aClient *cptr, aClient *sptr, aClient *from, const char *comment) { char comment1[HOSTLEN + HOSTLEN + 2]; if (MyConnect(sptr)) { if (sptr->flags & FLAGS_KILLED) { sendto_flag(SCH_NOTICE, "Killed: %s.", get_client_name(sptr, TRUE)); sptr->exitc = EXITC_KILL; } sptr->flags |= FLAGS_CLOSING; #if (defined(FNAME_USERLOG) || defined(FNAME_CONNLOG) \ || defined(USE_SERVICES)) \ || (defined(USE_SYSLOG) && (defined(SYSLOG_USERS) || defined(SYSLOG_CONN))) if (IsPerson(sptr)) { # if defined(FNAME_USERLOG) || defined(USE_SERVICES) || \ (defined(USE_SYSLOG) && defined(SYSLOG_USERS)) sendto_flog(sptr, EXITC_REG, sptr->user->username, sptr->user->host); # endif # if defined(CLIENTS_CHANNEL) && (CLIENTS_CHANNEL_LEVEL & CCL_QUIT) sendto_flag(SCH_CLIENT, "%s %s %s %s QUIT %c" # if (CLIENTS_CHANNEL_LEVEL & CCL_QUITINFO) " :%s" # endif , sptr->user->uid, sptr->name, sptr->user->username, sptr->user->host, sptr->exitc # if (CLIENTS_CHANNEL_LEVEL & CCL_QUITINFO) , comment # endif ); # endif } else if (!IsService(sptr)) { # if defined(FNAME_CONNLOG) || defined(USE_SERVICES) || \ (defined(USE_SYSLOG) && defined(SYSLOG_CONN)) if (sptr->exitc == '\0' || sptr->exitc == EXITC_REG) { sptr->exitc = EXITC_UNDEF; } sendto_flog(sptr, sptr->exitc, sptr->user && sptr->user->username ? sptr->user->username : "", #ifdef UNIXPORT (IsUnixSocket(sptr)) ? me.sockhost : #endif ((sptr->hostp) ? sptr->hostp->h_name : sptr->sockhost)); # endif } #endif if (MyConnect(sptr)) { if (IsPerson(sptr)) { istat.is_myclnt--; } else if (IsServer(sptr)) { istat.is_myserv--; } else if (IsService(sptr)) { istat.is_myservice--; } else { istat.is_unknown--; } if (istat.is_myclnt % CLCHNO == 0 && istat.is_myclnt != istat.is_l_myclnt) { sendto_flag(SCH_NOTICE, "Local %screase from %d to %d clients " "in %d seconds", istat.is_myclnt>istat.is_l_myclnt?"in":"de", istat.is_l_myclnt, istat.is_myclnt, timeofday - istat.is_l_myclnt_t); istat.is_l_myclnt_t = timeofday; istat.is_l_myclnt = istat.is_myclnt; } /* Send SQUIT message to 2.11 servers to tell them * the squit reason for rebroadcast on the other side * - jv */ if (IsServer(sptr)) { sendto_one(sptr, ":%s SQUIT %s :%s", me.serv->sid, sptr->serv->sid, comment); } if (cptr != NULL && sptr != cptr) { sendto_one(sptr, "ERROR :Closing Link: " "%s %s (%s)", get_client_name(sptr,FALSE), cptr->name, comment); } else { sendto_one(sptr, "ERROR :Closing Link: %s (%s)", get_client_name(sptr,FALSE), comment); } if (sptr->auth != sptr->username) { istat.is_authmem -= strlen(sptr->auth) + 1; istat.is_auth -= 1; MyFree(sptr->auth); sptr->auth = sptr->username; } } /* ** Currently only server connections can have ** depending remote clients here, but it does no ** harm to check for all local clients. In ** future some other clients than servers might ** have remotes too... ** now, I think it harms big client servers... - krys ** ** Close the Client connection first and mark it ** so that no messages are attempted to send to it. ** (The following *must* make MyConnect(sptr) == FALSE!). ** It also makes sptr->from == NULL, thus it's unnecessary ** to test whether "sptr != acptr" in the following loops. */ close_connection(sptr); } /* if (MyConnect(sptr) */ if (IsServer(sptr)) { /* Remove all dependent servers and clients. */ if (!IsMasked(sptr)) { sprintf(comment1, "%s %s", sptr->serv->up->name, sptr->name); } else { /* It was a masked server, the squit reason should ** give the right quit reason for clients. */ strncpyzt(comment1, comment, sizeof(comment1)); } /* cptr != sptr means non-local server */ if (cptr != sptr && nextconnect == 0 && find_conf_name(sptr->name, (CONF_CONNECT_SERVER|CONF_ZCONNECT_SERVER))) { /* try AC */ nextconnect = timeofday + HANGONRETRYDELAY; } exit_server(sptr, sptr, from, comment, comment1); check_split(); if ((cptr == sptr)) { /* It serves no purpose. --B. sendto_flag(SCH_SERVER, "Sending SQUIT %s (%s)", cptr->name, comment); */ return FLUSH_BUFFER; } return 0; } /* ** Try to guess from comment if the client is exiting ** normally (KILL or issued QUIT), or if it is splitting ** It requires comment for splitting users to be ** "server.some.where splitting.some.where" */ comment1[0] = '\0'; if ((sptr->flags & FLAGS_KILLED) == 0) { if (comment[0] == '"') { /* definitely user quit, see m_quit */ sptr->flags |= FLAGS_QUIT; } else { const char *c = comment; int i = 0; while (*c && *c != ' ') if (*c++ == '.') i++; if (*c++ && i) { i = 0; while (*c && *c != ' ') if (*c++ == '.') i++; if (!i || *c) sptr->flags |= FLAGS_QUIT; } else { sptr->flags |= FLAGS_QUIT; } } if (sptr == cptr && !(sptr->flags & FLAGS_QUIT)) { /* ** This will avoid nick delay to be abused by ** letting local users put a comment looking ** like a server split. */ strncpyzt(comment1, comment, HOSTLEN + HOSTLEN); strcat(comment1, " "); sptr->flags |= FLAGS_QUIT; } } exit_one_client(cptr, sptr, from, (*comment1) ? comment1 : comment); /* XXX: we probably should not call it every client exit */ /* checking every server quit should suffice --B. */ /* check_split(); */ return cptr == sptr ? FLUSH_BUFFER : 0; }