Title:	  login information for the masses
Codebase: Rom 2.4b6 patched
Author:   Vorlin (kellert@ij.net)

This is an update to the original MOTD I submitted. In this update,
there's a typo fix and a bug fix. The typo I made was referencing you
to do_save instead of do_quit in act_comm.c. The bug fix is also in
do_quit. Before, it would just write d->host to ch->pcdata->host w/o
checking if the ch->desc was null or not. Well, if the victim in question
is LD and an imm forces them to quit or they time out (calling quit),
the mud will crash. This fixes that.

Files to muck: 
act_comm.c 
comm.c 
merc.h 
save.c

Legend:
- old/current code non-modified
+ new stuff to put in

In act_comm.c under the do_quit function, put this:

- save_char_obj(ch);
- id = ch->id;
- d = ch->desc;
+ if (ch->desc != NULL) {
+	d->host = str_dup(ch->pcdata->host);
+ }

In comm.c, in 'case CON_READ_MOTD', do a search for this 
line (you should have it if you're using stock Rom 2.4b6):

- do_function(ch, &do_unread, "");

+ if (ch->pcdata->host == NULL
+	|| sizeof(ch->pcdata->host) == 0
+	|| !str_cmp(ch->pcdata->host, "none")) {
+	    sprintf(buf, "Updating site login info: %s\n\r", d->host);
+	    send_to_char(buf, ch);
+	} else if (!str_cmp(ch->pcdata->host, d->host)) {
+	    sprintf(buf, "Usual login: %s\n\r", ch->pcdata->host);
+	    send_to_char(buf, ch);
+	} else {
+	    sprintf(buf, "Last login: %s\n\r", ch->pcdata->host);
+	    send_to_char(buf, ch);
+	    sprintf(buf, "Current login: %s\n\r", d->host);
+	    send_to_char(buf, ch);
+	}
+
+       /* Update with str_dup, not = ! --Vorlin */
+	ch->pcdata->host = str_dup(d->host);

-	break;


In save.c, under fwrite_char(), put this:

-  if (ch->description[0] != '\0')
-	fprintf(fp, "Desc %s~\n", ch->description);
+
+  /* Host information */
+  if (ch->pcdata->host) {
+	fprintf(fp, "Host %s~\n", ch->pcdata->host);
+  } else {
+	fprintf(fp, "Host none~\n");
+  }

In save.c, under fread_char(), put this:

- case 'H':
-	KEY("Hitroll", ch->hitroll, fread_number(fp));
-	KEY("Hit", ch->hitroll, fread_number(fp));
+
+	/* Host information */
+	KEYS("Host", ch->pcdata->host, fread_string(fp));

Finally, in merc.h, under PC_DATA, put this:

+	char *		host; // Host information



That should be it. If you have any questions on this, feel
free to email me with the subject 'Host information' so I'll
know what the email's about and I'll try to help out.


--Vorlin, kellert@ij.net