Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F443748
ConpherenceReplyHandler.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ConpherenceReplyHandler.php
View Options
<?php
final
class
ConpherenceReplyHandler
extends
PhabricatorMailReplyHandler
{
private
$mailAddedParticipantPHIDs
;
public
function
setMailAddedParticipantPHIDs
(
array
$phids
)
{
$this
->
mailAddedParticipantPHIDs
=
$phids
;
return
$this
;
}
public
function
getMailAddedParticipantPHIDs
()
{
return
$this
->
mailAddedParticipantPHIDs
;
}
public
function
validateMailReceiver
(
$mail_receiver
)
{
if
(!(
$mail_receiver
instanceof
ConpherenceThread
))
{
throw
new
Exception
(
pht
(
'Mail receiver is not a %s!'
,
'
ConpherenceThread'
));
}
}
public
function
getPrivateReplyHandlerEmailAddress
(
PhabricatorObjectHandle
$handle
)
{
return
$this
->
getDefaultPrivateReplyHandlerEmailAddress
(
$handle
,
'Z'
);
}
public
function
getPublicReplyHandlerEmailAddress
()
{
return
$this
->
getDefaultPublicReplyHandlerEmailAddress
(
'Z'
);
}
protected
function
receiveEmail
(
PhabricatorMetaMTAReceivedMail
$mail
)
{
$conpherence
=
$this
->
getMailReceiver
();
$user
=
$this
->
getActor
();
if
(!
$conpherence
->
getPHID
())
{
$conpherence
->
attachParticipants
(
array
())
->
attachFilePHIDs
(
array
());
}
else
{
$edge_type
=
PhabricatorObjectHasFileEdgeType
::
EDGECONST
;
$file_phids
=
PhabricatorEdgeQuery
::
loadDestinationPHIDs
(
$conpherence
->
getPHID
(),
$edge_type
);
$conpherence
->
attachFilePHIDs
(
$file_phids
);
$participants
=
id
(
new
ConpherenceParticipant
())
->
loadAllWhere
(
'conpherencePHID = %s'
,
$conpherence
->
getPHID
());
$participants
=
mpull
(
$participants
,
null
,
'getParticipantPHID'
);
$conpherence
->
attachParticipants
(
$participants
);
}
$content_source
=
PhabricatorContentSource
::
newForSource
(
PhabricatorContentSource
::
SOURCE_EMAIL
,
array
(
'id'
=>
$mail
->
getID
(),
));
$editor
=
id
(
new
ConpherenceEditor
())
->
setActor
(
$user
)
->
setContentSource
(
$content_source
)
->
setParentMessageID
(
$mail
->
getMessageID
());
$body
=
$mail
->
getCleanTextBody
();
$body
=
$this
->
enhanceBodyWithAttachments
(
$body
,
$mail
->
getAttachments
());
$xactions
=
array
();
if
(
$this
->
getMailAddedParticipantPHIDs
())
{
$xactions
[]
=
id
(
new
ConpherenceTransaction
())
->
setTransactionType
(
ConpherenceTransactionType
::
TYPE_PARTICIPANTS
)
->
setNewValue
(
array
(
'+'
=>
$this
->
getMailAddedParticipantPHIDs
()));
}
$xactions
=
array_merge
(
$xactions
,
$editor
->
generateTransactionsFromText
(
$user
,
$conpherence
,
$body
));
$editor
->
applyTransactions
(
$conpherence
,
$xactions
);
return
$conpherence
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 11:03 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
64805
Default Alt Text
ConpherenceReplyHandler.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment