Autojoin MUC
From PsiWiki
[edit] Autojoining a MUC
As given in the Booksmarks XEP
For ease-of-use in a Jabber client, it is desirable to have a way to store shortcuts to various services and resources (such as conference rooms and webpages) as 'bookmarks' which can be displayed in the user's client. Several Jabber clients have already agreed on and implemented a method to provide this service; that informal agreement is documented and expanded upon in this document. Private XML Storage provides us with a convenient method for storing user data on the server using jabber:iq:private; all we need to do is define a namespace and schema for storing this sort of information. To this end, we introduce the 'storage' element, and the 'storage:bookmarks' to handle this data.
In simple terms, you want a way to do stuff automatically when you log on to a server. You want that stuff to be stored on the server so that whether you are at work or home doesn't matter. The powers-that-be at XMPP decided to grant this service through a nifty little thing called Private XML storage and wrote an XEP on it as above. And Psi being XMPP compliant is ready to use it.
As an example, this page will show how to auto-join the Psi MUC i.e. psi@conference.psi-im.org. Change the server to the server you want to join:
In your Roster Window, right click on the account name (say jabber.org) and then click on XML Console. On the dialog that opens, tick Enable and click on XML Input. After that in the input, type :
<iq type='set' id='2'>
<query xmlns='jabber:iq:private'>
<storage xmlns='storage:bookmarks'>
<conference name='psi_conference'
autojoin='true'
jid='psi@conference.psi-im.org'>
<nick>yourNick</nick>
<password></password>
</conference>
</storage>
</query>
</iq>
Change psi@conference.psi-im.org to the server you want to join and yourNick to the nick you want to use. If you have a password set for the MUC, enter it between the <password> and the </password> tags. Please also note that this will erase all older stored settings.
[edit] Autojoining Multiple MUCs
Now lets say you also want to auto-join jdev@conference.jabber.org. Please note that the XMPP only allows you to set the auto-join list and not update it. So first off you will have to GET your old auto-join list. To do that type the following in your XML Input after enabling the XML Console (as before).
<iq type='get'>
<query xmlns='jabber:iq:private'>
<storage xmlns='storage:bookmarks' />
</query>
</iq>
You will get something like this as output:
<iq from="someJID" type="result" to="yourJID/Psi" >
<query xmlns="jabber:iq:private">
<storage xmlns="storage:bookmarks">
<conference name="psi_conference" autojoin="true" jid="psi@conference.psi-im.org" >
<nick>yourNick</nick>
<password/>
</conference>
</storage>
</query>
</iq>
Now copy the parts between the <conference> and the </conference> tag.
Create your own list of MUCs as below:
<iq type='set' id='2'>
<query xmlns='jabber:iq:private'>
<storage xmlns='storage:bookmarks'>
<conference name='psi_conference'
autojoin='true'
jid='psi@conference.psi-im.org'>
<nick>yourNick</nick>
<password></password>
</conference>
<conference name='jdev_conference'
autojoin='true'
jid='jdev@conference.jabber.org'>
<nick>yourNick</nick>
<password></password>
</conference>
</storage>
</query>
</iq>
Note that the block of <conference> and </conference> is there twice. One of the blocks is the one you copied from the result of the GET query. And the other one you have added. That's it. Transmit this message using the XML input dialog box and you will auto-join both these MUCs. Similarly you can add any number of MUCs to auto-join.