tigase / Martin

(M) Martin - XMPP client library for Swift
Other
69 stars 27 forks source link

Need help on MucModule registration #8

Closed vvavepacket closed 3 years ago

vvavepacket commented 3 years ago

I'm trying to use MucModuleas per the documentation. However, it seems the current version now needs a DefaultRoomsManagerand that also needs an implementation for RoomStore protocol

Need help on how to properly register MucModule. Also, isn't tigase-swift should implement the RoomStoreinstead by the user?

hantu85 commented 3 years ago

Implementation of RoomStore is not provided as many different types of storage may be use, ie. in memory, database, core data, etc. It is up to the use to choose correct storage and implement support for it. That is also why RoomStore protocol was created in the first place.

hantu85 commented 3 years ago

All what implementation of RoomStore needs to do is to keep a reference of a Room (create it if asked) and return it when needed.

Also, another class extending Room may be used to store additional data.

vvavepacket commented 3 years ago

That makes sense. Closing this. Thank you

vvavepacket commented 3 years ago

@hantu85 quick clarification, if I understand correctly, tigase-swift doesn't have the ability to create the room by sending raw XML commands to XMPP server. It seems I need to implement the logic that will talk to my XMPP server to actually create the room.

Why is that I can see code for deleting the room

let query = Element(name: "query", xmlns: "http://jabber.org/protocol/muc#owner");
query.addChild(Element(name: "destroy"));

But I don't see one which instructs the XMPP server to create one (I think the user needs to implement it too). Is my understanding correct?

hantu85 commented 3 years ago

Room creation is identical to joining the room and most of the servers will create a room which you want to join if it does not exist. If there room was created then you should receive a status code in the response marking that this is a new room.

That is why there is no point in having a code to create a room.