- if (sptr)
- {
- no_motd = 0;
-#endif
- if (hunt_server(0, cptr, sptr, "%s%s " TOK_MOTD " %s", 1, parc, /* XXX DEAD */
- parv) != HUNTED_ISME)
- return 0;
-#ifdef NODEFAULTMOTD
- }
- else
- {
- sptr = cptr;
- no_motd = 1;
- }
-#endif
-
- /*
- * Find out if this is a remote query or if we have a T line for our hostname
- */
- if (IsServer(cptr))
- {
- tm = 0; /* Remote MOTD */
- temp = rmotd;
- }
- else
- {
- for (ptr = tdata; ptr; ptr = ptr->next)
- {
- if (!match(ptr->hostmask, cptr->sockhost))
- break;
- }
- if (ptr)
- {
- temp = ptr->tmotd;
- tm = &ptr->tmotd_tm;
- }
- else
- temp = motd;
- }
- if (temp == 0)
- {
- sendto_one(sptr, err_str(ERR_NOMOTD), me.name, parv[0]); /* XXX DEAD */
- return 0;
- }
-#ifdef NODEFAULTMOTD
- if (!no_motd)
- {
-#endif
- if (tm) /* Not remote? */
- {
- sendto_one(sptr, rpl_str(RPL_MOTDSTART), me.name, parv[0], me.name); /* XXX DEAD */
- sendto_one(sptr, ":%s %d %s :- %d/%d/%d %d:%02d", me.name, RPL_MOTD, /* XXX DEAD */
- parv[0], tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year,
- tm->tm_hour, tm->tm_min);
- count = 100;
- }
- else
- count = 3;
- for (; temp; temp = temp->next)
- {
- sendto_one(sptr, rpl_str(RPL_MOTD), me.name, parv[0], temp->line); /* XXX DEAD */
- if (--count == 0)
- break;
- }
-#ifdef NODEFAULTMOTD
- }
- else
- {
- sendto_one(sptr, rpl_str(RPL_MOTDSTART), me.name, parv[0], me.name); /* XXX DEAD */
- sendto_one(sptr, ":%s %d %s :%s", me.name, RPL_MOTD, parv[0], /* XXX DEAD */
- "\ 2Type /MOTD to read the AUP before continuing using this service.\ 2");
- sendto_one(sptr, /* XXX DEAD */
- ":%s %d %s :The message of the day was last changed: %d/%d/%d", me.name,
- RPL_MOTD, parv[0], tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year);
- }
-#endif
- sendto_one(sptr, rpl_str(RPL_ENDOFMOTD), me.name, parv[0]); /* XXX DEAD */
- return 0;