{
struct chanData *cData;
char *topic;
+ int p10 = 0;
+
+#ifdef WITH_PROTOCOL_P10
+ p10 = 1;
+#endif
cData = channel->channel_info;
if(argc < 2)
{
if(cData->topic)
{
- SetChannelTopic(channel, chanserv, cData->topic, 1);
+ SetChannelTopic(channel, chanserv, p10 ? user : chanserv, cData->topic, 1);
reply("CSMSG_TOPIC_SET", cData->topic);
return 1;
}
reply("CSMSG_TOPICMASK_CONFLICT2", TOPICLEN);
return 0;
}
- SetChannelTopic(channel, chanserv, new_topic, 1);
+ SetChannelTopic(channel, chanserv, p10 ? user : chanserv, new_topic, 1);
}
else /* No mask set, just set the topic */
- SetChannelTopic(channel, chanserv, topic, 1);
+ SetChannelTopic(channel, chanserv, p10 ? user : chanserv, topic, 1);
}
if(check_user_level(channel, user, lvlTopicSnarf, 1, 0))
&& !match_ircglob(channel->channel_info->topic, channel->channel_info->topic_mask))
reply("CSMSG_TOPIC_MISMATCH", channel->name);
}
- SetChannelTopic(channel, chanserv, topic ? topic : "", 1);
+ SetChannelTopic(channel, chanserv, chanserv, topic ? topic : "", 1);
}
if(channel->channel_info->topic)
if((refresh_num - cData->last_refresh) < (unsigned int)(1 << (opt - '1')))
continue;
if(cData->topic)
- SetChannelTopic(cData->channel, chanserv, cData->topic, 1);
+ SetChannelTopic(cData->channel, chanserv, chanserv, cData->topic, 1);
cData->last_refresh = refresh_num;
}
timeq_add(now + chanserv_conf.refresh_period, chanserv_refresh_topics, NULL);
mod_chanmode_announce(chanserv, cData->channel, &cData->modes);
if(self->uplink && !self->uplink->burst && channel->channel_info->topic)
- SetChannelTopic(channel, chanserv, channel->channel_info->topic, 1);
+ SetChannelTopic(channel, chanserv, chanserv, channel->channel_info->topic, 1);
}
/* Welcome to my worst nightmare. Warning: Read (or modify)
if(bad_topic(channel, user, channel->topic))
{ /* User doesnt have privs to set topics. Undo it */
send_message(user, chanserv, "CSMSG_TOPIC_LOCKED", channel->name);
- SetChannelTopic(channel, chanserv, old_topic, 1);
+ SetChannelTopic(channel, chanserv, chanserv, old_topic, 1);
return 1;
}
/* If there is a topic mask set, and the new topic doesnt match,
conform_topic(cData->topic_mask, channel->topic, new_topic);
if(*new_topic)
{
- SetChannelTopic(channel, chanserv, new_topic, 1);
+ SetChannelTopic(channel, chanserv, chanserv, new_topic, 1);
/* and fall through to topicsnarf code below.. */
}
else /* Topic couldnt fit into mask, was too long */
{
- SetChannelTopic(channel, chanserv, old_topic, 1);
+ SetChannelTopic(channel, chanserv, chanserv, old_topic, 1);
send_message(user, chanserv, "CSMSG_TOPICMASK_CONFLICT1", channel->name, cData->topic_mask);
send_message(user, chanserv, "CSMSG_TOPICMASK_CONFLICT2", TOPICLEN);
return 1;
}
void
-irc_topic(struct userNode *who, struct chanNode *what, const char *topic)
+irc_topic(struct userNode *service, struct userNode *who, struct chanNode *what, const char *topic)
{
+/* UNCOMMENT FOR NEFARIOUS 0.5.0 TOPIC SUPPORT
+ * putsock("%s " P10_TOPIC " %s %s " FMT_TIME_T " " FMT_TIME_T " :%s", service->numeric, what->name, who->nick, what->timestamp, now, topic);
+ * UNCOMMENT FOR NEFARIOUS 0.5.0 TOPIC SUPPORT */
+
+ who = service; /* REMOVE LINE FOR NEFARIOUS 0.5.0 */
+
putsock("%s " P10_TOPIC " %s :%s", who->numeric, what->name, topic);
}
{
struct chanNode *cn;
time_t chan_ts, topic_ts;
+ struct userNode *user;
if (argc < 3)
return 0;
log_module(MAIN_LOG, LOG_ERROR, "Unable to find channel %s whose topic is being set", argv[1]);
return 0;
}
- if (argc >= 5) {
- /* Looks like an Asuka style topic burst. */
+
+
+ if (argc == 5) { /* Asuka / Topic Bursting IRCu's */
+ user = GetUserH(origin);
chan_ts = atoi(argv[2]);
topic_ts = atoi(argv[3]);
- } else {
+ } else if (argc >= 6) { /* Nefarious 0.5.0 */
+ user = GetUserH(strtok(argv[2], "!"));
+ chan_ts = atoi(argv[3]);
+ topic_ts = atoi(argv[4]);
+ } else { /* Regular IRCu (No Topic Bursting)*/
+ user = GetUserH(origin);
chan_ts = cn->timestamp;
topic_ts = now;
}
- SetChannelTopic(cn, GetUserH(origin), argv[argc-1], 0);
+
+ SetChannelTopic(cn, user, user, argv[argc-1], 0);
cn->topic_time = topic_ts;
return 1;
}