public QuickPrivelegyEditForm(MucContact victim, int action, String myNick) { super(""); this.victim = victim; this.action = action; this.myNick = myNick; StringBuffer user = new StringBuffer(victim.getNick()); if (victim.jid != null) { user.append(" (").append(victim.realJid).append(')'); } addControl(new MultiLine(SR.get(SR.MS_USER), user.toString(), false)); reason = new TextInput(SR.get(SR.MS_REASON), null, REASON_RECENT_ID, TextField.ANY); addControl(reason); moveCursorTo(1); }
public static String processError( Presence presence, byte presenceType, ConferenceGroup group, MucContact muc) { XmppError xe = XmppError.findInStanza(presence); int errCode = xe.getCondition(); // ConferenceGroup grp=(ConferenceGroup)group;//? if (presenceType >= Presence.PRESENCE_OFFLINE) midlet.BombusQD.sd.roster.testMeOffline(muc, group, true); if (errCode != XmppError.CONFLICT || presenceType >= Presence.PRESENCE_OFFLINE) muc.setStatus(presenceType); String errText = xe.getText(); if (errText != null) return xe.toString(); // if error description is provided by server // legacy codes switch (errCode) { case XmppError.NOT_AUTHORIZED: return "Password required"; case XmppError.FORBIDDEN: return "You are banned in this room"; case XmppError.ITEM_NOT_FOUND: return "Room does not exists"; case XmppError.NOT_ALLOWED: return "You can't create room on this server"; case XmppError.NOT_ACCEPTABLE: return "Reserved roomnick must be used"; case XmppError.REGISTRATION_REQUIRED: return "This room is members-only"; case XmppError.CONFLICT: return "Nickname is already in use by another occupant"; case XmppError.SERVICE_UNAVAILABLE: return "Maximum number of users has been reached in this room"; default: return xe.getName(); } }
private void setMucMod() { JabberDataBlock iq = new Iq(victim.jid.getBareJid(), Iq.TYPE_SET, "itemmuc"); JabberDataBlock query = iq.addChildNs("query", "http://jabber.org/protocol/muc#admin"); // TODO: separate usecases to muc#owner, muc#admin and muc#moderator JabberDataBlock item = new JabberDataBlock("item", null, null); query.addChild(item); try { String rzn = reason.getValue(); String Nick = ""; if (rzn.charAt(0) == '!') { rzn = rzn.substring(1); } else { Nick = (myNick == null) ? myNick : myNick + ": "; } if (rzn.length() != 0 && myNick != null) { item.addChild("reason", Nick + rzn); } else { item.addChild("reason", Nick); } } catch (Exception e) { } switch (action) { case KICK: item.setAttribute("role", "none"); item.setAttribute("nick", victim.getNick()); break; case OUTCAST: item.setAttribute("affiliation", "outcast"); item.setAttribute("jid", victim.realJid); break; case PARTICIPANT: item.setAttribute("role", "participant"); item.setAttribute("nick", victim.getNick()); break; case VISITOR: item.setAttribute("role", "visitor"); item.setAttribute("nick", victim.getNick()); break; case MODERATOR: item.setAttribute("role", "moderator"); item.setAttribute("nick", victim.getNick()); break; case MEMBER: item.setAttribute("affiliation", "member"); item.setAttribute("jid", victim.realJid); break; case NONE: item.setAttribute("affiliation", "none"); item.setAttribute("jid", victim.realJid); break; case ADMIN: item.setAttribute("affiliation", "admin"); item.setAttribute("jid", victim.realJid); break; case OWNER: item.setAttribute("affiliation", "owner"); item.setAttribute("jid", victim.realJid); } StaticData.getInstance().roster.theStream.send(iq); }