Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
acs-mail
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
acs-mail
Commits
67a35bd0
Commit
67a35bd0
authored
Feb 06, 2006
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- modified member-notify to handle attachments
parent
ba836940
Pipeline
#77
failed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
142 deletions
+138
-142
acs-mail-create.sql
sql/postgresql/acs-mail-create.sql
+5
-5
acs-mail-procs-postgresql.xql
tcl/acs-mail-procs-postgresql.xql
+10
-10
acs-mail-procs.tcl
tcl/acs-mail-procs.tcl
+123
-127
No files found.
sql/postgresql/acs-mail-create.sql
View file @
67a35bd0
...
...
@@ -164,7 +164,7 @@ create table acs_mail_gc_objects (
-- Mail bodies
create
table
acs_mail_bodies
(
body_id
integer
body_id
integer
constraint
acs_mail_bodies_body_id_pk
primary
key
constraint
acs_mail_bodies_body_id_fk
...
...
@@ -177,7 +177,7 @@ create table acs_mail_bodies (
constraint
acs_mail_bodies_body_from_fk
references
parties
on
delete
set
null
,
body_date
timestamptz
,
header_message_id
varchar
(
1000
)
header_message_id
varchar
(
1000
)
constraint
acs_mail_bodies_h_m_id_un
unique
constraint
acs_mail_bodies_h_m_id_nn
...
...
@@ -233,7 +233,7 @@ create table acs_mail_multipart_parts (
constraint
acs_mail_mp_parts_mp_id_fk
references
acs_mail_multiparts
on
delete
cascade
,
mime_filename
varchar
(
1000
),
mime_disposition
varchar
(
1000
),
mime_disposition
varchar
(
1000
),
sequence_number
integer
,
content_item_id
integer
constraint
acs_mail_mp_parts_c_itm_id_fk
...
...
@@ -248,12 +248,12 @@ create index acs_mail_mpp_cr_item_id_idx ON acs_mail_multipart_parts(content_ite
-- Mail Links
create
table
acs_mail_links
(
mail_link_id
integer
mail_link_id
integer
constraint
acs_mail_links_ml_id_pk
primary
key
constraint
acs_mail_links_ml_id_fk
references
acs_objects
on
delete
cascade
,
body_id
integer
body_id
integer
constraint
acs_mail_links_body_id_nn
not
null
constraint
acs_mail_links_body_id_fk
...
...
tcl/acs-mail-procs-postgresql.xql
View file @
67a35bd0
...
...
@@ -140,12 +140,12 @@ where r.revision_id = $revision_id and
<querytext>
select acs_mail_gc_object__new (
:object_id,
-- gc_object_id
:object_id, -- gc_object_id
'acs_mail_gc_object', -- object_type
now(),
-- creation_date
:creation_user,
-- creation_user
:creation_ip,
-- creation_ip
null
-- context_id
now(), -- creation_date
:creation_user, -- creation_user
:creation_ip, -- creation_ip
null -- context_id
);
</querytext>
...
...
@@ -156,21 +156,21 @@ select acs_mail_gc_object__new (
<querytext>
select acs_mail_body__new (
:body_id,
-- body_id
:body_id, -- body_id
:body_reply_to, -- body_reply_to
:body_from, -- body_from
:body_date, -- body_date
:header_message_id, -- header_message_id
:header_message_id,
-- header_message_id
:header_reply_to, -- header_reply_to
:header_subject, -- header_subject
:header_subject,
-- header_subject
:header_from, -- header_from
:header_to, -- header_to
:content_item_id, -- content_item_id
'acs_mail_body', -- object_type
now()
,
-- creation_date
now()
::date,
-- creation_date
:creation_user, -- creation_user
:creation_ip, -- creation_ip
null
-- context_id
null -- context_id
);
</querytext>
...
...
tcl/acs-mail-procs.tcl
View file @
67a35bd0
...
...
@@ -198,147 +198,142 @@ ad_proc -private acs_mail_encode_content {
ns_log Debug
"acs-mail: encode: starting
$content
_item_id"
# What sort of content do we have?
if !
[
acs_mail_multipart_p
$content
_item_id
]
{
ns_log Debug
"acs-mail: encode: one part
$content
_item_id"
ns_log Debug
"acs-mail: encode: one part
$content
_item_id"
# Easy as pie.
# Let's get the data.
# vinodk: first get the latest revision
set revision_id
[
db_exec_plsql get_latest_revision
"
# vinodk: first get the latest revision
set revision_id
[
db_exec_plsql get_latest_revision
"
begin
return content_item__get_latest_revision ( :content_item_id );
end;"
]
set storage_type
[
db_string get_storage_type
"
select storage_type from cr_items
where item_id = :content_item_id
"
]
if
[
db_0or1row acs_mail_body_to_mime_get_content_simple
{
select content, mime_type as v_content_type
from cr_revisions
where revision_id = :revision_id
}]
{
if
[
string
equal
$storage
_type text
]
{
ns_log Debug
"acs-mail: encode: one part hit
$content
_item_id"
# vinodk: no need for this, since we're checking
# storage_type
#
# We win! Hopefully. Check if there are 8bit characters/data.
# HT NL CR SP-~ The full range of ASCII with spaces but no
# control characters.
#if !
[
regexp
"
\[
^
\u0009\u000A\u000D\u0020
-
\u007E\]
"
$content
]
{
# ns_log Debug
"acs-mail: encode: good code
$content
_item_id"
# # We're still okay. Use it!
return
[
list
$v
_content_type
$content
]
#
}
#ns_log
"Notice"
"acs-mail: encode: bad code
$content
_item_id"
}
else
{
# this content is in the file system or a blob
ns_log Debug
"acs-mail: encode: binary content
$content
_item_id"
if
[
string
equal
$storage
_type file
]
{
ns_log Debug
"acs-mail: encode: file
$content
_item_id"
set encoded_content
[
acs_mail_uuencode_file
[
cr_fs_path
]
$content
]
}
else
{
ns_log Debug
"acs-mail: encode: lob
$content
_item_id"
# Blob. Now we need to decide if this is binary
# so we can uuencode it if necessary.
# We'll use the mime type to decide
if
{
[
string
first
"text"
$v
_content_type
]
== 0
}
{
ns_log Debug
"acs-mail: encode: plain content"
set encoded_content
"
$content
"
}
else
{
# binary content - copy the blob to temp file
# that we will
then
uuencode
set file
[
ns_tmpnam
]
db_blob_get_file copy_blob_to_file
"
select r.content, i.storage_type
from cr_revisions r, cr_items i
where r.revision_id =
$revision
_id and
r.item_id = i.item_id "
-file
$file
ns_log Debug
"acs-mail: encode: binary content"
set encoded_content
[
acs_mail_uuencode_file
$file
]
}
}
return
[
list
$v
_content_type
$encoded
_content
]
}
}
}
else
{
# Harder. Oops.
ns_log Debug
"acs-mail: encode: multipart
$content
_item_id"
set boundary
"=-=-="
set contents
{}
# Get the component pieces
set multipart_list
[
db_list_of_lists acs_mail_body_to_mime_get_contents
{
select mime_filename, mime_disposition, content_item_id as ci_id
from acs_mail_multipart_parts
where multipart_id = :content_item_id
order by sequence_number
}
]
]
set storage_type
[
db_string get_storage_type
"
select storage_type
from cr_items
where item_id = :content_item_id
"
]
if !
[
empty_string_p
$multipart
_list
]
{
foreach multipart_item
$multipart
_list
{
set mime_filename
[
lindex
$multipart
_item 0
]
set mime_disposition
[
lindex
$multipart
_item 1
]
set ci_id
[
lindex
$multipart
_item 2
]
if
{[
string
equal
""
$mime
_disposition
]}
{
if
{
!
[
string
equal
""
$mime
_filename
]}
{
set mime_disposition
"attachment; filename=
$mime
_filename"
}
else
{
set mime_disposition
"inline"
}
}
else
{
if
{
!
[
string
equal
""
$mime
_filename
]}
{
set mime_disposition
\
"
$mime
_disposition; filename=
$mime
_filename"
}
}
set content
[
acs_mail_encode_content
$ci
_id
]
while
{[
regexp
--
"--
$boundary--
"
$content
]}
{
set boundary
"=
$boundary
"
}
lappend contents
[
list
$mime
_disposition
$content
]
}
if
[
db_0or1row acs_mail_body_to_mime_get_content_simple
{
select content, mime_type as v_content_type
from cr_revisions
where revision_id = :revision_id
}]
{
if
[
string
equal
$storage
_type text
]
{
ns_log Debug
"acs-mail: encode: one part hit
$content
_item_id"
return
[
list
$v
_content_type
$content
]
}
else
{
# this content is in the file system or a blob
ns_log Debug
"acs-mail: encode: binary content
$content
_item_id"
if
[
string
equal
$storage
_type file
]
{
ns_log Debug
"acs-mail: encode: file
$content
_item_id"
set encoded_content
[
acs_mail_uuencode_file
[
cr_fs_path
]
$content
]
}
else
{
# Defaults
return
{
"text/plain; charset=us-ascii"
"An OpenACS object was unable to be encoded here.
\n
"
}
ns_log Debug
"acs-mail: encode: lob
$content
_item_id"
# Blob. Now we need to decide if this is binary
# so we can uuencode it if necessary.
# We'll use the mime type to decide
if
{
[
string
first
"text"
$v
_content_type
]
== 0
}
{
ns_log Debug
"acs-mail: encode: plain content"
set encoded_content
"
$content
"
}
else
{
# binary content - copy the blob to temp file
# that we will
then
uuencode
set file
[
ns_tmpnam
]
db_blob_get_file copy_blob_to_file
"
select r.content, i.storage_type
from cr_revisions r, cr_items i
where r.revision_id =
$revision
_id and
r.item_id = i.item_id "
-file
$file
ns_log Debug
"acs-mail: encode: binary content"
set encoded_content
[
acs_mail_uuencode_file
$file
]
}
}
set content_type
\
"multipart/
[
acs_mail_multipart_type
$content
_item_id
]
; boundary=
\"
$boundary
\"
"
set content
""
foreach
{
cont
}
$contents
{
set c_disp
[
lindex
$cont
0
]
set c_type
[
lindex
[
lindex
$cont
1
]
0
]
set c_cont
[
lindex
[
lindex
$cont
1
]
1
]
append content
"--
$boundary
\n
"
append content
"Content-Type:
$c
_type
\n
"
if
{
[
string
first
"text"
$c
_type
]
!= 0
}
{
# not a text item: therefore base64
append content
"Content-Transfer-Encoding: base64
\n
"
}
append content
"Content-Disposition:
$c
_disp
\n
"
append content
"
\n
"
append content
$c
_cont
append content
"
\n\n
"
}
append content
"--
$boundary--
\n
"
return
[
list
$content
_type
$content
]
return
[
list
$v
_content_type
$encoded
_content
]
}
}
}
else
{
# This is a multipart item.
# Harder. Oops.
ns_log Debug
"acs-mail: encode: multipart
$content
_item_id"
set boundary
"=-=-="
set contents
{}
# Get the component pieces
set multipart_list
[
db_list_of_lists acs_mail_body_to_mime_get_contents
{
select mime_filename, mime_disposition, content_item_id as ci_id
from acs_mail_multipart_parts
where multipart_id = :content_item_id
order by sequence_number
}]
# Defaults
return
{
if !
[
empty_string_p
$multipart
_list
]
{
foreach multipart_item
$multipart
_list
{
set mime_filename
[
lindex
$multipart
_item 0
]
set mime_disposition
[
lindex
$multipart
_item 1
]
set ci_id
[
lindex
$multipart
_item 2
]
if
{[
string
equal
""
$mime
_disposition
]}
{
if
{
!
[
string
equal
""
$mime
_filename
]}
{
set mime_disposition
"attachment; filename=
$mime
_filename"
}
else
{
set mime_disposition
"inline"
}
}
else
{
if
{
!
[
string
equal
""
$mime
_filename
]}
{
set mime_disposition
\
"
$mime
_disposition; filename=
$mime
_filename"
}
}
set content
[
acs_mail_encode_content
$ci
_id
]
while
{[
regexp
--
"--
$boundary--
"
$content
]}
{
set boundary
"=
$boundary
"
}
lappend contents
[
list
$mime
_disposition
$content
]
}
}
else
{
# Defaults
return
{
"text/plain; charset=us-ascii"
"An OpenACS object was unable to be encoded here.
\n
"
}
}
set content_type
\
"multipart/
[
acs_mail_multipart_type
$content
_item_id
]
; boundary=
\"
$boundary
\"
"
set content
""
foreach
{
cont
}
$contents
{
set c_disp
[
lindex
$cont
0
]
set c_type
[
lindex
[
lindex
$cont
1
]
0
]
set c_cont
[
lindex
[
lindex
$cont
1
]
1
]
append content
"--
$boundary
\n
"
append content
"Content-Type:
$c
_type
\n
"
if
{
[
string
first
"text"
$c
_type
]
!= 0
}
{
# not a text item: therefore base64
append content
"Content-Transfer-Encoding: base64
\n
"
}
append content
"Content-Disposition:
$c
_disp
\n
"
append content
"
\n
"
append content
$c
_cont
append content
"
\n\n
"
}
append content
"--
$boundary--
\n
"
return
[
list
$content
_type
$content
]
}
# Defaults
return
{
"text/plain; charset=us-ascii"
"An OpenACS object was unable to be encoded here.
\n
"
}
}
ad_proc -private acs_mail_body_to_output_format
{
...
...
@@ -404,7 +399,8 @@ ad_proc -private acs_mail_process_queue {
from acs_mail_queue_outgoing
}
{
set to_send
[
acs_mail_body_to_output_format -link_id
$message
_id
]
set to_send_2
[
list
$envelope
_to
$envelope
_from
[
lindex
$to
_send 2
]
[
lindex
$to
_send 3
]
[
lindex
$to
_send 4
]]
set to_send_2
[
list
$envelope
_to
$envelope
_from
[
lindex
$to
_send 2
]
[
lindex
$to
_send 3
]
[
lindex
$to
_send 4
]]
ns_log notice
"acs_mail_process_queue: to_send_2=
$to
_send_2"
if
[
catch
{
eval ns_sendmail
$to
_send_2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment