(String name, String jid, String pass, String nick, int maxStanzas)
| 18 | public final static String NS_MUC = "http://jabber.org/protocol/muc"; |
| 19 | |
| 20 | public static void join(String name, String jid, String pass, String nick, int maxStanzas) { |
| 21 | ConferenceGroup grp = StaticData.getInstance().roster.initMuc(jid, pass); |
| 22 | grp.name = name; |
| 23 | |
| 24 | JabberDataBlock x = new JabberDataBlock("x"); |
| 25 | x.setNameSpace(NS_MUC); |
| 26 | if (pass.length() != 0) { |
| 27 | x.addChild("password", pass); // adding password to presence |
| 28 | } |
| 29 | |
| 30 | JabberDataBlock history = x.addChild("history", null); |
| 31 | history.setAttribute("maxstanzas", Integer.toString(maxStanzas)); |
| 32 | history.setAttribute("maxchars", "32768"); |
| 33 | try { |
| 34 | long last = grp.confContact.lastMessageTime; |
| 35 | long delay = (grp.conferenceJoinTime - last) / 1000; |
| 36 | if (last != 0) { |
| 37 | history.setAttribute("seconds", String.valueOf(delay)); // todo: change to since |
| 38 | } |
| 39 | } catch (Exception e) { |
| 40 | } |
| 41 | |
| 42 | int status = StaticData.getInstance().roster.myStatus; |
| 43 | if (status == Presence.PRESENCE_INVISIBLE) { |
| 44 | status = Presence.PRESENCE_ONLINE; |
| 45 | } |
| 46 | StaticData.getInstance().roster.sendDirectPresence(status, jid, nick, x); |
| 47 | |
| 48 | grp.inRoom = true; |
| 49 | |
| 50 | //sd.roster.reEnumRoster(); |
| 51 | } |
| 52 | } |
no test coverage detected