Commit Graph

4615 Commits

Author SHA1 Message Date
Frank Matheron d4d2a7a6d8 [xdata] Do not require FORM_TYPE field in FilledForm
The FillableForm API is the most convenient way of filling out a
form. Currently only forms with a FORM_TYPE can be filled, due to a
restriction in FillableForm. This makes filling out untyped forms very
cumbersome.

This commit removes the required FORM_TYPE when using FilledForm (and
therefor FillableForm). Some subclasses of FilledForm already check
that the correct FORM_TYPE is set using FilledForm#ensureFormType().
2021-03-03 12:42:17 +01:00
Florian Schmaus bca3821343
Merge pull request #465 from Flowdalic/xdata-order-fields
[xdata] Order fields
2021-03-03 10:11:40 +01:00
Florian Schmaus 33f59fd7ed [xdata] Ensure that hidden FROM_TYPE field is first 2021-03-02 21:40:52 +01:00
Florian Schmaus 687c4f35aa
Merge pull request #464 from Flowdalic/relax-forms-v2
Relax forms (v2)
2021-03-02 15:50:09 +01:00
Florian Schmaus 1c262471e5 [xdata] Use extra registry for fields in clark notation
If a field name is in clark notation, then lookup the field's type via
an extra registry.
2021-03-02 11:43:23 +01:00
Florian Schmaus ce4f85acf8
Merge pull request #459 from Flowdalic/reported-data
[DataFormProvider] Retrieve field types from <reported/> if possible
2021-02-01 16:04:48 +01:00
Florian Schmaus bda3901910 Deprecate DataForm.Builder.setType() 2021-01-29 20:40:05 +01:00
Florian Schmaus 070aa8e28e [DataFormProvider] Retrieve field types from <reported/> if possible
Fixes SMACK-902.
2021-01-29 20:40:05 +01:00
Florian Schmaus 9ab50c374d [extensions] Use StanzaView as parameter type in BoBDataExtension.from()
BoBDataExtensions can also appear in IQs (Registration IQ), and
potentially also Presence stanzas.

Fixes SMACK-901.
2021-01-25 14:29:21 +01:00
Florian Schmaus 84d73e9623 [core] Fix XmlEnvironment namespace: Use default namespace (not element's)
Assume the element
<foo:bar xmlns='namespace' xmlns:foo='foo-namespace'/>

then the <bar/> element's namespace is 'foo-namespace', but the
default namespace is 'namespace'. And this is the namespace that
scopes into inner elements.
2021-01-25 14:24:55 +01:00
Florian Schmaus ec2ef1facc
Merge pull request #455 from Flowdalic/fix-data-form-npe
[xdata] Fix NPE in DataForm.Builder.addItem()
2021-01-12 12:31:17 +01:00
Florian Schmaus d64a9d9029 [xdata] Fix NPE in DataForm.Builder.addItem()
Fixes SMACK-900.
2021-01-12 09:41:46 +01:00
Florian Schmaus 9d734c4a3e
Merge pull request #454 from Flowdalic/readme-build-status-github-actions
[README] Switch "build status" badge from Travis to Github Actions
2021-01-12 09:21:54 +01:00
Florian Schmaus 3a661d71b9
Merge pull request #453 from Flowdalic/fix-caps-npe
[caps] Check for null in EntityCapsManager.addCapsExtension()
2021-01-12 09:12:16 +01:00
Florian Schmaus 8cc4ba0a42 [README] Switch "build status" badge from Travis to Github Actions
This also renames the CI workflow from "Smack CI" to just "CI".
2021-01-12 09:08:34 +01:00
Florian Schmaus df3ca4100b [caps] Check for null in EntityCapsManager.addCapsExtension()
To avoid a NPE, we check for null in addCapsExtension.

Fixes SMACK-899.
2021-01-12 09:01:19 +01:00
Florian Schmaus 938a4271f3
Merge pull request #452 from Flowdalic/abstract-provider-element-type
[core] AbstractProvider should also consider TypeVariable
2021-01-10 20:45:12 +01:00
Florian Schmaus 6eda93228f [core] AbstractProvider should also consider TypeVariable
aTalk shows the following exception:

2020-12-14 12:11:13.704 7370-30976/org.atalk.android E/AndroidRuntime: FATAL EXCEPTION: AccountManager.loadStoredAccounts
    Process: org.atalk.android, PID: 7370
    java.lang.AssertionError: Element type 'EE' is neither of type Class or ParameterizedType
        at org.jivesoftware.smack.provider.AbstractProvider.<init>(AbstractProvider.java:46)
        at org.jivesoftware.smack.provider.Provider.<init>(Provider.java:40)
        at org.jivesoftware.smack.provider.ExtensionElementProvider.<init>(ExtensionElementProvider.java:29)
        at org.xmpp.extensions.DefaultExtensionElementProvider.<init>(DefaultExtensionElementProvider.java:43)
        at org.xmpp.extensions.coin.CoinIQProvider.<init>(CoinIQProvider.java:46)
        at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.initialize(ProtocolProviderServiceJabberImpl.java:2091)
        at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderFactoryJabberImpl.createService(ProtocolProviderFactoryJabberImpl.java:121)
        at net.java.sip.communicator.service.protocol.ProtocolProviderFactory.loadAccount(ProtocolProviderFactory.java:934)
        at net.java.sip.communicator.service.protocol.AccountManager.doLoadStoredAccounts(AccountManager.java:139)
        at net.java.sip.communicator.service.protocol.AccountManager.loadStoredAccounts(AccountManager.java:294)
        at net.java.sip.communicator.service.protocol.AccountManager.runInLoadStoredAccountsThread(AccountManager.java:394)
        at net.java.sip.communicator.service.protocol.AccountManager.access$000(AccountManager.java:36)
        at
		net.java.sip.communicator.service.protocol.AccountManager$1.run(AccountManager.java:329)

where CoinIQProvider line 46-47 [1] reads

    private final DefaultExtensionElementProvider<URIsExtension> urisProvider
            = new
			DefaultExtensionElementProvider<>(URIsExtension.class);

This fixes SMACK-898.

1: f61f264312/aTalk/src/main/java/org/xmpp/extensions/coin/CoinIQProvider.java (L47)
2021-01-10 20:37:01 +01:00
Florian Schmaus 1d5949de4d
Merge pull request #451 from Flowdalic/github-actions
Add GitHub CI actions
2021-01-10 20:36:29 +01:00
Dan Caseley 5b73f2c061 Add Github Actions CI workflow, drop Travis CI
Modified-by: Florian Schmaus <flo@geekplace.eu>
2021-01-10 20:28:34 +01:00
Florian Schmaus 65d7c1c1b8 [im] Update DirectoryRosterStore TODO note regarding Android API 26. 2021-01-06 13:48:49 +01:00
Florian Schmaus 40aa9e87b7 [im] DirectoryRosterStore.readEntry() should also catch IllegalArgumentException
Fixes SMACK-897.
2021-01-06 13:48:03 +01:00
Florian Schmaus d64ee785bd [extensions] Add BoBDataExtension getBobData() and getContentId()
Those two methods where missing after the BoB API redesign.

Fixes SMACK-896.
2021-01-06 13:47:09 +01:00
Florian Schmaus fcc372754e Fix NPE in BoBIQ by adding XmlStringBuilder.optIntAttribute(String, Integer)
The method was missing and hence BoBIQ used optIntAttribute(String,
int) instead, which resulted in an NPE if the Integer was null.

Fixes SMACK-895.
2021-01-06 13:45:13 +01:00
Florian Schmaus ca3679add9 Smack 4.4.1-SNAPSHOT 2020-12-06 12:15:19 +01:00
Florian Schmaus d8864b62ca Smack 4.4.0 2020-12-06 11:28:41 +01:00
Florian Schmaus a4bb5bfda8 [ibb] Use UInt16 for 'seq' and fix its handling
Fixes a off-by-one error when incrementing 'seq'. Thanks to Kim
Alvefur <zash@zash.se> for spotting this.
2020-12-05 23:04:17 +01:00
Florian Schmaus 02c9058c3d [core] Remove @SuppressWarnings for parseContentDepthWithRoundtrip()
Also use the most specific return type in the method's signature.
2020-11-25 20:55:05 +01:00
Florian Schmaus ca497a2199 [core] Fix parseContentDepthWithRoundtrip() and add tests 2020-11-25 20:55:05 +01:00
Florian Schmaus 821bdf6d86 Smack 4.4.0-rc3-SNAPSHOT 2020-11-18 21:19:01 +01:00
Florian Schmaus c1f3f8ce13 Smack 4.4.0-rc2 2020-11-18 20:04:55 +01:00
Florian Schmaus f10cbb4a97 [core] Add requireNonNull() check to some connection endpoints 2020-11-14 12:47:35 +01:00
Florian Schmaus c4228e072b [tcp] Add missing null check in resolveDomain()
The method lookupHostAddress() returns null in case of an error, hence
we need to test if the returned value is null prior adding the endpoint.

Should fix the following NPE:

java.lang.NullPointerException:
  at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration (XMPPTCPConnection.java:606)
  at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal (XMPPTCPConnection.java:846)
  at org.jivesoftware.smack.AbstractXMPPConnection.connect (AbstractXMPPConnection.java:530)
  at org.jivesoftware.smack.ReconnectionManager$2.run (ReconnectionManager.java:282)
  at java.lang.Thread.run (Thread.java:784)

Reported-by: Eng ChongMeng <cmeng.gm@gmail.com>
2020-11-14 12:47:34 +01:00
Guus der Kinderen 59cf449799 Provide more detailed code comment. 2020-11-09 21:21:27 +01:00
Guus der Kinderen 0ff8040895 FileTransfer: replace Error.none with null
This fixes an inconsistent representation of a 'no error' representation, that
causes a file transfer in which not enough bytes were transferred to _not_ be
marked as having a problem.
2020-11-09 21:21:27 +01:00
Florian Schmaus e117f431bc Smack 4.4.0-rc2-SNAPSHOT 2020-11-09 09:32:29 +01:00
Florian Schmaus e6236b0c21 Smack 4.4.0-rc1 2020-11-09 08:54:18 +01:00
Florian Schmaus afd18f95c9 Add Smack.getNoticeStream() and 'License' section to README 2020-11-09 08:46:57 +01:00
Florian Schmaus 1f5ada4822 Add org.jivesoftware.smack.Smack with getVersion() and ensureInitialized() 2020-11-09 08:46:57 +01:00
Florian Schmaus df96c57093 [address] Get rid of PacketCopy workaround
PacketCopy subclassing Stanza was always a peculiarity. The only
subclasses of Stanza should be Message, Presence, and IQ.
2020-11-09 08:46:56 +01:00
Florian Schmaus 72acd8e095 [core] Add StanzaBuilder.build() 2020-11-09 08:46:56 +01:00
Florian Schmaus 7e311ab9df [muc] Prevent race condition on enter() by waiting
This prevents a race condition of enter() with the presence listern by
waiting until all presences have been processed.

Reported-by: Guus der Kinderen <guus@goodbytes.nl>
2020-11-09 08:46:56 +01:00
Florian Schmaus f12fe2264a [muc] Only retrieve MUCUser once in Presence listener 2020-11-08 19:37:41 +01:00
Florian Schmaus 5dfed2935f Add NOTICE file 2020-11-05 12:54:54 +01:00
Florian Schmaus e1624e1ab9 Add resources/get-contributors.sh 2020-11-05 12:52:22 +01:00
Florian Schmaus 74adcda23d Add .mailmap 2020-11-05 12:52:17 +01:00
Florian Schmaus cfccc78ba0 [muc] Rename local variable 'presence' to 'reflectedSelfPresence'
To increase readability, and with that maintainability, we rename
'presence' to 'reflectedSelfPresence' in MultiUserChat.enter(), to
make it clear what kind of presence this variable holds.

Also mark the variable as final.
2020-11-03 22:31:22 +01:00
Guus der Kinderen 55d7b9d4eb Fix pubsub options rendering
The exiting code generates an unintentional nested 'options' child element:

```
<iq to='pubsub.example.org' id='FQTHU-126' type='get'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <options node='sinttest-multisubscribe-nodename-13pnc'>
      <options jid='smack-inttest-two-13pnc@example.org'
               node='sinttest-multisubscribe-nodename-13pnc'/>
    </options>
  </pubsub>
</iq>
```

This commit removes the undesired nesting, resulting in:

```
<iq to='pubsub.example.org' id='FQTHU-126' type='get'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <options jid='smack-inttest-two-13pnc@example.org'
             node='sinttest-multisubscribe-nodename-13pnc'/>
  </pubsub>
</iq>
```
2020-10-27 10:23:17 +01:00
Paul Schaub 1a9ac238e8 OpenPgpManager: Expose methods to generate and import keys 2020-10-27 10:22:46 +01:00
Florian Schmaus 28dd56a13a
Merge pull request #438 from Flowdalic/stax-disable-xxe-and-dtd
[xmlparser-stax] Disable external entities and DTD
2020-10-05 09:15:42 +02:00