-/* cmd_neonserv_topic.c - NeonServ v5.4
+/* cmd_neonserv_topic.c - NeonServ v5.6
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
if(argc == 0) {
//default topic!
putsock(client, "TOPIC %s :%s", chan->name, row[5]);
- reply(getTextBot(), user, "NS_TOPIC_DONE", row[5]);
+ reply(textclient, user, "NS_TOPIC_DONE", row[5]);
logEvent(event);
return;
}
int uaccess = getChannelAccess(user, chan);
- if(uaccess >= atoi((row[3] ? row[3] : default_row[1]))) {
+ if(!strcmp(row[2], "") || uaccess >= atoi((row[3] ? row[3] : default_row[1]))) {
//just set the topic
newtopic = merge_argv(argv, 0, argc);
if(uaccess >= atoi((row[4] ? row[4] : default_row[2]))) {
printf_mysql_query("UPDATE `channels` SET `channel_defaulttopic` = '%s' WHERE `channel_id` = '%d'", escape_string(newtopic), chan->channel_id);
}
putsock(client, "TOPIC %s :%s", chan->name, newtopic);
- reply(getTextBot(), user, "NS_TOPIC_DONE", newtopic);
+ reply(textclient, user, "NS_TOPIC_DONE", newtopic);
logEvent(event);
return;
}
int topic_id = 0;
topic_id = atoi(argv[0]);
if(!topic_id || topic_id > ADVANCEDTOPIC_MAXID) {
- reply(getTextBot(), user, "NS_EXTTOPIC_INVALID_ID", argv[0]);
+ reply(textclient, user, "NS_EXTTOPIC_INVALID_ID", argv[0]);
return;
}
//parse topics
advtopics[i] = "";
if(argc < 2) {
//just show the topic with this id
- reply(getTextBot(), user, "NS_EXTTOPIC_TOPICID", topic_id, advtopics[topic_id-1]);
+ reply(textclient, user, "NS_EXTTOPIC_TOPICID", topic_id, advtopics[topic_id-1]);
return;
}
newtopic = merge_argv(argv, 1, argc);
if(topiclistpos > MAXLEN)
topiclist[MAXLEN] = '\0';
putsock(client, "TOPIC %s :%s", chan->name, topiclist);
- reply(getTextBot(), user, "NS_TOPIC_DONE", topiclist);
+ reply(textclient, user, "NS_TOPIC_DONE", topiclist);
logEvent(event);
} else {
newtopic = merge_argv(argv, 0, argc);
if(topiclistpos > MAXLEN)
topiclist[MAXLEN] = '\0';
putsock(client, "TOPIC %s :%s", chan->name, topiclist);
- reply(getTextBot(), user, "NS_TOPIC_DONE", topiclist);
+ reply(textclient, user, "NS_TOPIC_DONE", topiclist);
logEvent(event);
}
}