2015-01-23 3 views
2

어떤 시점에서 사용자가 자신의 회의실을 만들 수 있도록 허용해야하는 시스템을 개발 중입니다.XMPPHP를 사용하여 Openfire에서 회의실을 만드는 방법은 무엇입니까?

create rooms에 대해 읽었으며 XMPP로 일부 코드를 작성하여 자세한 로그를 생성했습니다.

1422017436 [DEBUG]: Calling presence_handler 
1422017436 [DEBUG]: Presence: [email protected]/xmpphp [available] 
1422017436 [DEBUG]: EVENT: presence 
1422017436 [VERBOSE]: RECV: <iq type="result" id="create1" from="[email protected]/xmpphp" to="[email protected]/xmpphp"/> 
1422017436 [VERBOSE]: RECV: </stream:stream> 

를하지만의 Openfire 패널에서 sala3 방을 찾을 수 없습니다 : 여기 읽을 수

1422017436 [VERBOSE]: Socket is ready; send it. 
1422017436 [VERBOSE]: SENT: <presence from='[email protected]/xmpphp' to='[email protected]/xmpphp'><x xmlns='http://jabber.org/protocol/muc'/></presence> 
1422017436 [VERBOSE]: Successfully sent 134 bytes. 
1422017436 [VERBOSE]: Socket is ready; send it. 
1422017436 [VERBOSE]: SENT: <iq from='[email protected]/xmpphp' id='create1' to='[email protected]/xmpphp' type='set'><query xmlns='http://jabber.org/protocol/muc#owner'><x xmlns='jabber:x:data' type='submit'/></query></iq> 
1422017436 [VERBOSE]: Successfully sent 203 bytes. 
1422017436 [VERBOSE]: Disconnecting... 
1422017436 [VERBOSE]: Socket is ready; send it. 
1422017436 [VERBOSE]: SENT: </stream:stream> 
1422017436 [VERBOSE]: Successfully sent 16 bytes. 
1422017436 [VERBOSE]: RECV: <presence from="[email protected]/xmpphp" to="[email protected]/xmpphp"><x xmlns="http://jabber.org/protocol/muc#user"><item jid="[email protected]/xmpphp" affiliation="owner" role="moderator"/><status code="110"/><status code="100"/><status code="201"/></x></presence> 
1422017436 [DEBUG]: Calling presence_handler 
1422017436 [DEBUG]: Presence: [email protected]/xmpphp [available] 
1422017436 [DEBUG]: EVENT: presence 
1422017436 [VERBOSE]: RECV: <iq type="result" id="create1" from="[email protected]/xmpphp" to="[email protected]/xmpphp"/> 
1422017436 [VERBOSE]: RECV: </stream:stream> 
1422017436 [DEBUG]: EVENT: end_stream 

그것은, 작동하는 것 같군. 내 SENT 패킷에 문제가 있습니까?

감사합니다.

답변

0

여전히보기 흉하지만 작동했습니다.

<?php 

// activate full error reporting 
//error_reporting(E_ALL & E_STRICT); 
error_reporting(E_ALL); 
ini_set('display_errors', 'On'); 
include 'XMPPHP/XMPP.php'; 
    // load the image from filesystem 

#Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports 
#If this doesn't work, are you running 64-bit PHP with < 5.2.6? 
    $conn = new XMPPHP_XMPP('myserver', 5222, '24527', 'my pw', 'xmpphp', 'localhost', $printlog=true, $loglevel=XMPPHP_Log::LEVEL_VERBOSE); 

    $conn->connect(); 
    $conn->processUntil('session_start'); 
    $conn->useEncryption(false); 
    $conn->createGroup(); 
    $conn->processUntil('presence'); 

    $conn->createGroup2(); 
    $conn->processUntil('result'); 

    $conn->sendConfigsRoom(); 

    #$conn->processUntil(array('result', 'error')); 
    $conn->disconnect(); 
:

나는 XMPP.php

public function createGroup() { 

     $out = "<presence from='[email protected]/xmpphp' to='[email protected]/xmpphp'><x xmlns='http://jabber.org/protocol/muc'/></presence>"; 
     $this->send($out); 
    } 

    public function createGroup2() { 

     $out = "<iq from='[email protected]/desktop' 
        id='create1' 
        to='[email protected]/xmpphp' 
        type='get'> 
        <query xmlns='http://jabber.org/protocol/muc#owner'/> 
       </iq>"; 

     $this->send($out); 
    } 

    public function sendConfigRoom() { 

     $out = "<iq from='[email protected]/desktop' 
       id='create2' 
       to='[email protected]/xmpphp' 
       type='set'> 
       <query xmlns='http://jabber.org/protocol/muc#owner'> 
       <x xmlns='jabber:x:data' type='submit'> 
        <field var='FORM_TYPE'> 
        <value>http://jabber.org/protocol/muc#roomconfig</value> 
        </field> 
        <field var='muc#roomconfig_roomname'> 
        <value>A Dark Cave</value> 
        </field> 
        <field var='muc#roomconfig_roomdesc'> 
        <value>The place for all good witches!</value> 
        </field> 
        <field var='muc#roomconfig_enablelogging'> 
        <value>0</value> 
        </field> 
        <field var='muc#roomconfig_changesubject'> 
        <value>1</value> 
        </field> 
        <field var='muc#roomconfig_allowinvites'> 
        <value>0</value> 
        </field> 
        <field var='muc#roomconfig_allowpm'> 
        <value>anyone</value> 
        </field> 
        <field var='muc#roomconfig_maxusers'> 
        <value>10</value> 
        </field> 
        <field var='muc#roomconfig_publicroom'> 
        <value>0</value> 
        </field> 
        <field var='muc#roomconfig_persistentroom'> 
        <value>1</value> 
        </field> 
        <field var='muc#roomconfig_moderatedroom'> 
        <value>0</value> 
        </field> 
        <field var='muc#roomconfig_membersonly'> 
        <value>0</value> 
        </field> 
        <field var='muc#roomconfig_passwordprotectedroom'> 
        <value>1</value> 
        </field> 
        <field var='muc#roomconfig_roomsecret'> 
        <value>cauldronburn</value> 
        </field> 
        <field var='muc#roomconfig_whois'> 
        <value>moderators</value> 
        </field> 
        <field var='muc#maxhistoryfetch'> 
        <value>50</value> 
        </field> 
        <field var='muc#roomconfig_roomadmins'> 

        <value>[email protected]</value> 
        </field> 
       </x> 
       </query> 
      </iq> "; 

     $this->send($out); 
    } 

그리고 내 createGroup.php에 추가