summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-01-22 18:37:56 +0100
committerHaru <haru@dotalux.com>2015-01-24 14:37:25 +0100
commit30ac667346838d1777eed6cf90ce24341c6d2914 (patch)
tree9d0ae008e5bb036a4c524367e5c09d08a6a5a79e /src/map/atcommand.c
parent5066af1700e95b5db24f9998cf1ff052b45f5fa0 (diff)
downloadhercules-30ac667346838d1777eed6cf90ce24341c6d2914.tar.gz
hercules-30ac667346838d1777eed6cf90ce24341c6d2914.tar.bz2
hercules-30ac667346838d1777eed6cf90ce24341c6d2914.tar.xz
hercules-30ac667346838d1777eed6cf90ce24341c6d2914.zip
Channels refactoring: search
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 0f33a387c..a6e4d7265 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8623,20 +8623,8 @@ ACMD(join)
clif->message(fd, atcmd_output);
return false;
}
- if (channel->config->local && strcmpi(name + 1, channel->config->local_name) == 0) {
- if( !map->list[sd->bl.m].channel ) {
- channel->map_join(sd);
- if( map->list[sd->bl.m].channel ) /* join might have refused, map has chatting capabilities disabled */
- return true;
- } else
- chan = map->list[sd->bl.m].channel;
- } else if (channel->config->ally && sd->status.guild_id && strcmpi(name + 1, channel->config->ally_name) == 0) {
- struct guild *g = sd->guild;
- if( !g ) return false;/* unlikely, but we wont let it crash anyway. */
- chan = g->channel;
- } else {
- chan = strdb_get(channel->db, name + 1);
- }
+
+ chan = channel->search(name, sd);
if(!chan) {
sprintf(atcmd_output, msg_txt(1400),name,command); // Unknown Channel '%s' (usage: %s <#channel_name>)
@@ -8799,7 +8787,7 @@ ACMD(channel) {
return false;
}
- if (!(chan = strdb_get(channel->db, sub1 + 1))) {
+ if (!(chan = channel->search(sub1, sd))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
@@ -8894,7 +8882,7 @@ ACMD(channel) {
return false;
}
- if (!(chan = strdb_get(channel->db, sub1 + 1))) {
+ if (!(chan = channel->search(sub1, sd))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
@@ -8943,7 +8931,7 @@ ACMD(channel) {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
- if (!(chan = strdb_get(channel->db, sub1 + 1))) {
+ if (!(chan = channel->search(sub1, sd))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
@@ -8980,7 +8968,7 @@ ACMD(channel) {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
- if (!(chan = strdb_get(channel->db, sub1 + 1))) {
+ if (!(chan = channel->search(sub1, sd))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
@@ -9009,7 +8997,7 @@ ACMD(channel) {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
- if (!(chan = strdb_get(channel->db, sub1 + 1))) {
+ if (!(chan = channel->search(sub1, sd))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
@@ -9050,7 +9038,7 @@ ACMD(channel) {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
- if (!(chan = strdb_get(channel->db, sub1 + 1))) {
+ if (!(chan = channel->search(sub1, sd))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;