Martin icon indicating copy to clipboard operation
Martin copied to clipboard

i cant register MucModule

Open ChenTeery opened this issue 4 years ago • 11 comments

hi there: I'm trying Tigase's Xmpp service for the first time, and I have to say it's amazing. It's more powerful and easy to use than Smack and Xmppframework. but i have a problem, in your documentation , client register MucModule just need call init , like this:

 `client.modulesManager.register(MucModule())`

in TigaseSwift, XCode tell me i have to give a roomsManager:

 `client.modulesManager.register(MucModule(roomsManager:))`

and client's  connectionConfiguration have to setServerHost and setServerPort ,Otherwise, the link will fail.
Finally, I want to know which one means that the client has logged in successfully, whether the registration success or the verification success is successful.    
Can you answer me in as much detail as possible or update the document? Thank you very much``

ChenTeery avatar May 08 '21 11:05 ChenTeery

and client's connectionConfiguration have to setServerHost and setServerPort ,Otherwise, the link will fail.

It will fail without that if your server doesn't have proper DNS SRV records for client-to-server connections (SRV records for _xmpp-client._tcp.).

Yes, you need to use following method to create instance of MucModule:

  • for master branch MucModule(roomManager: DefaultRoomManager(store: DefautRoomStore()));
  • for stable branch as a parameter for roomsManager parameter of init() method you need to pass instance of DefaultRoomsManager which requires implementation of a RoomStore but due we do not provide default implementation of this class in this version of the library.

Finally, I want to know which one means that the client has logged in successfully, whether the registration success or the verification success is successful.

For registration, I would suggest to use AccountRegistrationTask which accepts in the init() method a callbacks for handling SSL validation, and registration results.

For checking when client logged in in master branch you need to observe state property of XMPPClient. For stable branch you need to observe events which are documented at https://docs.tigase.net/tigase-swift/master-snapshot/Tigase_Swift_Guide/html/#_simple_client_sending_message

hantu85 avatar May 08 '21 13:05 hantu85

thank you very much , im in master branch ,but i cant find DefautRoomStore

ChenTeery avatar May 10 '21 06:05 ChenTeery

It is there, see https://github.com/tigase/tigase-swift/blob/master/Sources/TigaseSwift/modules/muc/DefaultRoomStore.swift

hantu85 avatar May 10 '21 07:05 hantu85

i find it , Obviously, this is the Xcode problem,I have compared the stable and master branches. They are very different. Do you recommend the stable version

ChenTeery avatar May 10 '21 07:05 ChenTeery

Stable version it the version which is used by stable versions of SiskinIM and BeagleIM. But new versions of those clients will use version of the library from the master branch. Moreover, stable branch is no longer being developed.

hantu85 avatar May 10 '21 07:05 hantu85

Our server uses tigase's very old redevelopment version. I want to know whether there will be incompatibility if I use master. Previously, I used smack open source framework in Android development, but I found that there seems to be incompatibility between tigase and the packages sent in smack. So now I consider replacing IOS and android with tigase open source libraries, I'm really in a dilemma now

ChenTeery avatar May 10 '21 07:05 ChenTeery

@ChenTeery Xcode can't find DefautRoomStore - Can you let me know how did you solve it?

Rajaikumar-iOSDev avatar May 15 '24 07:05 Rajaikumar-iOSDev

https://github.com/tigase/Martin/blob/32119a1255cb315aadb3ad5587fa0ebffb013dc4/Sources/Martin/modules/muc/DefaultRoomStore.swift#L24 is part of the library so it should be found without any issues by XCode

hantu85 avatar May 15 '24 08:05 hantu85

@hantu85 True, it is part of the library but I got an error saying "'DefaultRoomStore' initializer is inaccessible due to 'internal' protection level". I assume this happened because I used SPM to install Martin.

Rajaikumar-iOSDev avatar May 15 '24 08:05 Rajaikumar-iOSDev

I think it may be related to usage of default initializer. We will look into that, but for now I would suggest to provide custom RoomStore and RoomManagerBase implementations

hantu85 avatar May 15 '24 08:05 hantu85

@hantu85 That is exactly what I did. I created custom RoomStore and RoomManagerBase implementations based on DefaultRoomStore and DefaultRoomManager. A special thanks for the default managers.

Rajaikumar-iOSDev avatar May 15 '24 08:05 Rajaikumar-iOSDev