| 31 | } |
| 32 | |
| 33 | int CIceSignalQxmpp::Open(const QString &szServer, quint16 nPort, const QString &user, const QString &password) |
| 34 | { |
| 35 | QXmppConfiguration conf; |
| 36 | |
| 37 | if(QXmppUtils::jidToDomain(user).isEmpty()) |
| 38 | { |
| 39 | QString szMsg = "The user name is error. please use format: user@domain/resource"; |
| 40 | qCritical(m_Log) << szMsg; |
| 41 | emit sigError(-100, szMsg); |
| 42 | return -1; |
| 43 | } |
| 44 | if(QXmppUtils::jidToResource(user).isEmpty()) |
| 45 | { |
| 46 | qWarning(m_Log) << "The user name is error. please use format: user@domain/resource"; |
| 47 | conf.setResource(qApp->applicationName() |
| 48 | #if defined(Q_OS_ANDROID) |
| 49 | + "_android" |
| 50 | #elif defined(Q_OS_LINUX) |
| 51 | + "_linux" |
| 52 | #elif defined(Q_OS_WIN) |
| 53 | + "_windows" |
| 54 | #elif defined(Q_OS_OSX) |
| 55 | + "_osx" |
| 56 | #elif defined(Q_OS_IOS) |
| 57 | + "_ios" |
| 58 | #endif |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | conf.setHost(szServer); |
| 63 | conf.setPort(nPort); |
| 64 | conf.setJid(user); |
| 65 | conf.setPassword(password); |
| 66 | /* |
| 67 | conf.setUser(QXmppUtils::jidToUser(user.c_str())); |
| 68 | conf.setDomain(QXmppUtils::jidToDomain(user.c_str())); |
| 69 | conf.setResource(QXmppUtils::jidToResource(user.c_str())); |
| 70 | //*/ |
| 71 | m_Client.connectToServer(conf); |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | int CIceSignalQxmpp::Close() |
| 76 | { |
no test coverage detected