tigase / Martin

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

i cant register MucModule #13

Open ChenTeery opened 3 years ago

ChenTeery commented 3 years ago

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``
hantu85 commented 3 years ago

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:

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

ChenTeery commented 3 years ago

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

hantu85 commented 3 years ago

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

ChenTeery commented 3 years ago

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

hantu85 commented 3 years ago

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.

ChenTeery commented 3 years ago

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

Rajaikumar-iOSDev commented 4 months ago

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

hantu85 commented 4 months ago

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

Rajaikumar-iOSDev commented 4 months ago

@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.

hantu85 commented 4 months ago

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

Rajaikumar-iOSDev commented 4 months ago

@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.