summaryrefslogtreecommitdiff
path: root/web/src/alpined.d/remote.c
diff options
context:
space:
mode:
authorEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
committerEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
commit094ca96844842928810f14844413109fc6cdd890 (patch)
treee60efbb980f38ba9308ccb4fb2b77b87bbc115f3 /web/src/alpined.d/remote.c
downloadalpine-094ca96844842928810f14844413109fc6cdd890.tar.xz
Initial Alpine Version
Diffstat (limited to 'web/src/alpined.d/remote.c')
-rw-r--r--web/src/alpined.d/remote.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/web/src/alpined.d/remote.c b/web/src/alpined.d/remote.c
new file mode 100644
index 00000000..3269a978
--- /dev/null
+++ b/web/src/alpined.d/remote.c
@@ -0,0 +1,78 @@
+#if !defined(lint) && !defined(DOS)
+static char rcsid[] = "$Id: remote.c 101 2006-08-10 22:53:04Z mikes@u.washington.edu $";
+#endif
+
+/* ========================================================================
+ * Copyright 2006-2007 University of Washington
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * ========================================================================
+ */
+
+#include <system.h>
+#include <general.h>
+
+#include "../../../c-client/c-client.h"
+
+#include "../../../pith/remote.h"
+#include "../../../pith/msgno.h"
+#include "../../../pith/filter.h"
+#include "../../../pith/util.h"
+#include "../../../pith/debug.h"
+#include "../../../pith/osdep/collate.h"
+
+
+/*
+ * Internal prototypes
+ */
+
+int
+rd_prompt_about_forged_remote_data(reason, rd, extra)
+ int reason;
+ REMDATA_S *rd;
+ char *extra;
+{
+ char tmp[2000];
+ char *unknown = "<unknown>";
+ char *foldertype, *foldername, *special;
+
+ /*
+ * Since we're web based the user doesn't have much recourse in the event of one of these
+ * weird errors, so we just report what happened and forge ahead
+ */
+
+ foldertype = (rd && rd->t.i.special_hdr && !strucmp(rd->t.i.special_hdr, REMOTE_ABOOK_SUBTYPE))
+ ? "address book"
+ : (rd && rd->t.i.special_hdr && !strucmp(rd->t.i.special_hdr, REMOTE_PINERC_SUBTYPE))
+ ? "configuration"
+ : "data";
+ foldername = (rd && rd->rn) ? rd->rn : unknown;
+ special = (rd && rd->t.i.special_hdr) ? rd->t.i.special_hdr : unknown;
+
+ dprint((1, "rd_check_out_forged_remote_data: reason: %d, type: $s, name: %s",
+ reason, foldertype ? foldertype : "?", foldername ? foldername : "?"));
+
+ if(rd && rd->flags & USER_SAID_NO)
+ return(-1);
+
+ if(reason == -2){
+ snprintf(tmp, sizeof(tmp), _("Missing \"%s\" header in remote pinerc"), special);
+ tmp[sizeof(tmp)-1] = '\0';
+ }
+ else if(reason == -1){
+ snprintf(tmp, sizeof(tmp), _("Unexpected \"Received\" header in remote pinerc"));
+ tmp[sizeof(tmp)-1] = '\0';
+ }
+ else if(reason >= 0){
+ snprintf(tmp, sizeof(tmp), _("Unexpected value \"%s: %s\" in remote pinerc"), special, (extra && *extra) ? extra : "?");
+ tmp[sizeof(tmp)-1] = '\0';
+ }
+
+ rd->flags |= USER_SAID_YES;
+ return(1);
+}