STATUS UserManager::RowDeletedEventHandler( void *pRow, U32 rowCount, ShadowTable* ){ SList container; if( m_isIniting ){ m_shouldReinit = true; return OK; } User *pUser = new User( GetListenManager() ); pUser->BuildYourselfFromPtsRow( (UserAccessTableEntry *)pRow ); container.Add( (CONTAINER_ELEMENT)pUser ); DeleteObjectsFromTheSystem( container ); SetIsReadyToServiceRequests( true ); return OK; }
void loadConfig(CString& configFile) { FILE* f = fopen(configFile, "rt"); if (f) { lineno = 0; while (!feof(f)) { char* p = getSymbol(f); if (p) { if (strcmpi(p, "Style") == 0) { char* styleName = getSymbol(f); Style* newStyle = 0; if (strcmpi(styleName, "Default") != 0) { SListIterator<Style> styleIterator(styles); Style* style; for (style = styleIterator.GoHead(); style; style = styleIterator.GetNext()) { if (strcmpi(style->iStyleName, styleName) == 0) { newStyle = style; break; } } if (!newStyle) { newStyle = new Style(styleName); styles.Add(newStyle); } } else { newStyle = gDefaultStyle; } styleSec = SS_UNKNOWN; if (strcmp(getSymbol(f), "(") != 0) { cprintf("%s(%i): '(' expected\n", (const char*)configFile, lineno); exit(3); } char* ext; do { ext = getSymbol(f); if (*ext != '.' && *ext != ')' && *ext != '*') { cprintf("%s(%i): file extension expected\n", (const char*)configFile, lineno); exit(3); } if (*ext == '.' || *ext == '*') { newStyle->AddExtensions(CString(ext)); } } while (*ext != ')'); char* baseStyles = getSymbol(f); if (strcmp(baseStyles, "{") != 0) { // we have base styles while (strcmp(baseStyles, "{") != 0) { Style* sty; SListIterator<Style> styleIterator(styles); for (sty = styleIterator.GoHead(); sty; sty = styleIterator.GetNext()) { if (strcmpi(sty->iStyleName, baseStyles) == 0) newStyle->AddBaseStyle(sty); } baseStyles = getSymbol(f); } } char* sym = 0; do { sym = getSymbol(f); if (strcmp(sym, "=>") == 0) { sym = getSymbol(f, 1); switch (styleSec) { case SS_SYMBOLSCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iSymbolsColor.SetItem(BYTE(color)); } break; case SS_COMMENTCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iCommentColor.SetItem(BYTE(color)); } break; case SS_STRINGCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iStringColor.SetItem(BYTE(color)); } break; case SS_RESERVEDCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iReservedColor.SetItem(BYTE(color)); } break; case SS_PREPROCESSORCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iPreprocessorColor.SetItem(BYTE(color)); } break; case SS_NUMBERCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iNumberColor.SetItem(BYTE(color)); } break; case SS_IDENTCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iIdentColor.SetItem(BYTE(color)); } break; case SS_FOREGNDCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iForeGndColor.SetItem(BYTE(color)); } break; case SS_BACKGNDCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iBackGndColor.SetItem(BYTE(color)); } break; case SS_SELECTEDFOREGNDCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iSelectedForeGndColor.SetItem(BYTE(color)); } break; case SS_SELECTEDBACKGNDCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iSelectedBackGndColor.SetItem(BYTE(color)); } break; case SS_BOLDCOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iBoldColor.SetItem(BYTE(color)); } break; case SS_UNDERLINECOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iUnderlineColor.SetItem(BYTE(color)); } break; case SS_BOLDUNDERLINECOLOR: { int color = GetColor(sym); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } newStyle->iBoldUnderlineColor.SetItem(BYTE(color)); } break; case SS_EXPANDTABS: { if (IsOnOrYes(sym)) newStyle->iExpandTabs.SetItem(TRUE); else if (IsOffOrNo(sym)) newStyle->iExpandTabs.SetItem(FALSE); else { cprintf("%s(%i): Tabs must be set to either ON or OFF\n", (const char*)configFile, lineno); exit(3); } } break; case SS_HIGHBITFILTER: { if (IsOnOrYes(sym)) newStyle->iHighBitFilter.SetItem(TRUE); else if (IsOffOrNo(sym)) newStyle->iHighBitFilter.SetItem(FALSE); else { cprintf("%s(%i): Highbit filter must be set to either ON or OFF\n", (const char*)configFile, lineno); exit(3); } } break; case SS_TEXTWITHLAYOUT: { if (IsOnOrYes(sym) || strcmp(sym, "1") == 0) newStyle->iTextWithLayout.SetItem(TRUE); else if (IsOffOrNo(sym)) newStyle->iTextWithLayout.SetItem(FALSE); else { cprintf("%s(%i): TextWithLayout must be set to either ON or OFF\n", (const char*)configFile, lineno); exit(3); } } break; case SS_TABWIDTH: { newStyle->iTabWidth.SetItem(atoi(sym)); if (*newStyle->iTabWidth.GetItem() < 1 || *newStyle->iTabWidth.GetItem() > 20) { cprintf("%s(%i): TabWidth must be between 1 and 20\n", (const char*)configFile, lineno); exit(3); } } break; case SS_DISPLAYMODE: { newStyle->iDisplayMode.SetItem(DM_TEXT); if (strcmpi(sym, "TEXT") == 0) newStyle->iDisplayMode.SetItem(DM_TEXT); else if (strcmpi(sym, "HEX") == 0) newStyle->iDisplayMode.SetItem(DM_HEX); else { cprintf("%s(%i): DisplayMode must be set to either TEXT or HEX\n", (const char*)configFile, lineno); exit(3); } } break; case SS_WORDBREAK: { if (IsOnOrYes(sym) || strcmp(sym, "1") == 0) newStyle->iWordBreak.SetItem(TRUE); else if (IsOffOrNo(sym)) newStyle->iWordBreak.SetItem(FALSE); else { cprintf("%s(%i): WorkBreak must be set to either ON or OFF\n", (const char*)configFile, lineno); exit(3); } } break; case SS_TOPLINEFORMAT: { newStyle->iTopLineFormat.SetItem(atoi(sym)); if (*newStyle->iTopLineFormat.GetItem() < 0 || *newStyle->iTopLineFormat.GetItem() > 2) { cprintf("%s(%i): TopLineFormat must be between 0, 1 or 2\n", (const char*)configFile, lineno); exit(3); } } break; case SS_RESERVED: { if (*sym) { newStyle->AddReservedWord(CString(sym)); } } break; case SS_OPENCOMMENT: { if (*sym) newStyle->AddOpenComment(CString(sym)); } break; case SS_STRINGS: { if (*sym) { newStyle->iString.SetItem(sym); } } break; case SS_ESCAPE: { if (*sym) newStyle->iEscape.SetItem(*sym); } break; case SS_SYMBOLS: { if (*sym) newStyle->iSymbols.SetItem(sym); } break; case SS_CLOSECOMMENT: { if (*sym) newStyle->AddCloseComment(CString(sym)); } break; case SS_SINGLELINECOMMENT: { if (*sym) newStyle->AddEolComment(CString(sym)); } break; case SS_NUMBERPREFIX: { if (*sym) newStyle->AddNumericPrefix(CString(sym)); } break; case SS_OPENPREPROCESSOR: { if (*sym) newStyle->iOpenPreprocessor.SetItem(sym); } break; case SS_CLOSEPREPROCESSOR: { if (*sym) newStyle->iClosePreprocessor.SetItem(sym); } break; case SS_COMMENTCOLUMN: { if (*sym) newStyle->iCommentColumn.SetItem(atoi(sym)); } break; case SS_LINECONTINUATION: { if (*sym) newStyle->iLineContinuation.SetItem(*sym); } break; case SS_CASESENSITIVE: { if (IsOnOrYes(sym)) newStyle->iCaseSensitive.SetItem(TRUE); else if (IsOffOrNo(sym)) newStyle->iCaseSensitive.SetItem(FALSE); else { cprintf("%s(%i): CaseSensitive must be set to either YES or NO\n", (const char*)configFile, lineno); exit(3); } } break; case SS_CASECONVERT: { if (IsOnOrYes(sym)) newStyle->iCaseConvert.SetItem(TRUE); else if (IsOffOrNo(sym)) newStyle->iCaseConvert.SetItem(FALSE); else { cprintf("%s(%i): CaseConvert must be set to either YES or NO\n", (const char*)configFile, lineno); exit(3); } } break; case SS_EXTERNALFILTER: { if (*sym) newStyle->iExternalFilterCmd.SetItem(sym); else newStyle->iExternalFilterCmd.SetItem(""); } break; case SS_EDITOR: { if (*sym) newStyle->iEditor.SetItem(sym); else newStyle->iEditor.SetItem(""); } break; case SS_UNKNOWN: { // just ignore => found before a section // has been defined } break; } sym = ""; } else { styleSec = GetSection(sym); if (styleSec == SS_UNKNOWN && strcmp(sym, "}") != 0) { cprintf("%s(%i): undefined style element '%s'\n", (const char*)configFile, lineno, sym); exit(3); } } } while (strcmp(sym, "}") != 0); if (newStyle->iReserved.Size() > 0) { // switch syntax highlighting on for styles // with reserved words. newStyle->iSyntaxHighlightEnabled.SetItem(TRUE); if (!*newStyle->iCaseSensitive.GetItem()) { newStyle->iReserved.sort(cstrcmpi); } else { newStyle->iReserved.sort(); } } } else if (strcmpi(p, "Settings") == 0) { char* setting = getSymbol(f); char* sym; char* value; if (strcmp(setting, "{") != 0) { cprintf("%s(%i): '{' expected\n", (const char*)configFile, lineno); exit(3); } do { setting = getSymbol(f); if (strcmp(setting, "}") != 0) { SettingSection section = GetSetting(setting); sym = getSymbol(f); if (strcmp(sym, "=>") != 0) { cprintf("%s(%i): '=>' expected\n", (const char*)configFile, lineno); exit(3); } value = getSymbol(f); switch (section) { case SET_SOUND: { if (IsOffOrNo(value)) setupInfo.soundOn = FALSE; else if (IsOnOrYes(value)) setupInfo.soundOn = TRUE; else { cprintf("%s(%i): Sound must be set to either ON or OFF\n", (const char*)configFile, lineno); exit(3); } } break; case SET_SEARCH: { if (strcmpi(value, "regexp") == 0) setupInfo.regexpSearch = TRUE; else if (strcmpi(value, "plain") == 0) setupInfo.regexpSearch = FALSE; else { cprintf("%s(%i): Search must be set to either REGEXP or PLAIN\n", (const char*)configFile, lineno); exit(3); } } break; case SET_KEEPFILESLOADED: { if (IsOffOrNo(value)) setupInfo.keepFilesLoaded = FALSE; else if (IsOnOrYes(value)) setupInfo.keepFilesLoaded = TRUE; else { cprintf("%s(%i): KeepFilesLoaded must be set to either ON or OFF\n", (const char*)configFile, lineno); exit(3); } } break; case SET_STATUSTEXTFORECOLOR: { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.statusTextForeColor = color; } break; case SET_STATUSTEXTBACKCOLOR: { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.statusTextBackColor = color; } break; case SET_DISKTEXTFORECOLOR: { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.diskTextForeColor = color; } break; case SET_DISKTEXTBACKCOLOR: { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.diskTextBackColor = color; } break; case SET_CURDISKTEXTFORECOLOR: { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.curDiskTextForeColor = color; } break; case SET_CURDISKTEXTBACKCOLOR : { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.curDiskTextBackColor = color; } break; case SET_FILETEXTFORECOLOR: { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.fileTextForeColor = color; } break; case SET_FILETEXTBACKCOLOR: { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.fileTextBackColor = color; } break; case SET_CURFILETEXTFORECOLOR : { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.curFileTextForeColor = color; } break; case SET_CURFILETEXTBACKCOLOR: { int color = GetColor(value); if (color == -1) { cprintf("%s(%i): Invalid color '%s'\n", (const char*)configFile, lineno, sym); exit(3); } setupInfo.curFileTextBackColor = color; } break; default: cprintf("%s(%i): Unknown setting '%s'\n", (const char*)configFile, lineno, setting); exit(3); } } } while (strcmp(setting, "}") != 0); } else { cprintf("%s(%i): 'Style' expected\n", (const char*)configFile, lineno); exit(3); } } } fclose(f); } }