Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F110081907
ConpherenceReplyHandler.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Apr 24, 15:12
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Apr 26, 15:12 (2 d)
Engine
blob
Format
Raw Data
Handle
25749569
Attached To
rPH Phabricator
ConpherenceReplyHandler.php
View Options
<?php
/**
* @group conpherence
*/
final
class
ConpherenceReplyHandler
extends
PhabricatorMailReplyHandler
{
public
function
validateMailReceiver
(
$mail_receiver
)
{
if
(!(
$mail_receiver
instanceof
ConpherenceThread
))
{
throw
new
Exception
(
"Mail receiver is not a ConpherenceThread!"
);
}
}
public
function
getPrivateReplyHandlerEmailAddress
(
PhabricatorObjectHandle
$handle
)
{
return
$this
->
getDefaultPrivateReplyHandlerEmailAddress
(
$handle
,
'E'
);
}
public
function
getPublicReplyHandlerEmailAddress
()
{
return
$this
->
getDefaultPublicReplyHandlerEmailAddress
(
'E'
);
}
public
function
getReplyHandlerInstructions
()
{
if
(
$this
->
supportsReplies
())
{
return
pht
(
'Reply to comment and attach files.'
);
}
else
{
return
null
;
}
}
protected
function
receiveEmail
(
PhabricatorMetaMTAReceivedMail
$mail
)
{
$conpherence
=
$this
->
getMailReceiver
();
$user
=
$this
->
getActor
();
$body
=
$mail
->
getCleanTextBody
();
$body
=
trim
(
$body
);
$file_phids
=
$mail
->
getAttachments
();
$body
=
$this
->
enhanceBodyWithAttachments
(
$body
,
$file_phids
);
$xactions
=
array
();
if
(
$file_phids
)
{
$xactions
[]
=
id
(
new
ConpherenceTransaction
())
->
setTransactionType
(
ConpherenceTransactionType
::
TYPE_FILES
)
->
setNewValue
(
array
(
'+'
=>
$file_phids
));
}
$xactions
[]
=
id
(
new
ConpherenceTransaction
())
->
setTransactionType
(
PhabricatorTransactions
::
TYPE_COMMENT
)
->
attachComment
(
id
(
new
ConpherenceTransactionComment
())
->
setContent
(
$body
)
->
setConpherencePHID
(
$conpherence
->
getPHID
())
);
$content_source
=
PhabricatorContentSource
::
newForSource
(
PhabricatorContentSource
::
SOURCE_EMAIL
,
array
(
'id'
=>
$mail
->
getID
(),
));
$editor
=
id
(
new
ConpherenceEditor
())
->
setActor
(
$user
)
->
setContentSource
(
$content_source
)
->
setParentMessageID
(
$mail
->
getMessageID
())
->
applyTransactions
(
$conpherence
,
$xactions
);
return
null
;
}
}
Event Timeline
Log In to Comment