1 | <?php |
||
11 | class XMPP extends AbstractBackend implements IBackend { |
||
12 | |||
13 | private $app; |
||
14 | |||
15 | public function __construct(ConfigMapper $configMapper, IConfig $config, Chat $app){ |
||
19 | |||
20 | public function getId(){ |
||
23 | |||
24 | public function getInitConvs(){ |
||
25 | $contacts = $this->app->getContacts(); |
||
26 | $contacts = $contacts['contacts']; |
||
27 | $currentUser = $this->app->getCurrentUser(); |
||
28 | $currentUserId = $currentUser['id']; |
||
29 | $initConvs = array(); |
||
30 | foreach($contacts as $contact) { |
||
31 | foreach ($contact['backends'] as $backend) { |
||
32 | if ($backend['id'] === 'xmpp') { |
||
33 | $jid = $backend['value']; |
||
34 | $initConvs[$jid] = array( |
||
35 | "id" => $jid, |
||
36 | "users" => array( |
||
37 | $contact['id'], |
||
38 | $currentUserId |
||
39 | ), |
||
40 | "backend" => 'xmpp', |
||
41 | "messages" => array(), |
||
42 | "files" => array() |
||
43 | ); |
||
44 | } |
||
45 | } |
||
46 | } |
||
47 | return $initConvs; |
||
48 | } |
||
49 | |||
50 | public function getDisplayName(){ |
||
53 | |||
54 | public function getProtocols(){ |
||
55 | return array( |
||
56 | 'xmpp' |
||
57 | ); |
||
58 | } |
||
59 | |||
60 | public function getDefaultConfig(){ |
||
61 | return array( |
||
62 | 'jid' => null, |
||
63 | "password" => null, |
||
64 | "bosh_url" => null |
||
65 | ); |
||
66 | } |
||
67 | |||
68 | |||
69 | public function getHelp(){ |
||
72 | } |