* been created if the channel did not exist before the user was joined to it.
* If the user could not be joined to a channel, the return value may be NULL.
*/
- static chanrec* JoinUser(InspIRCd* ServerInstance, userrec *user, const char* cn, bool override, const char* key = "");
+ static chanrec* JoinUser(InspIRCd* ServerInstance, userrec *user, const char* cn, bool override, const char* key, time_t TS = 0);
/** Write to a channel, from a user, using va_args for text
* @param user User whos details to prefix the line with
* add a channel to a user, creating the record for it if needed and linking
* it to the user record
*/
-chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bool override, const char* key)
+chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bool override, const char* key, time_t TS)
{
if (!user || !cn)
return NULL;
if (!Ptr)
{
+ if ((!IS_LOCAL(user)) && (!TS))
+ Instance->Log(DEBUG,"*** BUG *** chanrec::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick, cn);
+
privs = "@";
if (IS_LOCAL(user) && override == false)
if (IS_LOCAL(user))
Ptr->modes[CM_TOPICLOCK] = Ptr->modes[CM_NOEXTERNAL] = 1;
- Ptr->created = Instance->Time();
+ Ptr->created = TS ? TS : Instance->Time();
*Ptr->topic = 0;
*Ptr->setby = 0;
Ptr->topicset = 0;
if (ServerInstance->IsChannel(parameters[0]))
{
- chanrec::JoinUser(ServerInstance, user, parameters[0], false);
+ chanrec::JoinUser(ServerInstance, user, parameters[0], false, "");
return CMD_SUCCESS;
}
}
else
{
user->WriteServ("470 %s :You are banned from %s. You are being automatically redirected to %s", user->nick, chan->name, redir->targetchan.c_str());
- chanrec::JoinUser(Srv, user, redir->targetchan.c_str(), false);
+ chanrec::JoinUser(Srv, user, redir->targetchan.c_str(), false, "");
return 1;
}
}
for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++)
if (ServerInstance->IsChannel(it->c_str()))
- chanrec::JoinUser(ServerInstance, user, it->c_str(), false);
+ chanrec::JoinUser(ServerInstance, user, it->c_str(), false, "");
}
};
for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++)
if (ServerInstance->IsChannel(it->c_str()))
- chanrec::JoinUser(ServerInstance, user, it->c_str(), false);
+ chanrec::JoinUser(ServerInstance, user, it->c_str(), false, "");
}
};
}
user->WriteServ("470 %s :%s has become full, so you are automatically being transferred to the linked channel %s", user->nick, cname, channel.c_str());
- chanrec::JoinUser(ServerInstance, user, channel.c_str(), false);
+ chanrec::JoinUser(ServerInstance, user, channel.c_str(), false, "");
return 1;
}
}
return CMD_FAILURE;
}
- chanrec::JoinUser(ServerInstance, dest, parameters[1], true);
+ chanrec::JoinUser(ServerInstance, dest, parameters[1], true, "");
/* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propogate */
chanrec* n = ServerInstance->FindChan(parameters[1]);
/* Finally, we can actually place the user into the channel.
* We're sure its right. Final answer, phone a friend.
*/
- chanrec::JoinUser(this->Instance, who, channel.c_str(), true, "");
+ if (created)
+ chanrec::JoinUser(this->Instance, who, channel.c_str(), true, "", TS);
+ else
+ chanrec::JoinUser(this->Instance, who, channel.c_str(), true, "");
/* Have we already queued up MAXMODES modes with parameters
* (+qaohv) ready to be sent to the server?
*/
for (unsigned int f = 2; f < modectr; f++)
free(mode_users[f]);
}
- /* if we newly created the channel, set it's TS properly. */
- if (created)
- {
- /* find created channel .. */
- chan = this->Instance->FindChan(channel);
- if (chan)
- /* w00t said this shouldnt be needed but it is.
- * This isnt strictly true, as chan can be NULL
- * if a nick collision has occured and therefore
- * the channel was never created.
- */
- chan->age = TS;
- }
/* All done. That wasnt so bad was it, you can wipe
* the sweat from your forehead now. :-)
*/
{
/* only join if it's local, otherwise just pass it on! */
if (IS_LOCAL(u))
- chanrec::JoinUser(this->Instance, u, params[1].c_str(), false);
+ chanrec::JoinUser(this->Instance, u, params[1].c_str(), false, "", Instance->Time());
Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix);
}
return true;