summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/chat.c16
-rw-r--r--src/map/chat.h1
2 files changed, 13 insertions, 4 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index 933674db8..e2e5077e6 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -58,6 +58,8 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl
map_addiddb(&cd->bl);
+ cd->kick_list = idb_alloc(DB_OPT_BASE);
+
return cd;
}
@@ -128,8 +130,7 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
return 0;
}
- if( sd->status.base_level < cd->minLvl || sd->status.base_level > cd->maxLvl )
- {
+ if( sd->status.base_level < cd->minLvl || sd->status.base_level > cd->maxLvl ) {
if(sd->status.base_level < cd->minLvl)
clif_joinchatfail(sd,5);
else
@@ -138,12 +139,16 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
return 0;
}
- if( sd->status.zeny < cd->zeny )
- {
+ if( sd->status.zeny < cd->zeny ) {
clif_joinchatfail(sd,4);
return 0;
}
+ if( idb_exists(cd->kick_list,sd->status.char_id) ) {
+ clif_joinchatfail(sd,2);//You have been kicked out of the room.
+ return 0;
+ }
+
pc_stop_walking(sd,1);
cd->usersd[cd->users] = sd;
cd->users++;
@@ -198,6 +203,7 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
if( cd->users == 0 && cd->owner->type == BL_PC )
{ // Delete empty chatroom
clif_clearchat(cd, 0);
+ cd->kick_list->destroy(cd->kick_list, NULL);
map_deliddb(&cd->bl);
map_delblock(&cd->bl);
map_freeblock(&cd->bl);
@@ -312,6 +318,8 @@ int chat_kickchat(struct map_session_data* sd, const char* kickusername)
if( battle_config.gm_kick_chat && pc_isGM(cd->usersd[i]) >= battle_config.gm_kick_chat )
return 0; //gm kick protection [Valaris]
+
+ idb_put(cd->kick_list,cd->usersd[i]->status.char_id,(void*)1);
chat_leavechat(cd->usersd[i],1);
return 0;
diff --git a/src/map/chat.h b/src/map/chat.h
index b80832d3d..cb2e6ecd9 100644
--- a/src/map/chat.h
+++ b/src/map/chat.h
@@ -23,6 +23,7 @@ struct chat_data {
struct map_session_data* usersd[20];
struct block_list* owner;
char npc_event[EVENT_NAME_LENGTH];
+ DBMap* kick_list; //DBMap of users who were kicked from this chat
};