Skip to content

Commit

Permalink
Various modifications to /finger:
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
HarpyWar committed Mar 25, 2014
1 parent c229c66 commit bdb4500
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/bnetd/account_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions src/bnetd/account_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
27 changes: 19 additions & 8 deletions src/bnetd/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++);
Expand All @@ -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;
Expand Down Expand Up @@ -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 */
Expand All @@ -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);
}

Expand Down

0 comments on commit bdb4500

Please sign in to comment.