Skip to content

Commit

Permalink
@accinfo update
Browse files Browse the repository at this point in the history
Added pincode support
Changed group_id to group_level as to respect the level hierarchy on whether to display passwords or not.
Updated GeoIP Database to March 2013

Signed-off-by: shennetsind <ind@henn.et>
  • Loading branch information
shennetsind committed Mar 27, 2013
1 parent 889a866 commit 9b5ec24
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
Binary file modified db/GeoIP.dat
Binary file not shown.
13 changes: 9 additions & 4 deletions src/char/inter.c
Expand Up @@ -490,10 +490,10 @@ void mapif_parse_accinfo(int fd) {

/* it will only get here if we have a single match */
if( account_id ) {
char userid[NAME_LENGTH], user_pass[NAME_LENGTH], email[40], last_ip[20], lastlogin[30];
char userid[NAME_LENGTH], user_pass[NAME_LENGTH], email[40], last_ip[20], lastlogin[30], pincode[5];
short level = -1;
int logincount = 0,state = 0;
if ( SQL_ERROR == Sql_Query(sql_handle, "SELECT `userid`, `user_pass`, `email`, `last_ip`, `group_id`, `lastlogin`, `logincount`, `state` FROM `login` WHERE `account_id` = '%d' LIMIT 1", account_id)
if ( SQL_ERROR == Sql_Query(sql_handle, "SELECT `userid`, `user_pass`, `email`, `last_ip`, `group_id`, `lastlogin`, `logincount`, `state`,`pincode` FROM `login` WHERE `account_id` = '%d' LIMIT 1", account_id)
|| Sql_NumRows(sql_handle) == 0 ) {
if( Sql_NumRows(sql_handle) == 0 ) {
inter_to_fd(fd, u_fd, aid, "No account with ID '%d' was found.", account_id );
Expand All @@ -511,6 +511,7 @@ void mapif_parse_accinfo(int fd) {
Sql_GetData(sql_handle, 5, &data, NULL); safestrncpy(lastlogin, data, sizeof(lastlogin));
Sql_GetData(sql_handle, 6, &data, NULL); logincount = atoi(data);
Sql_GetData(sql_handle, 7, &data, NULL); state = atoi(data);
Sql_GetData(sql_handle, 8, &data, NULL); safestrncpy(pincode, data, sizeof(pincode));
}

Sql_FreeResult(sql_handle);
Expand All @@ -521,8 +522,12 @@ void mapif_parse_accinfo(int fd) {
inter_to_fd(fd, u_fd, aid, "-- Account %d --", account_id );
inter_to_fd(fd, u_fd, aid, "User: %s | GM Group: %d | State: %d", userid, level, state );

if (level < castergroup) /* only show pass if your gm level is greater than the one you're searching for */
inter_to_fd(fd, u_fd, aid, "Password: %s", user_pass );
if (level < castergroup) { /* only show pass if your gm level is greater than the one you're searching for */
if( strlen(pincode) )
inter_to_fd(fd, u_fd, aid, "Password: %s (PIN:%s)", user_pass, pincode );
else
inter_to_fd(fd, u_fd, aid, "Password: %s", user_pass );
}

inter_to_fd(fd, u_fd, aid, "Account e-mail: %s", email);
inter_to_fd(fd, u_fd, aid, "Last IP: %s (%s)", last_ip, geoip_getcountry(str2ip(last_ip)) );
Expand Down
2 changes: 1 addition & 1 deletion src/map/atcommand.c
Expand Up @@ -8598,7 +8598,7 @@ ACMD_FUNC(accinfo) {
//remove const type
safestrncpy(query, message, NAME_LENGTH);

intif_request_accinfo( sd->fd, sd->bl.id, sd->group_id, query );
intif_request_accinfo( sd->fd, sd->bl.id, pc_get_group_level(sd), query );

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/map/intif.c
Expand Up @@ -2121,15 +2121,15 @@ int intif_parse_elemental_saved(int fd)
return 0;
}

void intif_request_accinfo( int u_fd, int aid, int group_id, char* query ) {
void intif_request_accinfo( int u_fd, int aid, int group_lv, char* query ) {


WFIFOHEAD(inter_fd,2 + 4 + 4 + 4 + NAME_LENGTH);

WFIFOW(inter_fd,0) = 0x3007;
WFIFOL(inter_fd,2) = u_fd;
WFIFOL(inter_fd,6) = aid;
WFIFOL(inter_fd,10) = group_id;
WFIFOL(inter_fd,10) = group_lv;
safestrncpy((char *)WFIFOP(inter_fd,14), query, NAME_LENGTH);

WFIFOSET(inter_fd,2 + 4 + 4 + 4 + NAME_LENGTH);
Expand Down
2 changes: 1 addition & 1 deletion src/map/intif.h
Expand Up @@ -105,7 +105,7 @@ int intif_elemental_delete(int ele_id);
int intif_elemental_save(struct s_elemental *ele);

/* @accinfo */
void intif_request_accinfo( int u_fd, int aid, int group_id, char* query );
void intif_request_accinfo( int u_fd, int aid, int group_lv, char* query );

int CheckForCharServer(void);

Expand Down

0 comments on commit 9b5ec24

Please sign in to comment.