Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F105206047
ConpherenceCreateThreadMailReceiver.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
Sat, Mar 15, 10:48
Size
945 B
Mime Type
text/x-php
Expires
Mon, Mar 17, 10:48 (2 d)
Engine
blob
Format
Raw Data
Handle
24940425
Attached To
rPH Phabricator
ConpherenceCreateThreadMailReceiver.php
View Options
<?php
final
class
ConpherenceCreateThreadMailReceiver
extends
PhabricatorMailReceiver
{
public
function
isEnabled
()
{
$app_class
=
'PhabricatorApplicationConpherence'
;
return
PhabricatorApplication
::
isClassInstalled
(
$app_class
);
}
public
function
canAcceptMail
(
PhabricatorMetaMTAReceivedMail
$mail
)
{
$usernames
=
array
();
foreach
(
$mail
->
getToAddresses
()
as
$to_address
)
{
$address
=
self
::
stripMailboxPrefix
(
$to_address
);
$usernames
[]
=
id
(
new
PhutilEmailAddress
(
$address
))->
getLocalPart
();
}
$usernames
=
array_unique
(
$usernames
);
if
(!
$usernames
)
{
return
false
;
}
$users
=
id
(
new
PhabricatorUser
())->
loadAllWhere
(
'username in (%Ls)'
,
$usernames
);
if
(
count
(
$users
)
!=
count
(
$usernames
))
{
// At least some of the addresses are not users, so don't accept this as
// a new Conpherence thread.
return
false
;
}
return
true
;
}
}
Event Timeline
Log In to Comment