* Changes in the source code of Alpine to define internal prototypes
[alpine.git] / web / src / alpined.d / remote.c
blob2e15785fdd68a7487c33ae4b8787914f26e725bd
1 /* ========================================================================
2 * Copyright 2006-2007 University of Washington
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * ========================================================================
13 #include <system.h>
14 #include <general.h>
16 #include "../../../c-client/c-client.h"
18 #include "../../../pith/remote.h"
19 #include "../../../pith/msgno.h"
20 #include "../../../pith/filter.h"
21 #include "../../../pith/util.h"
22 #include "../../../pith/debug.h"
23 #include "../../../pith/osdep/collate.h"
27 * Internal prototypes
30 int
31 rd_prompt_about_forged_remote_data(int reason, REMDATA_S *rd, char *extra)
33 char tmp[2000];
34 char *unknown = "<unknown>";
35 char *foldertype, *foldername, *special;
38 * Since we're web based the user doesn't have much recourse in the event of one of these
39 * weird errors, so we just report what happened and forge ahead
42 foldertype = (rd && rd->t.i.special_hdr && !strucmp(rd->t.i.special_hdr, REMOTE_ABOOK_SUBTYPE))
43 ? "address book"
44 : (rd && rd->t.i.special_hdr && !strucmp(rd->t.i.special_hdr, REMOTE_PINERC_SUBTYPE))
45 ? "configuration"
46 : "data";
47 foldername = (rd && rd->rn) ? rd->rn : unknown;
48 special = (rd && rd->t.i.special_hdr) ? rd->t.i.special_hdr : unknown;
50 dprint((1, "rd_check_out_forged_remote_data: reason: %d, type: $s, name: %s",
51 reason, foldertype ? foldertype : "?", foldername ? foldername : "?"));
53 if(rd && rd->flags & USER_SAID_NO)
54 return(-1);
56 if(reason == -2){
57 snprintf(tmp, sizeof(tmp), _("Missing \"%s\" header in remote pinerc"), special);
58 tmp[sizeof(tmp)-1] = '\0';
60 else if(reason == -1){
61 snprintf(tmp, sizeof(tmp), _("Unexpected \"Received\" header in remote pinerc"));
62 tmp[sizeof(tmp)-1] = '\0';
64 else if(reason >= 0){
65 snprintf(tmp, sizeof(tmp), _("Unexpected value \"%s: %s\" in remote pinerc"), special, (extra && *extra) ? extra : "?");
66 tmp[sizeof(tmp)-1] = '\0';
69 rd->flags |= USER_SAID_YES;
70 return(1);