Skip to content
Snippets Groups Projects
Commit 5ea5ca05 authored by rswindell's avatar rswindell
Browse files

Fixed problem observed on Vertrauen (Win32), but possibly nowhere else:

When using the SBBSCTRL:User->List menu option, it would take minutes for the
form to fully populate and display (1457 users). It turned out this was due to
a 200ms delay for each open of the data/user.dat file.

I never noticed this problem before, but I went ahead and optimized for this
situation since it was a bit silly to be opening
and closing the user.dat almost 1500 times to get a list of users. This made a
huge difference and the user list appears in about 4 seconds now.

Oddly, this problem does not happen when listing users in the terminal server
or when iterating through them in JavaSciprt (e.g. userlist.js).
parent fb441e4e
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -55,7 +55,9 @@ __fastcall TUserListForm::TUserListForm(TComponent* Owner)
void __fastcall TUserListForm::FormShow(TObject *Sender)
{
char str[128];
char data[U_LEN+1];
int i,last;
int file;
user_t user;
TListItem* Item;
......@@ -63,14 +65,20 @@ void __fastcall TUserListForm::FormShow(TObject *Sender)
SortBackwards=false;
Screen->Cursor=crAppStart;
if((file = openuserdat(&MainForm->cfg)) < 0) {
Screen->Cursor=crDefault;
return;
}
last=lastuser(&MainForm->cfg);
ListView->AllocBy=last;
ListView->Items->BeginUpdate();
for(i=0;i<last;i++) {
user.number=i+1;
if(getuserdat(&MainForm->cfg,&user)!=0)
if(readuserdat(&MainForm->cfg, user.number, data, file)!=0)
continue;
if(parseuserdat(&MainForm->cfg, data, &user)!=0)
continue;
if(user.misc&DELETED)
continue;
Item=ListView->Items->Add();
......@@ -96,6 +104,7 @@ void __fastcall TUserListForm::FormShow(TObject *Sender)
}
ListView->Items->EndUpdate();
close(file);
Screen->Cursor=crDefault;
}
//---------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment