return;
}
+ if(result->fields != 5) {
+ Error("trusts", ERR_ERROR, "Wrong number of fields in log table.");
+
+ result->clear(result);
+ return;
+ }
+
while(result->next(result)) {
unsigned int ts, groupid;
char *groupname, *user, *message;
rows++;
}
+ result->clear(result);
+
controlreply(np, "--- Done. Found %d entries.", rows);
}
snprintf(buf, sizeof(buf), "%%%s%%", pattern);
trustsdb->query(trustsdb, trustlogquery_callback, (void *)np,
- "SELECT ts, groupid, username, message FROM ? WHERE message LIKE ? ORDER BY ts DESC LIMIT ?",
+ "SELECT ts, groupid, groupname, username, message FROM ? WHERE message LIKE ? ORDER BY ts DESC LIMIT ?",
"Tsu", "log", buf, limit);
}
triggerhook(HOOK_TRUSTS_ADDHOST, th);
controlwall(NO_OPER, NL_TRUSTS, "%s TRUSTADD'ed host %s to group '%s'", controlid(sender), host, th->group->name->content);
- trustlog(tg, controlid(sender), "Added host '%s'.", host);
+ trustlog(tg, sender->authname, "Added host '%s'.", host);
return CMD_OK;
}
triggerhook(HOOK_TRUSTS_ADDGROUP, tg);
controlwall(NO_OPER, NL_TRUSTS, "%s TRUSTGROUPADD'ed '%s'", controlid(sender), tg->name->content);
- trustlog(tg, controlid(sender), "Created trust group '%s' (ID #%d): howmany=%d, enforceident=%d, maxperident=%d, "
+ trustlog(tg, sender->authname, "Created trust group '%s' (ID #%d): howmany=%d, enforceident=%d, maxperident=%d, "
"expires=%d, createdby=%s, contact=%s, comment=%s",
tg->name->content, howmany, tg->id, enforceident, maxperident, expires, createdby, contact, comment);
}
controlwall(NO_OPER, NL_TRUSTS, "%s TRUSTGROUPDEL'ed '%s'.", controlid(sender), tg->name->content);
- trustlog(tg, controlid(sender), "Deleted group '%s'.", tg->name->content);
+ trustlog(tg, sender->authname, "Deleted group '%s'.", tg->name->content);
triggerhook(HOOK_TRUSTS_DELGROUP, tg);
tg_delete(tg);
controlreply(sender, "Host deleted.");
controlwall(NO_OPER, NL_TRUSTS, "%s TRUSTDEL'ed %s from group '%s'.", controlid(sender), host, tg->name->content);
- trustlog(tg, controlid(sender), "Removed host '%s'.", host);
+ trustlog(tg, sender->authname, "Removed host '%s'.", host);
return CMD_OK;
}
controlreply(sender, "Group modified.");
controlwall(NO_OPER, NL_TRUSTS, "%s TRUSTMODIFIED'ed group '%s' (field: %s, value: %s)", controlid(sender), tg->name->content, what, to);
- trustlog(tg, controlid(sender), "Modified %s: %s", what, to);
+ trustlog(tg, sender->authname, "Modified %s: %s", what, to);
return CMD_OK;
}
}
controlwall(NO_OPER, NL_TRUSTS, "%s TRUSTCOMMENT'ed group '%s': %s", controlid(sender), tg->name->content, comment);
- trustlog(tg, controlid(sender), "Comment: %s", comment);
+ trustlog(tg, sender->authname, "Comment: %s", comment);
return CMD_OK;
}