Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum channel_operation_status channel_join(struct channel_data *chan, struct map_session_data *sd, const char *password, bool silent)
- {
- bool stealth = false;
- nullpo_retr(HCS_STATUS_FAIL, chan);
- nullpo_retr(HCS_STATUS_FAIL, sd);
- if (idb_exists(chan->users, sd->status.char_id)) {
- return HCS_STATUS_ALREADY;
- }
- if (chan->password[0] != '\0' && strcmp(chan->password, password) != 0) {
- if (pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) {
- stealth = true;
- } else {
- return HCS_STATUS_NOPERM;
- }
- }
- if (chan->banned && idb_exists(chan->banned, sd->status.account_id))
- {
- struct channel_ban_entry *banentry = (struct channel_ban_entry *)idb_get(chan->banned, sd->status.account_id);
- time_t i;
- if ( banentry == NULL ) // well somehow it's null
- return HCS_STATUS_BANNED;
- i = atoi(banentry->time);
- if ( i >= time(NULL) )
- return HCS_STATUS_BANNED;
- }
- if (!silent && !(chan->options&HCS_OPT_ANNOUNCE_JOIN)) {
- char output[CHAT_SIZE_MAX];
- if (chan->type == HCS_TYPE_MAP) {
- sprintf(output, msg_sd(sd,1435), chan->name, map->list[chan->m].name); // You're now in the '#%s' channel for '%s'
- } else {
- sprintf(output, msg_sd(sd,1403), chan->name); // You're now in the '%s' channel
- }
- clif->colormes(sd->fd, COLOR_DEFAULT, output);
- }
- if (chan->type == HCS_TYPE_ALLY) {
- struct guild *g = sd->guild;
- int i;
- for (i = 0; i < MAX_GUILDALLIANCE; i++) {
- struct guild *sg = NULL;
- if (g->alliance[i].opposition == 0 && g->alliance[i].guild_id && (sg = guild->search(g->alliance[i].guild_id))) {
- if (!(sg->channel->banned && idb_exists(sg->channel->banned, sd->status.account_id))) {
- channel->join_sub(sg->channel, sd, stealth);
- }
- }
- }
- }
- channel->join_sub(chan, sd, stealth);
- return HCS_STATUS_OK;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement