$Log$
+Revision 323.7 2002/03/04 05:28:54 ajc
+* Wrote some skeleton code for robust vCard editing
+
Revision 323.6 2002/03/03 06:58:25 ajc
* Login errors displayed in red
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
webserver: webserver.o context_loop.o tools.o \
cookie_conversion.o locate_host.o \
webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \
- roomops.o messages.o userlist.o paging.o sysmsgs.o vcard.o \
+ roomops.o messages.o userlist.o paging.o sysmsgs.o vcard.o vcard_edit.o \
mime_parser.o graphics.o netconf.o siteconfig.o subst.o $(LIBOBJS)
$(CC) webserver.o context_loop.o tools.o cookie_conversion.o \
webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \
roomops.o messages.o userlist.o paging.o sysmsgs.o \
- locate_host.o siteconfig.o subst.o vcard.o \
+ locate_host.o siteconfig.o subst.o vcard.o vcard_edit.o \
mime_parser.o graphics.o netconf.o \
$(LIBOBJS) $(LIBS) -o webserver
strip webserver
if (strlen(vcard_partnum) > 0) {
vcard_source = load_mimepart(msgnum, vcard_partnum);
if (vcard_source != NULL) {
+
+ /* FIXME this is a temporary hack to make the screen usable
+ * while we build it. We need a more intuitive way of getting
+ * in.
+ */
+ wprintf("<A HREF=\"/edit_vcard?msgnum=%ld&partnum=%s\">",
+ msgnum, vcard_partnum);
+ wprintf("(edit)</A>");
+
display_vcard(vcard_source);
free(vcard_source);
}
if (v->numprops) for (i=0; i<(v->numprops); ++i) {
if ( (!strcasecmp(v->prop[i].name, propname))
+ || (propname[0] == 0)
|| ( (!strncasecmp(v->prop[i].name,
propname, strlen(propname)))
&& (v->prop[i].name[strlen(propname)] == ';')
--- /dev/null
+/*
+ * vcard_edit.c
+ *
+ * Handles editing of vCard objects.
+ *
+ * $Id$
+ */
+
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string.h>
+#include <pwd.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include <signal.h>
+#include "webcit.h"
+#include "vcard.h"
+
+
+
+void edit_vcard(void) {
+ char buf[SIZ];
+ char *serialized_vcard = NULL;
+ size_t total_len = 0;
+ size_t bytes = 0;
+ size_t thisblock = 0;
+ struct vCard *v;
+ int i;
+ char *prop;
+
+ output_headers(1);
+ sprintf(buf, "OPNA %s|%s", bstr("msgnum"), bstr("partnum") );
+ serv_puts(buf);
+ serv_gets(buf);
+ if (buf[0] != '2') {
+ wDumpContent(1);
+ return;
+ }
+
+ total_len = atoi(&buf[4]);
+ serialized_vcard = malloc(total_len + 1);
+ while (bytes < total_len) {
+ thisblock = 4000;
+ if ((total_len - bytes) < thisblock) thisblock = total_len - bytes;
+ sprintf(buf, "READ %d|%d", bytes, thisblock);
+ serv_puts(buf);
+ serv_gets(buf);
+ if (buf[0] == '6') {
+ thisblock = atoi(&buf[4]);
+ serv_read(&serialized_vcard[bytes], thisblock);
+ bytes += thisblock;
+ }
+ else {
+ wprintf("Error: %s<BR>\n", &buf[4]);
+ }
+ }
+
+ serv_puts("CLOS");
+ serv_gets(buf);
+ serialized_vcard[total_len + 1] = 0;
+
+ v = vcard_load(serialized_vcard);
+ free(serialized_vcard);
+
+ wprintf("<BLINK> FIXME </BLINK><BR><BR>\n"
+ "This needs to be implemented as an editable form.<BR><BR>\n");
+
+ i = 0;
+ while (prop = vcard_get_prop(v, "", 0, i++), prop != NULL) {
+ escputs(prop);
+ wprintf("<BR>\n");
+ }
+
+ vcard_free(v);
+
+ wDumpContent(1);
+}
display_menubar(1);
} else if (!strcasecmp(action, "output_mimepart")) {
output_mimepart();
+ } else if (!strcasecmp(action, "edit_vcard")) {
+ edit_vcard();
} else if (!strcasecmp(action, "diagnostics")) {
output_headers(1);
int decode_base64(char *dest, char *source);
char *load_mimepart(long msgnum, char *partnum);
int pattern2(char *search, char *patn);
+void edit_vcard(void);