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

« back to all changes in this revision

Viewing changes to web/cgi/alpine/dosend.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2010-10-03 15:31:55 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20101003153155-2exypc96j1e8tw0p
Tags: 2.02-1
* New upstream release, based on re-alpine project
* Updated debian/copyright to reflect this fact
* re-alpine removed the non-free from the tarball, so now
  we do not repack the upstream tarball. (Yay!)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: dosend.tcl 1096 2008-06-30 22:03:35Z hubert@u.washington.edu $
2
 
# ========================================================================
3
 
# Copyright 2006 University of Washington
4
 
#
5
 
# Licensed under the Apache License, Version 2.0 (the "License");
6
 
# you may not use this file except in compliance with the License.
7
 
# You may obtain a copy of the License at
8
 
#
9
 
#     http://www.apache.org/licenses/LICENSE-2.0
10
 
#
11
 
# ========================================================================
12
 
 
13
 
#  post.tcl
14
 
#
15
 
#  Purpose:  CGI script to perform message posting via compose.tcl
16
 
#            generated form
17
 
#
18
 
#  Input: 
19
 
set post_vars {
20
 
  {cid          "Missing Command ID"}
21
 
  {postpost     ""                      "main.tcl"}
22
 
  {user         ""                      ""}
23
 
  {pass         ""                      ""}
24
 
  {server       ""                      ""}
25
 
}
26
 
 
27
 
#  Output: 
28
 
#
29
 
 
30
 
## read vars
31
 
foreach item $post_vars {
32
 
  if {[catch {cgi_import [lindex $item 0].x}]} {
33
 
    if {[catch {eval WPImport $item} result]} {
34
 
      error [list _action "Impart Variable" $result]
35
 
    }
36
 
  } else {
37
 
    set [lindex $item 0] 1
38
 
  }
39
 
}
40
 
 
41
 
if {$cid != [WPCmd PEInfo key]} {
42
 
  error [list _action Postpone "Invalid Operation ID" "Click Back button to try again."]
43
 
}
44
 
 
45
 
if {[string length $user] && [string length $pass] && [string length $server]} {
46
 
  set cclientname "\{$server\}"
47
 
  catch {WPCmd PESession nocred 0 $cclientname}
48
 
  if {[catch {WPCmd PESession creds 0 $cclientname $user $pass} result]} {
49
 
    WPCmd PEInfo statmsg "Cannot set credentials for $server"
50
 
  }
51
 
}
52
 
 
53
 
if {[catch {WPCmd PEInfo set suspended_composition} msgdata] == 0} {
54
 
  if {[catch {WPCmd PECompose post $msgdata} errstr]} {
55
 
    if {[string compare BADPASSWD [string range $errstr 0 8]] == 0
56
 
        && [catch {WPCmd PEInfo set suspended_composition $msgdata} errstr] == 0} {
57
 
        set oncancel "page=compose&restore=1&cid=$cid"
58
 
        set conftext "Send Messsage?"
59
 
        set reason "The server used to send this message requires authentication.[cgi_nl][cgi_nl]Enter Username and Password to connect to $server"
60
 
        _cgi_set_uservar params [WPPercentQuote [list [list server $server] [list page dosend] [list postpost $postpost]]]
61
 
        set src auth
62
 
    } else {
63
 
      # regurgitate the compose window
64
 
      _cgi_set_uservar style ""
65
 
      #set style ""
66
 
      set title "Send Error: [cgi_font class=notice "$errstr"]"
67
 
      if {[string length $errstr]} {
68
 
        set notice "Send FAILED: $errstr"
69
 
      } else {
70
 
        set notice "Send FAILED: [WPCmd PEInfo statmsg]"
71
 
      }
72
 
      WPCmd PEInfo statmsg "$notice"
73
 
 
74
 
      if {[info exists attachments]} {
75
 
        set a [split $attachments ","]
76
 
        unset attachments
77
 
        foreach id $a {
78
 
          # id file size type/subtype
79
 
          if {[catch {WPCmd PECompose attachinfo $id} result]} {
80
 
            WPCmd PEInfo statmsg $result
81
 
          } else {
82
 
            lappend attachments [list $id [lindex $result 0] [lindex $result 1] [lindex $result 2]]
83
 
          }
84
 
        }
85
 
      }
86
 
 
87
 
      set src compose
88
 
    }
89
 
  } else {
90
 
    catch {WPCmd PEInfo unset suspended_composition}
91
 
    WPCmd PEInfo statmsg "Message Sent!"
92
 
    set src $postpost
93
 
  }
94
 
} else {
95
 
  WPCmd PEInfo statmsg "Internal Error: $msgdata"
96
 
  set src $postpost
97
 
}
98
 
 
99
 
source [WPTFScript $src]