/* * Heavily modified from the ircu m_motd by codemastr * Also svsmotd support added */ DLLFUNC CMD_FUNC(m_rules) { ConfigItem_tld *ptr; aMotd *temp; char userhost[USERLEN + HOSTLEN + 6]; if (IsServer(sptr)) return 0; if (hunt_server_token(cptr, sptr, MSG_RULES, TOK_RULES, ":%s", 1, parc, parv) != HUNTED_ISME) return 0; #ifndef TLINE_Remote if (!MyConnect(sptr)) { temp = rules; goto playrules; } #endif strlcpy(userhost,make_user_host(cptr->user->username, cptr->user->realhost), sizeof userhost); ptr = Find_tld(sptr, userhost); if (ptr) { temp = ptr->rules; } else temp = rules; playrules: if (temp == NULL) { sendto_one(sptr, err_str(ERR_NORULES), me.name, parv[0]); return 0; } sendto_one(sptr, rpl_str(RPL_RULESSTART), me.name, parv[0], me.name); while (temp) { sendto_one(sptr, rpl_str(RPL_RULES), me.name, parv[0], temp->line); temp = temp->next; } sendto_one(sptr, rpl_str(RPL_ENDOFRULES), me.name, parv[0]); return 0; }
/* * Modified from comstud by codemastr */ DLLFUNC CMD_FUNC(m_botmotd) { aMotd *temp; ConfigItem_tld *ptr; char userhost[HOSTLEN + USERLEN + 6]; if (hunt_server_token(cptr, sptr, MSG_BOTMOTD, TOK_BOTMOTD, ":%s", 1, parc, parv) != HUNTED_ISME) return 0; if (!IsPerson(sptr)) return 0; strlcpy(userhost,make_user_host(sptr->user->username, sptr->user->realhost), sizeof userhost); ptr = Find_tld(sptr, userhost); if (ptr) { if (ptr->botmotd) temp = ptr->botmotd; else temp = botmotd; } else temp = botmotd; if (!temp) { sendto_one(sptr, ":%s NOTICE %s :BOTMOTD File not found", me.name, sptr->name); return 0; } sendto_one(sptr, ":%s NOTICE %s :- %s Bot Message of the Day - ", me.name, sptr->name, me.name); while (temp) { sendto_one(sptr, ":%s NOTICE %s :- %s", me.name, sptr->name, temp->line); temp = temp->next; } sendto_one(sptr, ":%s NOTICE %s :End of /BOTMOTD command.", me.name, sptr->name); return 0; }
/* * Modified from comstud by codemastr */ DLLFUNC CMD_FUNC(m_botmotd) { aMotdLine *motdline; ConfigItem_tld *tld; char userhost[HOSTLEN + USERLEN + 6]; if (hunt_server(cptr, sptr, ":%s BOTMOTD :%s", 1, parc, parv) != HUNTED_ISME) return 0; if (!IsPerson(sptr)) return 0; strlcpy(userhost, make_user_host(sptr->user->username, sptr->user->realhost), sizeof(userhost)); tld = Find_tld(sptr, userhost); motdline = NULL; if (tld) motdline = tld->botmotd.lines; if (!motdline) motdline = botmotd.lines; if (!motdline) { sendto_one(sptr, ":%s NOTICE %s :BOTMOTD File not found", me.name, sptr->name); return 0; } sendto_one(sptr, ":%s NOTICE %s :- %s Bot Message of the Day - ", me.name, sptr->name, me.name); while (motdline) { sendto_one(sptr, ":%s NOTICE %s :- %s", me.name, sptr->name, motdline->line); motdline = motdline->next; } sendto_one(sptr, ":%s NOTICE %s :End of /BOTMOTD command.", me.name, sptr->name); return 0; }
/* * Heavily modified from the ircu m_motd by codemastr * Also svsmotd support added */ int short_motd(aClient *sptr) { ConfigItem_tld *tld; aMotdFile *themotd; aMotdLine *motdline; struct tm *tm; char userhost[HOSTLEN + USERLEN + 6]; char is_short; tm = NULL; is_short = 1; strlcpy(userhost,make_user_host(sptr->user->username, sptr->user->realhost), sizeof userhost); tld = Find_tld(sptr, userhost); /* * Try different sources of short MOTDs, falling back to the * long MOTD. */ themotd = &smotd; if (tld && tld->smotd.lines) themotd = &tld->smotd; /* try long MOTDs */ if (!themotd->lines) { is_short = 0; if (tld && tld->motd.lines) themotd = &tld->motd; else themotd = &motd; } if (!themotd->lines) { sendto_one(sptr, err_str(ERR_NOMOTD), me.name, sptr->name); return 0; } if (themotd->last_modified.tm_year) { tm = &themotd->last_modified; /* for readability */ sendto_one(sptr, rpl_str(RPL_MOTDSTART), me.name, sptr->name, me.name); sendto_one(sptr, ":%s %d %s :- %d/%d/%d %d:%02d", me.name, RPL_MOTD, sptr->name, tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year, tm->tm_hour, tm->tm_min); } if (is_short) { sendto_one(sptr, rpl_str(RPL_MOTD), me.name, sptr->name, "This is the short MOTD. To view the complete MOTD type /motd"); sendto_one(sptr, rpl_str(RPL_MOTD), me.name, sptr->name, ""); } motdline = NULL; if (themotd) motdline = themotd->lines; while (motdline) { sendto_one(sptr, rpl_str(RPL_MOTD), me.name, sptr->name, motdline->line); motdline = motdline->next; } sendto_one(sptr, rpl_str(RPL_ENDOFMOTD), me.name, sptr->name); return 0; }
/* * Heavily modified from the ircu m_motd by codemastr * Also svsmotd support added */ DLLFUNC CMD_FUNC(m_motd) { ConfigItem_tld *ptr; aMotd *temp, *temp2; struct tm *tm = &motd_tm; int svsnofile = 0; char userhost[HOSTLEN + USERLEN + 6]; if (IsServer(sptr)) return 0; if (hunt_server_token(cptr, sptr, MSG_MOTD, TOK_MOTD, ":%s", 1, parc, parv) != HUNTED_ISME) return 0; #ifndef TLINE_Remote if (!MyConnect(sptr)) { temp = motd; goto playmotd; } #endif strlcpy(userhost,make_user_host(cptr->user->username, cptr->user->realhost), sizeof userhost); ptr = Find_tld(sptr, userhost); if (ptr) { temp = ptr->motd; tm = &ptr->motd_tm; } else temp = motd; playmotd: if (temp == NULL) { sendto_one(sptr, err_str(ERR_NOMOTD), me.name, parv[0]); svsnofile = 1; goto svsmotd; } if (tm) { sendto_one(sptr, rpl_str(RPL_MOTDSTART), me.name, parv[0], me.name); sendto_one(sptr, ":%s %d %s :- %d/%d/%d %d:%02d", me.name, RPL_MOTD, parv[0], tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year, tm->tm_hour, tm->tm_min); } while (temp) { sendto_one(sptr, rpl_str(RPL_MOTD), me.name, parv[0], temp->line); temp = temp->next; } svsmotd: temp2 = svsmotd; while (temp2) { sendto_one(sptr, rpl_str(RPL_MOTD), me.name, parv[0], temp2->line); temp2 = temp2->next; } if (svsnofile == 0) sendto_one(sptr, rpl_str(RPL_ENDOFMOTD), me.name, parv[0]); return 0; }