aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/sledjchisl/sledjchisl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sledjchisl/sledjchisl.c')
-rw-r--r--src/sledjchisl/sledjchisl.c90
1 files changed, 53 insertions, 37 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index 3821a7b..aae3031 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -2004,7 +2004,7 @@ byTab has the short name as the key, simData as the value.
2004// TODO - report CPU and memory used as well. 2004// TODO - report CPU and memory used as well.
2005 if (FLAG(m)) 2005 if (FLAG(m))
2006 { 2006 {
2007// TODO - report level, online status, and location of member. 2007 ; // Do nothing, this is better done in the calling function, coz it has the details.
2008 } 2008 }
2009 else if (checkSimIsRunning(simd->tab)) 2009 else if (checkSimIsRunning(simd->tab))
2010 I("%s is running in Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/sim%d", simd->name, window, type, pane, simd->paneID, scTemp, count); 2010 I("%s is running in Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/sim%d", simd->name, window, type, pane, simd->paneID, scTemp, count);
@@ -7446,60 +7446,76 @@ void account_html(char *file, reqData *Rd, HTMLfile *thisFile)
7446 7446
7447void forEachMember(char *verb, simFunction func, simFunction not) 7447void forEachMember(char *verb, simFunction func, simFunction not)
7448{ 7448{
7449 if (NULL != ourSims->target) 7449 char *last = xstrdup("0");
7450 func(NULL, ourSims->target, "Member", 0, 0, 0, 0); 7450
7451 else 7451 if (BACKUP == currentMode)
7452 { 7452 {
7453 char *file = xmprintf("%s/.lastTime", scBackup); 7453 char *file = xmprintf("%s/.lastTime", scBackup);
7454 char *last = (char *) qfile_load(file, NULL);
7455 char *cmd = xmprintf("date +%%s > %s", file); 7454 char *cmd = xmprintf("date +%%s > %s", file);
7456 7455
7456 last = (char *) qfile_load(file, NULL);
7457 if (NULL == last) 7457 if (NULL == last)
7458 last = xstrdup("0"); 7458 last = xstrdup("0");
7459 if (!WIFEXITED(system(cmd))) 7459 if (!WIFEXITED(system(cmd)))
7460 E("date command failed!"); 7460 E("date command failed!");
7461 free(cmd);
7462 free(file);
7463 }
7461 7464
7462 static dbRequest *users = NULL; 7465 static dbRequest *users = NULL;
7463 if (NULL == users) 7466 if (NULL == users)
7464 { 7467 {
7465 static char *szi[] = {NULL}; 7468 static char *szi[] = {NULL};
7466 static char *szo[] = {"FirstName", "LastName", NULL}; 7469 static char *szo[] = {"FirstName", "LastName", "UserLevel", "Online", "LastRegionID", NULL};
7467 users = xzalloc(sizeof(dbRequest)); 7470 users = xzalloc(sizeof(dbRequest));
7468 users->table = "UserAccounts,GridUser"; 7471 users->table = "UserAccounts,GridUser";
7469 users->inParams = szi; 7472 users->inParams = szi;
7470 users->outParams = szo; 7473 users->outParams = szo;
7471 users->where = xmprintf("UserAccounts.PrincipalID=LEFT(GridUser.UserID,36) and GridUser.Login>%s order by LastName,FirstName", last); 7474 users->where = xmprintf("UserAccounts.PrincipalID=LEFT(GridUser.UserID,36) and GridUser.Login>%s order by LastName,FirstName", last);
7472 dbRequests->addfirst(dbRequests, &users, sizeof(dbRequest *)); 7475 dbRequests->addfirst(dbRequests, &users, sizeof(dbRequest *));
7473 } 7476 }
7474 7477
7475 dbDoSomething(users, FALSE); // LEAKY 7478 dbDoSomething(users, FALSE);
7476 rowData *rows = users->rows; 7479 rowData *rows = users->rows;
7477 if (rows) 7480 if (rows)
7478 { 7481 {
7479 qhashtbl_t *row; 7482 qhashtbl_t *row;
7480 7483
7481d("Number of rows returned %d", (int) rows->rows->size(rows->rows)); 7484d("Number of rows returned %d", (int) rows->rows->size(rows->rows));
7482 while (NULL != (row = rows->rows->getat(rows->rows, 0, NULL, true))) 7485 while (NULL != (row = rows->rows->getat(rows->rows, 0, NULL, true)))
7486 {
7487 char *firstName = row->getstr(row, "FirstName", false);
7488 char *lastName = row->getstr(row, "LastName", false);
7489 char *name = xmprintf("%s %s", firstName, lastName);
7490
7491 if ((NULL == ourSims->target) || (strcmp(ourSims->target, name) == 0))
7483 { 7492 {
7484 char *firstName = row->getstr(row, "FirstName", false); 7493 if (STATUS == currentMode)
7485 char *lastName = row->getstr(row, "LastName", false); 7494 {
7486 char *name = xmprintf("%s %s", firstName, lastName); 7495 char *level = row->getstr(row, "UserLevel", false);
7496 char *online = row->getstr(row, "Online", false);
7497 char *region = row->getstr(row, "LastRegionID", false);
7498 simData *simd = ourSims->byUUID->get(ourSims->byUUID, region, NULL, false);
7487 7499
7488V("Member %s %s", firstName, lastName); 7500 if (NULL != simd)
7489 func(NULL, name, "Member", 0, 0, 0, 0); 7501 region = simd->name;
7502 if (strcmp("False", online) == 0)
7503 region = "";
7490 7504
7491 free(name); 7505 I("Member level %s, online %s, name %s %s @ %s", level, online, firstName, lastName, region);
7492 row->free(row); 7506 }
7493 rows->rows->removefirst(rows->rows); 7507 func(NULL, name, "Member", 0, 0, 0, 0);
7494 } 7508 }
7495 free(rows->fieldNames); 7509
7496 rows->rows->free(rows->rows); 7510 free(name);
7497 free(rows); 7511 row->free(row);
7512 rows->rows->removefirst(rows->rows);
7498 } 7513 }
7499 free(cmd); 7514 free(rows->fieldNames);
7500 free(last); 7515 rows->rows->free(rows->rows);
7501 free(file); 7516 free(rows);
7502 } 7517 }
7518 free(last);
7503} 7519}
7504 7520
7505 7521