~ubuntu-branches/debian/squeeze/alpine/squeeze

« back to all changes in this revision

Viewing changes to web/src/alpined.d/remote.c

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2007-02-17 13:17:42 UTC
  • Revision ID: james.westby@ubuntu.com-20070217131742-99x5c6cpg1pbkdhw
Tags: upstream-0.82+dfsg
ImportĀ upstreamĀ versionĀ 0.82+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if !defined(lint) && !defined(DOS)
 
2
static char rcsid[] = "$Id: remote.c 101 2006-08-10 22:53:04Z mikes@u.washington.edu $";
 
3
#endif
 
4
 
 
5
/* ========================================================================
 
6
 * Copyright 2006-2007 University of Washington
 
7
 *
 
8
 * Licensed under the Apache License, Version 2.0 (the "License");
 
9
 * you may not use this file except in compliance with the License.
 
10
 * You may obtain a copy of the License at
 
11
 *
 
12
 *     http://www.apache.org/licenses/LICENSE-2.0
 
13
 *
 
14
 * ========================================================================
 
15
 */
 
16
 
 
17
#include <system.h>
 
18
#include <general.h>
 
19
 
 
20
#include "../../../c-client/c-client.h"
 
21
 
 
22
#include "../../../pith/remote.h"
 
23
#include "../../../pith/msgno.h"
 
24
#include "../../../pith/filter.h"
 
25
#include "../../../pith/util.h"
 
26
#include "../../../pith/debug.h"
 
27
 
 
28
 
 
29
/*
 
30
 * Internal prototypes
 
31
 */
 
32
 
 
33
int
 
34
rd_prompt_about_forged_remote_data(reason, rd, extra)
 
35
    int        reason;
 
36
    REMDATA_S *rd;
 
37
    char      *extra;
 
38
{
 
39
    char  tmp[2000];
 
40
    char *unknown = "<unknown>";
 
41
    char *foldertype, *foldername, *special;
 
42
 
 
43
    /*
 
44
     * Since we're web based the user doesn't have much recourse in the event of one of these
 
45
     * weird errors, so we just report what happened and forge ahead
 
46
     */
 
47
 
 
48
    foldertype = (rd && rd->t.i.special_hdr && !strucmp(rd->t.i.special_hdr, REMOTE_ABOOK_SUBTYPE))
 
49
                   ? "address book"
 
50
                   : (rd && rd->t.i.special_hdr && !strucmp(rd->t.i.special_hdr, REMOTE_PINERC_SUBTYPE))
 
51
                       ? "configuration"
 
52
                       : "data";
 
53
    foldername = (rd && rd->rn) ? rd->rn : unknown;
 
54
    special = (rd && rd->t.i.special_hdr) ? rd->t.i.special_hdr : unknown;
 
55
 
 
56
    dprint((1, "rd_check_out_forged_remote_data: reason: %d, type: $s, name: %s",
 
57
            reason, foldertype ? foldertype : "?", foldername ? foldername : "?"));
 
58
 
 
59
    if(rd && rd->flags & USER_SAID_NO)
 
60
      return(-1);
 
61
 
 
62
    if(reason == -2){
 
63
        snprintf(tmp, sizeof(tmp), _("Missing \"%s\" header in remote pinerc"), special);
 
64
        tmp[sizeof(tmp)-1] = '\0';
 
65
    }
 
66
    else if(reason == -1){
 
67
        snprintf(tmp, sizeof(tmp), _("Unexpected \"Received\" header in remote pinerc"));
 
68
        tmp[sizeof(tmp)-1] = '\0';
 
69
    }
 
70
    else if(reason >= 0){
 
71
        snprintf(tmp, sizeof(tmp), _("Unexpected value \"%s: %s\" in remote pinerc"), special, (extra && *extra) ? extra : "?");
 
72
        tmp[sizeof(tmp)-1] = '\0';
 
73
    }
 
74
 
 
75
    rd->flags |= USER_SAID_YES;
 
76
    return(1);
 
77
}