MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / extractMedia

Method extractMedia

src/main/java/ServiceDiscovery/FormField.java:262–284  ·  view source on GitHub ↗
(JabberDataBlock field)

Source from the content-addressed store, hash-verified

260 }
261
262 private VirtualElement extractMedia(JabberDataBlock field) {
263 // XEP-0221
264 try {
265 JabberDataBlock m = field.findNamespace("media", "urn:xmpp:media-element");
266 if (m == null) {
267 return null;
268 }
269
270 for (Enumeration e = m.getChildBlocks().elements(); e.hasMoreElements();) {
271 JabberDataBlock u = (JabberDataBlock) e.nextElement();
272 if (u.getTagName().equals("uri")) {
273 if (!u.getTypeAttribute().startsWith("image")) {
274 continue;
275 }
276 mediaUri = u.getText();
277 return new ImageItem(null, "[Loading Image]");
278 }
279 }
280
281 } catch (Exception e) {
282 }
283 return null;
284 }
285}

Callers 1

FormFieldMethod · 0.95

Calls 7

getChildBlocksMethod · 0.95
getTagNameMethod · 0.95
getTypeAttributeMethod · 0.95
getTextMethod · 0.95
findNamespaceMethod · 0.80
elementsMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected