11 #include <sys/types.h>
13 #include <sys/socket.h>
16 #include <netinet/in.h>
32 struct serv_info serv_info;
35 * get info about the server we've connected to
37 void get_serv_info(char *browser_host, char *user_agent)
42 /* Tell the server what kind of client is connecting */
43 serv_printf("IDEN %d|%d|%d|%s|%s",
52 /* Tell the server what kind of richtext we prefer */
53 serv_puts("MSGP text/html|text/plain");
56 /* Now ask the server to tell us a little bit about itself... */
63 while (serv_gets(buf), strcmp(buf, "000")) {
66 serv_info.serv_pid = atoi(buf);
69 strcpy(serv_info.serv_nodename, buf);
72 strcpy(serv_info.serv_humannode, buf);
75 strcpy(serv_info.serv_fqdn, buf);
78 strcpy(serv_info.serv_software, buf);
81 serv_info.serv_rev_level = atoi(buf);
84 strcpy(serv_info.serv_bbs_city, buf);
87 strcpy(serv_info.serv_sysadm, buf);
90 strcpy(serv_info.serv_moreprompt, buf);
100 * Function to spit out Citadel variformat text in HTML
101 * If fp is non-null, it is considered to be the file handle to read the
102 * text from. Otherwise, text is read from the server.
104 void fmout(FILE * fp)
111 wprintf("<DIV ALIGN=JUSTIFY>\n");
116 if (fgets(buf, SIZ, fp) == NULL)
118 buf[strlen(buf) - 1] = 0;
120 if (!strcmp(buf, "000")) {
123 wprintf("</DIV><BR>\n");
126 if ((intext == 1) && (isspace(buf[0]))) {
131 /* Quoted text should be displayed in italics and in a
132 * different colour. This code understands both Citadel/UX
133 * style " >" quotes and FordBoard-style " :-)" quotes.
136 ((!strncmp(buf, " >", 2)) || (!strncmp(buf, " :-)", 4)))) {
137 wprintf("<FONT COLOR=\"000044\"><I>");
139 } else if ((bq == 1) &&
140 (strncmp(buf, " >", 2)) && (strncmp(buf, " :-)", 4))) {
141 wprintf("</FONT></I>");
144 /* Activate embedded URL's */
158 * Transmit message text (in memory) to the server.
159 * If convert_to_html is set to 1, the message is converted into something
160 * which kind of resembles HTML.
162 void text_to_server(char *ptr, int convert_to_html)
167 if (convert_to_html) {
168 serv_puts("<HTML><BODY>");
174 while (ptr[pos] != 0) {
177 while ( (isspace(buf[strlen(buf) - 1]))
178 && (strlen(buf) > 1) )
179 buf[strlen(buf) - 1] = 0;
182 if (convert_to_html) {
186 if (ptr[pos] != 0) strcat(buf, " ");
192 if ((ch == 32) && (strlen(buf) > 200)) {
197 if (strlen(buf) > 250) {
205 if (convert_to_html) {
206 serv_puts("</BODY></HTML>\n");
217 * translate server message output to text
218 * (used for editing room info files and such)
220 void server_to_text()
226 while (serv_gets(buf), strcmp(buf, "000")) {
227 if ((buf[0] == 32) && (count > 0)) {