summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/login/login.c66
-rw-r--r--src/map/clif.c27
-rw-r--r--src/map/clif.h7
3 files changed, 26 insertions, 74 deletions
diff --git a/src/login/login.c b/src/login/login.c
index 9efd28a53..457a25f64 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -919,8 +919,7 @@ int parse_fromchar(int fd)
//-------------------------------------
// Make new account
//-------------------------------------
-int mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip)
-{
+int mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) {
static int num_regs = 0; // registration counter
static unsigned int new_reg_tick = 0;
unsigned int tick = gettick();
@@ -929,8 +928,7 @@ int mmo_auth_new(const char* userid, const char* pass, const char sex, const cha
//Account Registration Flood Protection by [Kevin]
if( new_reg_tick == 0 )
new_reg_tick = gettick();
- if( DIFF_TICK(tick, new_reg_tick) < 0 && num_regs >= allowed_regs )
- {
+ if( DIFF_TICK(tick, new_reg_tick) < 0 && num_regs >= allowed_regs ) {
ShowNotice("Account registration denied (registration limit exceeded)\n");
return 3;
}
@@ -943,8 +941,7 @@ int mmo_auth_new(const char* userid, const char* pass, const char sex, const cha
return 0; // 0 = Unregistered ID
// check if the account doesn't exist already
- if( accounts->load_str(accounts, &acc, userid) )
- {
+ if( accounts->load_str(accounts, &acc, userid) ) {
ShowNotice("Attempt of creation of an already existant account (account: %s_%c, pass: %s, received pass: %s)\n", userid, sex, acc.pass, pass);
return 1; // 1 = Incorrect Password
}
@@ -965,8 +962,7 @@ int mmo_auth_new(const char* userid, const char* pass, const char sex, const cha
ShowNotice("Account creation (account %s, id: %d, pass: %s, sex: %c)\n", acc.userid, acc.account_id, acc.pass, acc.sex);
- if( DIFF_TICK(tick, new_reg_tick) > 0 )
- {// Update the registration check.
+ if( DIFF_TICK(tick, new_reg_tick) > 0 ) {// Update the registration check.
num_regs = 0;
new_reg_tick = tick + time_allowed*1000;
}
@@ -978,8 +974,7 @@ int mmo_auth_new(const char* userid, const char* pass, const char sex, const cha
//-----------------------------------------------------
// Check/authentication of a connection
//-----------------------------------------------------
-int mmo_auth(struct login_session_data* sd, bool isServer)
-{
+int mmo_auth(struct login_session_data* sd, bool isServer) {
struct mmo_account acc;
int len;
@@ -987,28 +982,22 @@ int mmo_auth(struct login_session_data* sd, bool isServer)
ip2str(session[sd->fd]->client_addr, ip);
// DNS Blacklist check
- if( login_config.use_dnsbl )
- {
+ if( login_config.use_dnsbl ) {
char r_ip[16];
char ip_dnsbl[256];
char* dnsbl_serv;
- bool matched = false;
uint8* sin_addr = (uint8*)&session[sd->fd]->client_addr;
sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]);
- for( dnsbl_serv = strtok(login_config.dnsbl_servs,","); !matched && dnsbl_serv != NULL; dnsbl_serv = strtok(NULL,",") )
- {
+ for( dnsbl_serv = strtok(login_config.dnsbl_servs,","); dnsbl_serv != NULL; dnsbl_serv = strtok(NULL,",") ) {
sprintf(ip_dnsbl, "%s.%s", r_ip, trim(dnsbl_serv));
- if( host2ip(ip_dnsbl) )
- matched = true;
+ if( host2ip(ip_dnsbl) ) {
+ ShowInfo("DNSBL: (%s) Blacklisted. User Kicked.\n", r_ip);
+ return 3;
+ }
}
- if( matched )
- {
- ShowInfo("DNSBL: (%s) Blacklisted. User Kicked.\n", r_ip);
- return 3;
- }
}
//Client Version check
@@ -1018,8 +1007,7 @@ int mmo_auth(struct login_session_data* sd, bool isServer)
len = strnlen(sd->userid, NAME_LENGTH);
// Account creation with _M/_F
- if( login_config.new_account_flag )
- {
+ if( login_config.new_account_flag ) {
if( len > 2 && strnlen(sd->passwd, NAME_LENGTH) > 0 && // valid user and password lengths
sd->passwdenc == 0 && // unencoded password
sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4) ) // _M/_F suffix
@@ -1036,53 +1024,44 @@ int mmo_auth(struct login_session_data* sd, bool isServer)
}
}
- if( !accounts->load_str(accounts, &acc, sd->userid) )
- {
+ if( !accounts->load_str(accounts, &acc, sd->userid) ) {
ShowNotice("Unknown account (account: %s, received pass: %s, ip: %s)\n", sd->userid, sd->passwd, ip);
return 0; // 0 = Unregistered ID
}
- if( !check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) )
- {
+ if( !check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) {
ShowNotice("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n", sd->userid, acc.pass, sd->passwd, ip);
return 1; // 1 = Incorrect Password
}
- if( acc.expiration_time != 0 && acc.expiration_time < time(NULL) )
- {
+ if( acc.expiration_time != 0 && acc.expiration_time < time(NULL) ) {
ShowNotice("Connection refused (account: %s, pass: %s, expired ID, ip: %s)\n", sd->userid, sd->passwd, ip);
return 2; // 2 = This ID is expired
}
- if( acc.unban_time != 0 && acc.unban_time > time(NULL) )
- {
+ if( acc.unban_time != 0 && acc.unban_time > time(NULL) ) {
char tmpstr[24];
timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login_config.date_format);
ShowNotice("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n", sd->userid, sd->passwd, tmpstr, ip);
return 6; // 6 = Your are Prohibited to log in until %s
}
- if( acc.state != 0 )
- {
+ if( acc.state != 0 ) {
ShowNotice("Connection refused (account: %s, pass: %s, state: %d, ip: %s)\n", sd->userid, sd->passwd, acc.state, ip);
return acc.state - 1;
}
- if( login_config.client_hash_check && !isServer )
- {
+ if( login_config.client_hash_check && !isServer ) {
struct client_hash_node *node = login_config.client_hash_nodes;
bool match = false;
- if( !sd->has_client_hash )
- {
+ if( !sd->has_client_hash ) {
ShowNotice("Client doesn't sent client hash (account: %s, pass: %s, ip: %s)\n", sd->userid, sd->passwd, acc.state, ip);
return 5;
}
- while( node )
- {
- if( node->group_id <= acc.group_id && memcmp(node->hash, sd->client_hash, 16) == 0 )
- {
+ while( node ) {
+ if( node->group_id <= acc.group_id && memcmp(node->hash, sd->client_hash, 16) == 0 ) {
match = true;
break;
}
@@ -1090,8 +1069,7 @@ int mmo_auth(struct login_session_data* sd, bool isServer)
node = node->next;
}
- if( !match )
- {
+ if( !match ) {
char smd5[33];
int i;
diff --git a/src/map/clif.c b/src/map/clif.c
index 1dc1e3b11..26a5cdf8a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5461,25 +5461,6 @@ void clif_broadcast(struct block_list* bl, const char* mes, int len, int type, e
aFree(buf);
}
-
-/*==========================================
- * Displays a message on a 'bl' to all it's nearby clients
- * Used by npc_globalmessage
- *------------------------------------------*/
-void clif_GlobalMessage(struct block_list* bl, const char* message)
-{
- clif_notify_chat(bl, message, ALL_CLIENT);
-}
-
-/*==========================================
- * Send main chat message [LuzZza]
- *------------------------------------------*/
-void clif_MainChatMessage(const char* message)
-{
- clif_notify_chat(NULL, message, CHAT_MAINCHAT);
-}
-
-
/// Send broadcast message with font formatting (ZC_BROADCAST2).
/// 01c3 <packet len>.W <fontColor>.L <fontType>.W <fontSize>.W <fontAlign>.W <fontY>.W <message>.?B
void clif_broadcast2(struct block_list* bl, const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target)
@@ -8198,14 +8179,6 @@ void clif_messagecolor(struct block_list* bl, unsigned long color, const char* m
clif_send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC);
}
-
-/// Public chat message [Valaris]
-void clif_message(struct block_list* bl, const char* msg)
-{
- clif_notify_chat(bl, msg, AREA_CHAT_WOC);
-}
-
-
// refresh the client's screen, getting rid of any effects
void clif_refresh(struct map_session_data *sd)
{
diff --git a/src/map/clif.h b/src/map/clif.h
index 1079d54ca..6808810c1 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -373,7 +373,6 @@ void clif_misceffect(struct block_list* bl,int type); // area
void clif_changeoption(struct block_list* bl); // area
void clif_changeoption2(struct block_list* bl); // area
void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok); // self
-void clif_GlobalMessage(struct block_list* bl, const char* message);
void clif_createchat(struct map_session_data* sd, int flag); // self
void clif_dispchat(struct chat_data* cd, int fd); // area or fd
void clif_joinchatfail(struct map_session_data *sd,int flag); // self
@@ -574,7 +573,6 @@ void clif_displaymessage(const int fd, const char* mes);
void clif_disp_onlyself(struct map_session_data *sd, const char *mes, int len);
void clif_disp_message(struct block_list* src, const char* mes, int len, enum send_target target);
void clif_broadcast(struct block_list* bl, const char* mes, int len, int type, enum send_target target);
-void clif_MainChatMessage(const char* message); //luzza
void clif_broadcast2(struct block_list* bl, const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target);
void clif_heal(int fd,int type,int val);
void clif_resurrection(struct block_list *bl,int type);
@@ -605,7 +603,6 @@ void clif_weather(int m); // [Valaris]
void clif_specialeffect(struct block_list* bl, int type, enum send_target target); // special effects [Valaris]
void clif_specialeffect_single(struct block_list* bl, int type, int fd);
void clif_messagecolor(struct block_list* bl, unsigned long color, const char* msg); // Mob/Npc color talk [SnakeDrak]
-void clif_message(struct block_list* bl, const char* msg); // messages (from mobs/npcs) [Valaris]
void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target);
void clif_GM_kickack(struct map_session_data *sd, int id);
@@ -770,4 +767,8 @@ int clif_colormes(struct map_session_data * sd, enum clif_colors color, const ch
#define clif_menuskill_clear(sd) (sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0;
+#define clif_GlobalMessage(bl,message) clif_notify_chat(bl, message, ALL_CLIENT)
+#define clif_MainChatMessage(message) clif_notify_chat(NULL, message, CHAT_MAINCHAT)
+#define clif_message(bl,msg) clif_notify_chat(bl, msg, AREA_CHAT_WOC)
+
#endif /* _CLIF_H_ */