Index: trunk/phase3/includes/api/ApiEmailUser.php |
— | — | @@ -57,9 +57,12 @@ |
58 | 58 | |
59 | 59 | // Validate target |
60 | 60 | $targetUser = EmailUserForm::validateEmailTarget( $params['target'] ); |
| 61 | + if( isset( $params['check'] ) ) |
| 62 | + ($targetUser instanceof User)? $this->dieUsageMsg( array( 'usermailenabled' ) ) : $this->dieUsageMsg( array( 'usermaildisabled' ) ); |
61 | 63 | if ( !( $targetUser instanceof User ) ) |
62 | 64 | $this->dieUsageMsg( array( $targetUser ) ); |
63 | 65 | |
| 66 | + |
64 | 67 | // Check permissions |
65 | 68 | $error = EmailUserForm::getPermissionsError( $wgUser, $params['token'] ); |
66 | 69 | if ( $error ) |
— | — | @@ -77,7 +80,7 @@ |
78 | 81 | $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
79 | 82 | } |
80 | 83 | |
81 | | - public function mustBePosted() { return true; } |
| 84 | + //public function mustBePosted() { return true; } |
82 | 85 | |
83 | 86 | public function getAllowedParams() { |
84 | 87 | return array ( |
— | — | @@ -86,6 +89,7 @@ |
87 | 90 | 'text' => null, |
88 | 91 | 'token' => null, |
89 | 92 | 'ccme' => false, |
| 93 | + 'check' => null, |
90 | 94 | ); |
91 | 95 | } |
92 | 96 | |
— | — | @@ -96,6 +100,7 @@ |
97 | 101 | 'text' => 'Mail body', |
98 | 102 | 'token' => 'A token previously acquired via prop=info', |
99 | 103 | 'ccme' => 'Send a copy of this mail to me', |
| 104 | + 'check' => 'Check if the user has email enabled', |
100 | 105 | ); |
101 | 106 | } |
102 | 107 | |
— | — | @@ -107,7 +112,8 @@ |
108 | 113 | |
109 | 114 | protected function getExamples() { |
110 | 115 | return array ( |
111 | | - 'api.php?action=emailuser&target=WikiSysop&text=Content' |
| 116 | + 'api.php?action=emailuser&target=WikiSysop&text=Content', |
| 117 | + 'api.php?action=emailuser&target=WikiSysop&check=yes', |
112 | 118 | ); |
113 | 119 | } |
114 | 120 | |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -694,6 +694,7 @@ |
695 | 695 | 'ipb_cant_unblock' => array('code' => 'cantunblock', 'info' => "The block you specified was not found. It may have been unblocked already"), |
696 | 696 | 'mailnologin' => array('code' => 'cantsend', 'info' => "You're not logged in or you don't have a confirmed e-mail address, so you can't send e-mail"), |
697 | 697 | 'usermaildisabled' => array('code' => 'usermaildisabled', 'info' => "User email has been disabled"), |
| 698 | + 'usermailenabled' => array('code' => 'usermailenabled', 'info' => "User email is enabled"), |
698 | 699 | 'blockedemailuser' => array('code' => 'blockedfrommail', 'info' => "You have been blocked from sending e-mail"), |
699 | 700 | 'notarget' => array('code' => 'notarget', 'info' => "You have not specified a valid target for this action"), |
700 | 701 | 'noemail' => array('code' => 'noemail', 'info' => "The user has not specified a valid e-mail address, or has chosen not to receive e-mail from other users"), |