~ubuntu-branches/debian/stretch/alpine/stretch

« back to all changes in this revision

Viewing changes to web/cgi/alpine-2.0/conduit/getcontact.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2008-09-23 12:17:56 UTC
  • mfrom: (2.1.8 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080923121756-6u4x8bwq89qlzt32
Tags: 2.00+dfsg-2
Update to package description: note that Alpine is no longer in
alpha. (Closes: #499640)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!./tclsh
 
2
# $Id: getcontact.tcl 1150 2008-08-20 00:27:11Z mikes@u.washington.edu $
 
3
# ========================================================================
 
4
# Copyright 2008 University of Washington
 
5
#
 
6
# Licensed under the Apache License, Version 2.0 (the "License");
 
7
# you may not use this file except in compliance with the License.
 
8
# You may obtain a copy of the License at
 
9
#
 
10
#     http://www.apache.org/licenses/LICENSE-2.0
 
11
#
 
12
# ========================================================================
 
13
 
 
14
#  getcontact.tcl
 
15
#
 
16
#  Purpose:  CGI script to handle saving new/edited contacts
 
17
#
 
18
#  Input: 
 
19
set contact_vars {
 
20
  {book         ""      0}
 
21
  {index        ""      -1}
 
22
}
 
23
 
 
24
#  Output: 
 
25
 
 
26
# inherit global config
 
27
source ../alpine.tcl
 
28
 
 
29
# Import data validate it and get session id
 
30
if {[catch {WPGetInputAndID sessid} result]} {
 
31
  error "getcontact.tcl $result"
 
32
}
 
33
 
 
34
# grok parameters
 
35
foreach item $contact_vars {
 
36
  if {[catch {eval WPImport $item} result]} {
 
37
    error "getcontact.tcl $result"
 
38
  }
 
39
}
 
40
 
 
41
if {[catch {WPCmd PEAddress fullentry $book "" $index} addrinfo]} {
 
42
  error "getcontact.tcl $addrinfo"
 
43
}
 
44
 
 
45
puts stdout "Content-type: text/xml; charset=\"UTF-8\"\n"
 
46
puts stdout {<?xml version="1.0" encoding="UTF-8"?>}
 
47
puts stdout "<ResultSet totalResultsAvailable=\"1\"><Result>"
 
48
puts stdout "<Nickname>[cgi_quote_html [lindex $addrinfo 0]]</Nickname>"
 
49
puts stdout "<Personal>[cgi_quote_html [lindex $addrinfo 1]]</Personal>"
 
50
puts stdout "<Mailbox>[cgi_quote_html [join [lindex $addrinfo 2] ", "]]</Mailbox>"
 
51
puts stdout "<Fcc>[cgi_quote_html [lindex $addrinfo 3]]</Fcc>"
 
52
puts stdout "<Note>[cgi_quote_html [lindex $addrinfo 4]]</Note>"
 
53
puts stdout "</Result></ResultSet>"