MCPcopy Index your code
hub / github.com/BombusMod/BombusMod / blockArrived

Method blockArrived

src/main/java/xmpp/EntityCaps.java:43–84  ·  view source on GitHub ↗
(JabberDataBlock data)

Source from the content-addressed store, hash-verified

41 }
42
43 public int blockArrived(JabberDataBlock data) {
44 if (!(data instanceof Iq)) {
45 return BLOCK_REJECTED;
46 }
47 if (!data.getTypeAttribute().equals("get")) {
48 return BLOCK_REJECTED;
49 }
50
51 JabberDataBlock query = data.findNamespace("query", "http://jabber.org/protocol/disco#info");
52 if (query == null) {
53 return BLOCK_REJECTED;
54 }
55 String node = query.getAttribute("node");
56
57 if (node != null) {
58 try {
59 if (!node.equals(BOMBUS_NAMESPACE + "#" + calcVerHash())) {
60 return BLOCK_REJECTED;
61 }
62 } catch (Exception e) {
63 e.printStackTrace();
64 return BLOCK_REJECTED;
65 }
66 }
67
68 JabberDataBlock result = new Iq(data.getAttribute("from"), Iq.TYPE_RESULT, data.getAttribute("id"));
69 result.addChild(query);
70
71 JabberDataBlock identity = query.addChild("identity", null);
72 identity.setAttribute("category", BOMBUS_ID_CATEGORY);
73 identity.setAttribute("type", BOMBUS_ID_TYPE);
74 identity.setAttribute("name", StaticData.getInstance().getVersionInfo().getName());
75
76 int j = features.size();
77 for (int i = 0; i < j; i++) {
78 query.addChild("feature", null).setAttribute("var", (String) features.elementAt(i));
79 }
80
81 StaticData.getInstance().getTheStream().send(result);
82
83 return BLOCK_PROCESSED;
84 }
85 public static String ver = null;
86
87 public static String calcVerHash() throws Exception {

Callers

nothing calls this directly

Calls 14

getAttributeMethod · 0.95
calcVerHashMethod · 0.95
addChildMethod · 0.95
setAttributeMethod · 0.95
getInstanceMethod · 0.95
getTypeAttributeMethod · 0.80
findNamespaceMethod · 0.80
getVersionInfoMethod · 0.80
getTheStreamMethod · 0.80
getNameMethod · 0.65
equalsMethod · 0.45
getAttributeMethod · 0.45

Tested by

no test coverage detected