void OnPostJoin(Membership *memb) { if (!IS_LOCAL(memb->user)) return; modelist* list = mh.extItem.get(memb->chan); if (list) { std::string modeline("+"); std::vector<std::string> modechange; modechange.push_back(memb->chan->name); for (modelist::iterator it = list->begin(); it != list->end(); it++) { std::string::size_type colon = it->mask.find(':'); if (colon == std::string::npos) continue; if (memb->chan->CheckBan(memb->user, it->mask.substr(colon+1))) { ModeHandler* given = mh.FindMode(it->mask.substr(0, colon)); if (given && given->GetPrefixRank()) modeline.push_back(given->GetModeChar()); } } modechange.push_back(modeline); for(std::string::size_type i = modeline.length(); i > 1; --i) // we use "i > 1" instead of "i" so we skip the + modechange.push_back(memb->user->nick); if(modechange.size() >= 3) ServerInstance->SendGlobalMode(modechange, ServerInstance->FakeClient); } }
/* * Make sure that the display is right. This is a three part process. First, * scan through all of the windows looking for dirty ones. Check the framing, * and refresh the screen. Second, make sure that "currow" and "curcol" are * correct for the current window. Third, make the virtual and physical * screens the same. * * int force; force update past type ahead? */ int update(int force) { struct window *wp; #if TYPEAH && ! PKCODE if (force == FALSE && typahead()) return TRUE; #endif #if VISMAC == 0 if (force == FALSE && kbdmode == PLAY) return TRUE; #endif displaying = TRUE; #if SCROLLCODE /* first, propagate mode line changes to all instances of a buffer displayed in more than one window */ wp = wheadp; while (wp != NULL) { if (wp->w_flag & WFMODE) { if (wp->w_bufp->b_nwnd > 1) { /* make sure all previous windows have this */ struct window *owp; owp = wheadp; while (owp != NULL) { if (owp->w_bufp == wp->w_bufp) owp->w_flag |= WFMODE; owp = owp->w_wndp; } } } wp = wp->w_wndp; } #endif /* update any windows that need refreshing */ wp = wheadp; while (wp != NULL) { if (wp->w_flag) { /* if the window has changed, service it */ reframe(wp); /* check the framing */ #if SCROLLCODE if (wp->w_flag & (WFKILLS | WFINS)) { scrflags |= (wp->w_flag & (WFINS | WFKILLS)); wp->w_flag &= ~(WFKILLS | WFINS); } #endif if ((wp->w_flag & ~WFMODE) == WFEDIT) updone(wp); /* update EDITed line */ else if (wp->w_flag & ~WFMOVE) updall(wp); /* update all lines */ #if SCROLLCODE if (scrflags || (wp->w_flag & WFMODE)) #else if (wp->w_flag & WFMODE) #endif modeline(wp); /* update modeline */ wp->w_flag = 0; wp->w_force = 0; } /* on to the next window */ wp = wp->w_wndp; } /* recalc the current hardware cursor location */ updpos(); #if MEMMAP && ! SCROLLCODE /* update the cursor and flush the buffers */ movecursor(currow, curcol - lbound); #endif /* check for lines to de-extend */ upddex(); /* if screen is garbage, re-plot it */ if (sgarbf != FALSE) updgar(); /* update the virtual screen to the physical screen */ updupd(force); /* update the cursor and flush the buffers */ movecursor(currow, curcol - lbound); TTflush(); displaying = FALSE; #if SIGWINCH while (chg_width || chg_height) newscreensize(chg_height, chg_width); #endif return TRUE; }
/* * scrollw - takes beginning row and ending row to diplay an array * of text lines. returns either 0 if scrolling terminated * normally or the value of a ctrl character typed to end it. * * updates - * 01/11/89 - added stripe call if 1st char is tilde - '~' * */ int wscrollw(int begrow, int endrow, char *utf8textp[], int textlen) { register int loffset = 0; register int prevoffset = -1; register int dlines; register int i; register int cont; register int done = 0; register char *buf; UCS c; dlines = endrow - begrow - 1; while(!done) { /* * diplay a page loop ... */ if(prevoffset != loffset){ for(i = 0; i < dlines; i++){ movecursor(i + begrow, 0); peeol(); if((loffset+i) < textlen){ buf = _(&(utf8textp[loffset+i][0])); if(*buf == '~'){ buf++; wstripe(begrow+i, 0, buf, '~'); } else{ pputs_utf8(buf, 0); } } } /* * put up the options prompt */ movecursor(begrow + dlines, 0); cont = (loffset+dlines < textlen); if(cont){ /* continue ? */ menu_scroll[NEXT_KEY].name = "^V"; /* TRANSLATORS: Next Page, a command key label */ menu_scroll[NEXT_KEY].label = N_("Next Pg"); } else menu_scroll[NEXT_KEY].name = NULL; if(loffset){ menu_scroll[PREV_KEY].name = "^Y"; /* TRANSLATORS: Previous Page */ menu_scroll[PREV_KEY].label = N_("Prev Pg"); } else menu_scroll[PREV_KEY].name = NULL; wkeyhelp(menu_scroll); } (*term.t_flush)(); c = GetKey(); prevoffset = loffset; switch(c){ case (CTRL|'X') : /* quit */ case F2 : done = 1; break; case (CTRL|'Y') : /* prev page */ case F7 : /* prev page */ if((loffset-dlines-OVERLAP) > 0){ loffset -= (dlines-OVERLAP); } else{ if(loffset != 0){ prevoffset = -1; } else{ (*term.t_beep)(); } loffset = 0; } break; case (CTRL|'V') : /* next page */ case F8 : if(cont){ loffset += (dlines-OVERLAP); } else{ (*term.t_beep)(); } break; case '\016' : /* prev-line */ case (CTRL|'N') : if(cont) loffset++; else (*term.t_beep)(); break; case '\020' : /* prev-line */ case (CTRL|'P') : if(loffset > 0) loffset--; else (*term.t_beep)(); break; case '\014' : /* refresh */ case (CTRL|'L') : /* refresh */ modeline(curwp); update(); prevoffset = -1; break; case NODATA : break; #ifdef notdef /* * We don't handle window resize events correctly when in pico help. * resize_pico() redraws the edit window instead of the help window. * A ^L will redraw the help text. What we'd like is something like * a KEY_RESIZE return from GetKey. If we had that we could exit * wscrollw with a FALSE return value and have that cause us to loop * back into wscrollw with the adjusted size. That would still mean * the edit text would be redrawn first... */ #endif /* notdef */ default : unknown_command(c); break; } } return(TRUE); }