added missing type='submit' to mam queries

fixed some nasty inheritance problems along the way
fixes #1411
This commit is contained in:
Daniel Gultsch 2015-09-15 22:52:35 +02:00
parent b5719fd747
commit b9002d7fd5
6 changed files with 17 additions and 20 deletions

View file

@ -50,8 +50,8 @@ public class Bookmark extends Element implements ListItem {
if (this.mJoinedConversation != null
&& (this.mJoinedConversation.getMucOptions().getSubject() != null)) {
return this.mJoinedConversation.getMucOptions().getSubject();
} else if (getName() != null) {
return getName();
} else if (getBookmarkName() != null) {
return getBookmarkName();
} else {
return this.getJid().getLocalpart();
}
@ -134,14 +134,10 @@ public class Bookmark extends Element implements ListItem {
this.mJoinedConversation = conversation;
}
public String getName() {
public String getBookmarkName() {
return this.getAttribute("name");
}
public void setName(String name) {
this.name = name;
}
public void unregisterConversation() {
if (this.mJoinedConversation != null) {
this.mJoinedConversation.deregisterWithBookmark();

View file

@ -340,8 +340,8 @@ public class Conversation extends AbstractEntity implements Blockable {
if (getMode() == MODE_MULTI) {
if (getMucOptions().getSubject() != null) {
return getMucOptions().getSubject();
} else if (bookmark != null && bookmark.getName() != null) {
return bookmark.getName();
} else if (bookmark != null && bookmark.getBookmarkName() != null) {
return bookmark.getBookmarkName();
} else {
String generatedName = getMucOptions().createNameFromParticipants();
if (generatedName != null) {

View file

@ -176,7 +176,7 @@ public class IqGenerator extends AbstractGenerator {
public IqPacket queryMessageArchiveManagement(final MessageArchiveService.Query mam) {
final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
final Element query = packet.query("urn:xmpp:mam:0");
query.setAttribute("queryid",mam.getQueryId());
query.setAttribute("queryid", mam.getQueryId());
final Data data = new Data();
data.setFormType("urn:xmpp:mam:0");
if (mam.muc()) {
@ -184,8 +184,9 @@ public class IqGenerator extends AbstractGenerator {
} else if (mam.getWith()!=null) {
data.put("with", mam.getWith().toString());
}
data.put("start",getTimestamp(mam.getStart()));
data.put("end",getTimestamp(mam.getEnd()));
data.put("start", getTimestamp(mam.getStart()));
data.put("end", getTimestamp(mam.getEnd()));
data.submit();
query.addChild(data);
if (mam.getPagingOrder() == MessageArchiveService.PagingOrder.REVERSE) {
query.addChild("set", "http://jabber.org/protocol/rsm").addChild("before").setContent(mam.getReference());

View file

@ -1701,8 +1701,8 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
if (packet.getType() == IqPacket.TYPE.RESULT) {
Data data = Data.parse(packet.query().findChild("x", "jabber:x:data"));
for (Field field : data.getFields()) {
if (options.containsKey(field.getName())) {
field.setValue(options.getString(field.getName()));
if (options.containsKey(field.getFieldName())) {
field.setValue(options.getString(field.getFieldName()));
}
}
data.submit();

View file

@ -12,9 +12,9 @@ import eu.siacs.conversations.xmpp.jid.InvalidJidException;
import eu.siacs.conversations.xmpp.jid.Jid;
public class Element {
protected String name;
protected Hashtable<String, String> attributes = new Hashtable<>();
protected String content;
private final String name;
private Hashtable<String, String> attributes = new Hashtable<>();
private String content;
protected List<Element> children = new ArrayList<>();
public Element(String name) {
@ -98,7 +98,7 @@ public class Element {
return this;
}
public String getContent() {
public final String getContent() {
return content;
}
@ -162,7 +162,7 @@ public class Element {
return elementOutput.toString();
}
public String getName() {
public final String getName() {
return name;
}

View file

@ -16,7 +16,7 @@ public class Field extends Element {
super("field");
}
public String getName() {
public String getFieldName() {
return this.getAttribute("var");
}