- for(std::deque<HistoryItem>::iterator i = list->lines.begin(); i != list->lines.end(); ++i)
- memb->user->Write(i->line);
+
+ list->lines.push_back(HistoryItem(user, details));
+ if (list->lines.size() > list->maxlen)
+ list->lines.pop_front();
+ }
+
+ void OnPostJoin(Membership* memb) CXX11_OVERRIDE
+ {
+ LocalUser* localuser = IS_LOCAL(memb->user);
+ if (!localuser)
+ return;
+
+ if (memb->user->IsModeSet(botmode) && !dobots)
+ return;
+
+ if (memb->user->IsModeSet(nohistorymode))
+ return;
+
+ HistoryList* list = historymode.ext.get(memb->chan);
+ if (!list)
+ return;
+
+ if ((prefixmsg) && (!batchcap.get(localuser)))
+ {
+ std::string message("Replaying up to " + ConvToStr(list->maxlen) + " lines of pre-join history");
+ if (list->maxtime > 0)
+ message.append(" from the last " + InspIRCd::DurationString(list->maxtime));
+ memb->WriteNotice(message);
+ }
+
+ time_t mintime = 0;
+ if (list->maxtime)
+ mintime = ServerInstance->Time() - list->maxtime;
+
+ SendHistory(localuser, memb->chan, list, mintime);