Skip to content

Commit

Permalink
Allow setting registrar type for xdata
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Jun 13, 2024
1 parent 46c3528 commit da4c3ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/xmpp/xmpp-im/xmpp_xdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ void XData::setType(Type t) { d->type = t; }

QString XData::registrarType() const { return d->registrarType; }

void XData::setRegistrarType(const QString &registrarType) { d->registrarType = registrarType; }

const XData::FieldList &XData::fields() const { return d->fields; }

XData::Field XData::getField(const QString &var) const
Expand Down Expand Up @@ -453,6 +455,13 @@ QDomElement XData::toXml(QDomDocument *doc, bool submitForm) const
x.appendChild(textTag(doc, "title", d->title));
if (!submitForm && !d->instructions.isEmpty())
x.appendChild(textTag(doc, "instructions", d->instructions));
if (!d->registrarType.isEmpty()) {
XData::Field f;
f.setType(Field::Field_Hidden);
f.setVar(QLatin1String("FORM_TYPE"));
f.setValue({ d->registrarType });
x.appendChild(f.toXml(doc, submitForm));
}

if (!d->fields.isEmpty()) {
for (const auto &f : std::as_const(d->fields)) {
Expand Down
1 change: 1 addition & 0 deletions src/xmpp/xmpp-im/xmpp_xdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class XData {
Type type() const;
void setType(Type);
QString registrarType() const;
void setRegistrarType(const QString &registrarType);

struct ReportField {
ReportField() { }
Expand Down

0 comments on commit da4c3ca

Please sign in to comment.