Various modifications to /finger:

- Displaying account creation time
- Renamed is_admin/operator to Admin/Operator respectively
- Displaying whether account is muted or not
- Displaying last login owner

http://developer.berlios.de/patch/?func=detailpatch&patch_id=2859&group_id=2291
This commit is contained in:
HarpyWar 2014-03-25 23:32:25 +04:00
parent c229c6693b
commit bdb4500847
3 changed files with 25 additions and 8 deletions

View file

@ -453,6 +453,11 @@ namespace pvpgn
/****************************************************************/
/* Account creation time */
extern unsigned int account_get_ll_ctime(t_account * account)
{
return account_get_numattr(account, "BNET\\acct\\ctime");
}
extern unsigned int account_get_ll_time(t_account * account)
{

View file

@ -89,6 +89,7 @@ namespace pvpgn
extern char const * account_get_desc(t_account * account);
/* last login */
extern unsigned int account_get_ll_ctime(t_account * account);
extern unsigned int account_get_ll_time(t_account * account);
extern int account_set_ll_time(t_account * account, unsigned int t);
extern char const * account_get_ll_user(t_account * account);

View file

@ -3441,6 +3441,8 @@ namespace pvpgn
char const * ip;
char * tok;
t_clanmember * clanmemb;
std::time_t then;
struct std::tm * tmthen;
for (i = 0; text[i] != ' ' && text[i] != '\0'; i++); /* skip command */
for (; text[i] == ' '; i++);
@ -3460,12 +3462,19 @@ namespace pvpgn
message_send_text(c, message_type_error, c, "Invalid user.");
return 0;
}
then = account_get_ll_ctime(account);
tmthen = std::localtime(&then); /* FIXME: determine user's timezone */
snprintf(msgtemp, sizeof(msgtemp), "Login: %-16.16s "UID_FORMAT" Sex: %.14s",
account_get_name(account),
account_get_uid(account),
account_get_sex(account));
message_send_text(c, message_type_info, c, msgtemp);
std::strftime(msgtemp, sizeof(msgtemp), "Created: %a %b %d %H:%M %Y ", tmthen);
message_send_text(c, message_type_info, c, msgtemp);
if ((clanmemb = account_get_clanmember(account)))
{
t_clan * clan;
@ -3517,8 +3526,6 @@ namespace pvpgn
ip = "unknown";
{
std::time_t then;
struct std::tm * tmthen;
then = account_get_ll_time(account);
tmthen = std::localtime(&then); /* FIXME: determine user's timezone */
@ -3540,13 +3547,17 @@ namespace pvpgn
if ((account_get_command_groups(conn_get_account(c)) & command_get_group("/admin-addr")))
{
/* the player who requested /finger has admin privileges
give him more info about the one he querys;
is_admin, is_operator, is_locked, email */
snprintf(msgtemp, sizeof(msgtemp), "email:%.128s , is_operator: %d , is_admin: %d , is_acc_locked: %d",
give him more info about the one he querys;
is_admin, is_operator, is_locked, email */
snprintf(msgtemp, sizeof(msgtemp), "Email: %.128s, Operator: %s, Admin: %s, Locked: %s, Muted: %s",
account_get_email(account),
account_get_auth_operator(account, NULL),
account_get_auth_admin(account, NULL),
account_get_auth_lock(account));
account_get_auth_operator(account, NULL) == 1 ? "Yes" : "No",
account_get_auth_admin(account, NULL) == 1 ? "Yes" : "No",
account_get_auth_lock(account) == 1 ? "Yes" : "No",
account_get_auth_mute(account) == 1 ? "Yes" : "No");
message_send_text(c, message_type_info, c, msgtemp);
snprintf(msgtemp, sizeof(msgtemp), "Last login Owner: %.128s",
account_get_ll_owner(account));
message_send_text(c, message_type_info, c, msgtemp);
}