(JabberDataBlock data)
| 56 | } |
| 57 | |
| 58 | public int blockArrived(JabberDataBlock data) { |
| 59 | if( data instanceof Iq ) { |
| 60 | String from = data.getAttribute("from"); |
| 61 | String type = data.getTypeAttribute(); |
| 62 | String id = data.getAttribute("id"); |
| 63 | if (id.startsWith("nickvc")) { |
| 64 | if (type.equals("get") || type.equals("set")) return JabberBlockListener.BLOCK_REJECTED; |
| 65 | |
| 66 | VCard vc=new VCard(data);//.getNickName(); |
| 67 | String nick=vc.getNickName(); |
| 68 | |
| 69 | Contact c=StaticData.getInstance().roster.findContact(new Jid(from), false); |
| 70 | |
| 71 | String group=(c.getGroupType()==Groups.TYPE_NO_GROUP)? null: c.group.name; |
| 72 | if (nick!=null) |
| 73 | StaticData.getInstance().roster.storeContact(c, false); |
| 74 | //updateContact( nick, c.rosterJid, group, c.subscr, c.ask_subscribe); |
| 75 | StaticData.getInstance().roster.sendVCardReq(); |
| 76 | return JabberBlockListener.BLOCK_PROCESSED; |
| 77 | } |
| 78 | if (id.startsWith("getvc")) { |
| 79 | /* // prosody sends our vcard without "from" |
| 80 | if (from == null) |
| 81 | from = new Jid(data.getAttribute("to")).bareJid; |
| 82 | int index = id.indexOf(from); |
| 83 | String matchedjid = id.substring(index, id.length()); |
| 84 | String vcardFrom = from; |
| 85 | if (!(vcardFrom.equals(matchedjid) || vcardFrom.equals(new Jid(matchedjid).bareJid))) |
| 86 | return JabberBlockListener.BLOCK_REJECTED;*/ |
| 87 | if (type.equals("error")) { |
| 88 | StaticData.getInstance().roster.setQuerySign(false); |
| 89 | AlertBox alertBox = new AlertBox(SR.MS_ERROR, XmppError.findInStanza(data).toString()) { |
| 90 | |
| 91 | public void yes() { |
| 92 | destroyView(); |
| 93 | } |
| 94 | |
| 95 | public void no() { |
| 96 | destroyView(); |
| 97 | } |
| 98 | }; |
| 99 | return JabberBlockListener.BLOCK_PROCESSED; |
| 100 | } |
| 101 | if (type.equals("get") || type.equals("set") ) return JabberBlockListener.BLOCK_REJECTED; |
| 102 | |
| 103 | StaticData.getInstance().roster.setQuerySign(false); |
| 104 | VCard vcard=new VCard(data); |
| 105 | String jid=id.substring(5); |
| 106 | Contact c=StaticData.getInstance().roster.getContact(jid, true); // test |
| 107 | if (c!=null) { |
| 108 | c.vcard=vcard; |
| 109 | if (VirtualCanvas.getInstance().isShown()) { |
| 110 | // if (c.getGroupType()==Groups.TYPE_SELF) { // Not able to edit VCard if self contact in roster |
| 111 | if (c.getJid().equals(StaticData.getInstance().roster.myJid, false)) { |
| 112 | new VCardEdit(vcard); |
| 113 | } else { |
| 114 | new VCardView(c); |
| 115 | } |
nothing calls this directly
no test coverage detected