Compare commits
50 commits
Author | SHA1 | Date | |
---|---|---|---|
Sergei Poljanski | 093751b0c1 | ||
Bohdan Horbeshko | 8ce99bb00d | ||
Sergei Poljanski | cb85e2c32e | ||
Sergei Poljanski | e3c64d2534 | ||
Sergei Poljanski | 3e33800d0e | ||
Sergei Poljanski | 527494f33a | ||
Sergei Poljanski | 1bae950d60 | ||
Bohdan Horbeshko | f049d5409f | ||
Sergei Poljanski | b15b00009f | ||
kosyak | d8a7051c5d | ||
kosyak | ab56d030fb | ||
kosyak | 32340ac484 | ||
kosyak | 4990ac0a23 | ||
kosyak | 8772c9fd73 | ||
kosyak | e1e2de8a76 | ||
kosyak | 948fd85a43 | ||
kosyak | bf43f5ddfd | ||
kosyak | 82134599ef | ||
kosyak | e72b866fce | ||
kosyak | b18f042b8b | ||
kosyak | a66fa08be4 | ||
kosyak | 07c730098e | ||
kosyak | 0a99844a71 | ||
kosyak | c4bda2baf1 | ||
kosyak | 88ad3f6940 | ||
kosyak | 1a33af7c15 | ||
kosyak | 5920533cf5 | ||
kosyak | 701c21ae4a | ||
kosyak | 28c633deb8 | ||
kosyak | a1cc201ae7 | ||
kosyak | d6f162fc65 | ||
kosyak | 635e5675d1 | ||
kosyak | 9529831f80 | ||
kosyak | d970679064 | ||
kosyak | cf9ca3cc46 | ||
kosyak | d88d858069 | ||
kosyak | 4431eccc98 | ||
kosyak | 973a48ef62 | ||
kosyak | 389074e802 | ||
kosyak | 1a751b8a80 | ||
kosyak | c32809b963 | ||
kosyak | c64e0925f4 | ||
Sergei Poljanski | 03fcd01ddb | ||
Sergei Poljanski | cf9d0e13b1 | ||
kosyak | 95ee8459b8 | ||
kosyak | 021552b1d4 | ||
kosyak | e3542ccf72 | ||
kosyak | ffbdad7503 | ||
kosyak | 00817b79be | ||
kosyak | 4dab5156e1 |
1213
CHANGELOG.md
224
FAQ.md
Normal file
|
@ -0,0 +1,224 @@
|
|||
# FAQ
|
||||
|
||||
## General
|
||||
|
||||
### How do I install another.im?
|
||||
|
||||
another.im is entirely open source and licensed under GPLv3. So if you are a
|
||||
software developer you can check out the sources from GitHub and use Gradle to
|
||||
build your apk file.
|
||||
|
||||
### How do I create an account?
|
||||
XMPP, like email, is a federated protocol, which means that there is not one company you can create an *official XMPP account* with. Instead there are hundreds, or even thousands, of providers out there. One of those providers is [another.im](https://another.im). If you don’t like to use *another.im* use a web search engine of your choice to find another provider. Or maybe your university has one. Or you can run your own. Or ask a friend to run one. Once you've found one, you can use another.im to create an account. Just select *register new account* on server within the create account dialog.
|
||||
|
||||
#### Domain hosting
|
||||
Using your own domain not only gives you a more recognizable Jabber ID, it also gives you the flexibility to migrate your account between different XMPP providers. This is a good compromise between the responsibilities of having to operate your own server and the downsides of being dependent on a single provider.
|
||||
|
||||
#### Running your own
|
||||
If you already have a server somewhere and are willing and able to put the necessary work in you can run your own XMPP server.
|
||||
|
||||
As of 2023 XMPP has reached a level of maturity where all major XMPP servers ([ejabberd](https://ejabberd.im), [Prosody](https://prosody.im), [Openfire](https://www.igniterealtime.org/projects/openfire/), [Tigase](https://tigase.net/xmpp-server/)) should work well with another.im.
|
||||
|
||||
Interoperability with Prosody and ejabberd is tested fairly regularly just because of their market share but we occasionally test with other servers too and fix issues as soon as we are being made aware of them.
|
||||
|
||||
### Where can I set up a custom hostname / port
|
||||
another.im will automatically look up the SRV records for your domain name
|
||||
which can point to any hostname port combination. If your server doesn’t provide
|
||||
those please contact your admin and have them read
|
||||
[this](http://prosody.im/doc/dns#srv_records). If your server operator is unwilling
|
||||
to fix this you can enable advanced server settings in the expert settings of
|
||||
another.im.
|
||||
|
||||
### I get 'Incompatible Server'
|
||||
|
||||
As regular user you should be picking a different server. The server you selected
|
||||
is probably insecure and/or very old.
|
||||
|
||||
If you are a server administrator you should make sure that your server provides
|
||||
either STARTTLS or [XEP-0368: SRV records for XMPP over TLS](https://xmpp.org/extensions/xep-0368.html).
|
||||
|
||||
On rare occasions this error message might also be caused by a server not providing
|
||||
a login (SASL) mechanism that another.im is able to handle. another.im supports
|
||||
SCRAM-SHA1, PLAIN, EXTERNAL (client certs) and DIGEST-MD5.
|
||||
|
||||
### I get 'Bind failure'. What does that mean?
|
||||
|
||||
Some Bind failures are transient and resolve themselves after a reconnect.
|
||||
|
||||
When trying to connect to OpenFire the bind failure can be a permanent problem when the domain part of the Jabber ID entered in another.im doesn’t match the domain the OpenFire server feels responsible for. For example OpenFire is configured to use the domain `a.tld` but the Jabber ID entered is `user@b.tld` where `b.tld` also points to the same host. During bind OpenFire tries to reassign the Jabber to `user@a.tld`. another.im doesn’t like that.
|
||||
This can be fixed by creating a new account in another.im that uses the Jabber ID `user@a.tld`.
|
||||
|
||||
Note: This is kind of a weird quirk in OpenFire. Most other servers would just throw a 'Server not responsible for domain' error instead of attempting to reassign the Jabber ID.
|
||||
|
||||
Maybe you attempted to use the Jabber ID `test@b.tld` because `a.tld` doesn’t point to the correct host. In that case you might have to enable the extended connection settings in the expert settings of another.im and set a host name.
|
||||
|
||||
### I get 'Stream opening error'. What does that mean?
|
||||
|
||||
In most cases this error is caused by ejabberd advertising support for TLSv1.3 but not properly supporting it. This can happen if the OpenSSL version on the server already supports TLSv1.3 but the fast\_tls wrapper library used by ejabberd not (properly) support it. Upgrading fast\_tls and ejabberd or - theoretically - downgrading OpenSSL should fix the issue. A work around is to explicitly disable TLSv1.3 support in the ejabberd configuration. More information can be found on [this issue on the ejabberd issue tracker](https://github.com/processone/ejabberd/issues/2614).
|
||||
|
||||
**The battery consumption and the entire behavior of another.im will remain the same (as good or as bad as it was before). Why is Google doing this to you? We have no idea.**
|
||||
|
||||
#### Android <= 7.1 or another.im from F-Droid (all Android versions)
|
||||
The foreground notification is still controlled over the expert settings within another.im as it always has been. Whether or not you need to enable it depends on how aggressive the non-standard 'power saving' features are that your phone vendor has built into the operating system.
|
||||
|
||||
#### Android 8.x
|
||||
Long press the permanent notification and disable that particular type of notification by moving the slider to the left. This will make the notification disappear but create another notification (this time created by the operating system itself.) that will complain about another.im (and other apps) using battery. Starting with Android 8.1 you can disable that notification again with the same method described above.
|
||||
|
||||
#### Android 9.0+
|
||||
Long press the permanent notification and press the info `(i)` button to get into the App info screen. In that screen touch the 'Notification' entry. In the next screen remove the checkbox for the 'Foreground service' entry.
|
||||
|
||||
### another.im doesn’t work for me. Where can I get help?
|
||||
|
||||
You can join our conference room on [`xmppclient-dev@conference.another.im`](xmpp:xmppclient-dev@conference.another.im).
|
||||
A lot of people in there are able to answer basic questions about the usage of
|
||||
another.im or can provide you with tips on running your own XMPP server. If
|
||||
you found a bug or your app crashes please read the Developer / Report Bugs
|
||||
section of this document.
|
||||
|
||||
### How does the address book integration work?
|
||||
|
||||
The address book integration was designed to protect your privacy. another.im
|
||||
neither uploads contacts from your address book to your server nor fills your
|
||||
address book with unnecessary contacts from your online roster. If you manually
|
||||
add a Jabber ID to your phones address book another.im will use the name and
|
||||
the profile picture of this contact. To make the process of adding Jabber IDs to
|
||||
your address book easier you can click on the profile picture in the contact
|
||||
details within another.im. This will start an "add to address book" intent
|
||||
with the JID as the payload. This doesn't require another.im to have write
|
||||
permissions on your address book but also doesn't require you to copy/paste a
|
||||
JID from one app to another.
|
||||
|
||||
### I get 'delivery failed' on my messages
|
||||
|
||||
If you get delivery failed on images it's probably because the recipient lost
|
||||
network connectivity during reception. In that case you can try it again at a
|
||||
later time.
|
||||
|
||||
For text messages the answer to your question is a little bit more complex.
|
||||
When you see 'delivery failed' on text messages, it is always something that is
|
||||
being reported by the server. The most common reason for this is that the
|
||||
recipient failed to resume a connection. When a client loses connectivity for a
|
||||
short time the client usually has a five minute window to pick up that
|
||||
connection again. When the client fails to do so because the network
|
||||
connectivity is out for longer than that all messages sent to that client will
|
||||
be returned to the sender resulting in a delivery failed.
|
||||
|
||||
Instead of returning a message to the sender both ejabberd and prosody have the
|
||||
ability to store messages in offline storage when the disconnecting client is
|
||||
the only client. In prosody this is available via an extra module called
|
||||
```mod_smacks_offline```. In ejabberd this is available via some configuration
|
||||
settings.
|
||||
|
||||
Other less common reasons are that the message you sent didn't meet some
|
||||
criteria enforced by the server (too large, too many). Another reason could be
|
||||
that the recipient is offline and the server doesn't provide offline storage.
|
||||
|
||||
Usually you are able to distinguish between these two groups in the fact that
|
||||
the first one happens always after some time and the second one happens almost
|
||||
instantly.
|
||||
|
||||
### Where can I see the status of my contacts? How can I set a status or priority?
|
||||
|
||||
Statuses are a horrible metric. Setting them manually to a proper value rarely
|
||||
works because users are either lazy or just forget about them. Setting them
|
||||
automatically does not provide quality results either. Keyboard or mouse
|
||||
activity as indicator for example fails when the user is just looking at
|
||||
something (reading an article, watching a movie). Furthermore automatic setting
|
||||
of status always implies an impact on your privacy (are you sure you want
|
||||
everybody in your contact list to know that you have been using your computer at
|
||||
4am‽).
|
||||
|
||||
In the past status has been used to judge the likelihood of whether or not your
|
||||
messages are being read. This is no longer necessary. With Chat Markers
|
||||
(XEP-0333, supported by Conversations since 0.4) we have the ability to **know**
|
||||
whether or not your messages are being read. Similar things can be said for
|
||||
priorities. In the past priorities have been used (by servers, not by clients!)
|
||||
to route your messages to one specific client. With carbon messages (XEP-0280,
|
||||
supported by Conversations since 0.1) this is no longer necessary. Using
|
||||
priorities to route OTR messages isn't practical either because they are not
|
||||
changeable on the fly. Metrics like last active client (the client which sent
|
||||
the last message) are much better.
|
||||
|
||||
Unfortunately these modern replacements for legacy XMPP features are not widely
|
||||
adopted. However another.im should be an instant messenger for the future and
|
||||
instead of making another.im compatible with the past we should work on
|
||||
implementing new, improved technologies and getting them into other XMPP clients
|
||||
as well.
|
||||
|
||||
Making these status and priority optional isn't a solution either because
|
||||
another.im is trying to get rid of old behaviours and set an example for
|
||||
other clients.
|
||||
|
||||
|
||||
### How do I backup / move another.im to a new device?
|
||||
|
||||
Use the Backup button in the Settings.
|
||||
|
||||
### another.im is missing a certain feature
|
||||
|
||||
Please report it to our XMPP conference [`xmppclient-dev@conference.another.im`](xmpp:xmppclient-dev@conference.another.im).
|
||||
|
||||
## Security
|
||||
|
||||
### Why are there two end-to-end encryption methods and which one should I choose?
|
||||
|
||||
* OMEMO works even when a contact is offline, and works with multiple devices. It also allows asynchronous file-transfer when the server has [HTTP File Upload](http://xmpp.org/extensions/xep-0363.html). However, OMEMO not widely support and is currently implemented only [by a handful of clients](https://omemo.top).
|
||||
* OpenPGP (XEP-0027) is a very old encryption method that has some advantages over OMEMO but should only be used by people who know what they are doing.
|
||||
|
||||
### How do I use OpenPGP
|
||||
|
||||
Before you continue reading you should note that the OpenPGP support in
|
||||
another.im is experimental. This is not because it will make the app unstable
|
||||
but because the fundamental concepts of PGP aren't ready for widespread use.
|
||||
The way PGP works is that you trust Key IDs instead of JID's or email addresses.
|
||||
So in theory your contact list should consist of Public-Key-IDs instead of
|
||||
JID's. But of course no email or XMPP client out there implements these
|
||||
concepts. Plus PGP in the context of instant messaging has a couple of
|
||||
downsides: It is vulnerable to replay attacks and it is rather verbose.
|
||||
|
||||
To use OpenPGP you have to install the open source app
|
||||
[OpenKeychain](http://www.openkeychain.org) and then long press on the account in
|
||||
manage accounts and choose renew PGP announcement from the contextual menu.
|
||||
|
||||
### OMEMO is grayed out. What do I do?
|
||||
OMEMO is only available in 1:1 chats and private (members-only, non-anonymous) group chats. Encrypting public group chats makes little to no sense since anyone (including a hypothetical attacker) can join and a user couldn’t possibily verify all participants anyway. Furthermore for a lot of public group chat it is desirable to give new comers access to the full history.
|
||||
|
||||
### OMEMO doesn’t work. I get a 'Something went wrong' message in the 'Trust OMEMO Fingerprints' screen.
|
||||
OMEMO has two requirements: Your server and the server of your contact need to support PEP. Both of you can verify that individually by opening your account details and selecting ```Server info``` from the menu. The appearing table should list PEP as available. The second requirement is that the initial sender needs to have access to the published key material. This can either be achieved by having mutual presence subscription (you can verify that by opening the contact details and see if both check boxes *Send presence updates* and *Receive presence updates* are checked) or by using a server that makes the public key material accessible to anyone. In the [Compliance Tester](https://compliance.conversations.im) this is indicated by the 'OMEMO' feature. Since it is very common that the first messages are exchanged *before* adding each other to the contact list it is desirable to use servers that have 'OMEMO support'.
|
||||
|
||||
### How does the encryption for group chats work?
|
||||
|
||||
#### OMEMO
|
||||
|
||||
OMEMO encryption works only in private (members only) conferences that are non-anonymous. Non-anonymous (being able to discover the real JID of other participants) is a technical requirement to discover the key material. Members only is a sort of arbitrary requirement imposed by another.im. (see 'OMEMO is grayed out')
|
||||
|
||||
The server of all participants need to pass the OMEMO [Compliance Test](https://conversations.im/compliance/).
|
||||
In other words they either need to run ejabberd 18.01+ or Prosody 0.11+.
|
||||
|
||||
(Alternatively it would also work if all participants had each other in their contact list; But that rarely is the case in larger group chats.)
|
||||
|
||||
The owner of a conference can make a public conference private by going into the conference
|
||||
details and hit the settings button (the one with the gears) and select both *private* and
|
||||
*members only*.
|
||||
|
||||
#### OpenPGP
|
||||
|
||||
Every participant has to announce their OpenPGP key (see answer above).
|
||||
If you would like to send encrypted messages to a conference you have to make
|
||||
sure that you have every participant's public key in your OpenKeychain.
|
||||
Right now there is no check in another.im to ensure that.
|
||||
You have to take care of that yourself. Go to the conference details and
|
||||
touch every key id (The hexadecimal number below a contact). This will send you
|
||||
to OpenKeychain which will assist you on adding the key. This works best in
|
||||
very small conferences with contacts you are already using OpenPGP with. This
|
||||
feature is regarded experimental. another.im is the only client that uses
|
||||
XEP-0027 with conferences. (The XEP neither specifically allows nor disallows
|
||||
this.)
|
||||
|
||||
### What is Blind Trust Before Verification / why are messages marked with a red lock?
|
||||
|
||||
Read more about the concept on https://gultsch.de/trust.html
|
||||
|
||||
### I found a bug
|
||||
|
||||
Please report it to our XMPP conference [`xmppclient-dev@conference.narayana.im`](xmpp:xmppclient-dev@conference.narayana.im).
|
277
README.md
|
@ -1,6 +1,44 @@
|
|||
<h1 align="center">Conversations Classic</h1>
|
||||
<h1 align="center">another.im</h1>
|
||||
|
||||
<p align="center">Conversations Classic: the very last word in instant messaging</p>
|
||||
<h2><p align="center">another.im: the very last word in instant messaging</p></h2>
|
||||
|
||||
<p align="center"><a href="https://f-droid.org/packages/eu.siacs.conversations.classic">
|
||||
<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
|
||||
alt="Get it on F-Droid"
|
||||
height="80">
|
||||
</a></p>
|
||||
|
||||
## About app and us
|
||||
|
||||
the Another Instant Messenger is not a messenger,
|
||||
> don't believe the words.
|
||||
|
||||
|
||||
we just offer you a standardized xmpp-client with predicted features which work equally on all platforms.\
|
||||
in our clients we have realized pure XMPP and you won't step on a hedgehog unexpectedly when you communicate with another xmpp client or server.
|
||||
|
||||
|
||||
because you buy our open-sourced bitcoin,\
|
||||
we decided to offer you to buy our open-sourced messenger.\
|
||||
ha-ha joke.\
|
||||
it's free, really. GPLv3, whatever.
|
||||
|
||||
|
||||
for Android, it's just an improved fork of Conversations,\
|
||||
for iOS, it's our development from scratch,\
|
||||
for Desktops we're polako [looking](xmpp:xmppclient-dev@conference.another.im). for devs.
|
||||
|
||||
|
||||
all necessary XEP's was realized by Conversations devs but we added a cherry on top of this.\
|
||||
on the server side we are offering free to use Prosody server,\
|
||||
just connect to [another.im](xmpp:xmppclient-dev@conference.another.im), but we are encouroge you to don't trust us, self-host.
|
||||
|
||||
OTR encryption is also supported as 'secret chats' due to otr has been designed for one-time sessions and the concept of 'secret chats' fully corresponds to the idea of the OTR.
|
||||
|
||||
also you can just download <a href="https://dev.narayana.im/narayana/anotherim">the source code</a>, compile it and install.
|
||||
|
||||
only those who seeks will realize the way to pay us,\
|
||||
we can offer you additional server-side features and some telecommunication magic on our <a href="https://narayana.im">narayana.im</a>
|
||||
|
||||
## Design principles
|
||||
|
||||
|
@ -28,11 +66,11 @@
|
|||
|
||||
### XMPP Features
|
||||
|
||||
Conversations Classic works with every XMPP server out there. However XMPP is an
|
||||
another.im works with every XMPP server out there. However XMPP is an
|
||||
extensible protocol. These extensions are standardized as well in so called
|
||||
XEP's. Conversations Classic supports a couple of these to make the overall user
|
||||
XEP's. another.im supports a couple of these to make the overall user
|
||||
experience better. There is a chance that your current XMPP server does not
|
||||
support these extensions; therefore to get the most out of Conversations Classic you
|
||||
support these extensions; therefore to get the most out of another.im you
|
||||
should consider either switching to an XMPP server that does or — even better —
|
||||
run your own XMPP server for you and your friends. These XEP's are:
|
||||
|
||||
|
@ -51,7 +89,7 @@ run your own XMPP server for you and your friends. These XEP's are:
|
|||
client to your desktop client and back within one conversation.
|
||||
* [XEP-0308: Last Message Correction](https://xmpp.org/extensions/xep-0308.html) allows you to edit last message as well as retract it
|
||||
* [XEP-0313: Message Archive Management](http://xmpp.org/extensions/xep-0313.html) synchronize message history with the
|
||||
server. Catch up with messages that were sent while Conversations Classic was
|
||||
server. Catch up with messages that were sent while another.im was
|
||||
offline.
|
||||
* [XEP-0352: Client State Indication](http://xmpp.org/extensions/xep-0352.html) lets the server know whether or not
|
||||
Conversations is in the background. Allows the server to save bandwidth by
|
||||
|
@ -59,229 +97,10 @@ run your own XMPP server for you and your friends. These XEP's are:
|
|||
* [XEP-0363: HTTP File Upload](http://xmpp.org/extensions/xep-0363.html) allows you to share files in conferences
|
||||
and with offline contacts.
|
||||
* [XEP-0461: Message Replies](https://xmpp.org/extensions/xep-0461.html) provides support of native replies, which also works in many transports (gateways) as well
|
||||
* [XEP-0364: Current Off-the-Record Messaging Usage](https://xmpp.org/extensions/xep-0364.html) is also supported as 'secret chats' due to otr has been designed for one-time sessions and the concept of 'secret chats' fully corresponds to the idea of the OTR.
|
||||
|
||||
### FAQ
|
||||
|
||||
## FAQ
|
||||
[*FAQ*](/FAQ.md) is located separately and may contain links to upstream.
|
||||
|
||||
### General
|
||||
|
||||
#### How do I install Conversations?
|
||||
|
||||
Conversations Classic is entirely open source and licensed under GPLv3. So if you are a
|
||||
software developer you can check out the sources from GitHub and use Gradle to
|
||||
build your apk file.
|
||||
|
||||
#### How do I create an account?
|
||||
XMPP, like email, is a federated protocol, which means that there is not one company you can create an *official XMPP account* with. Instead there are hundreds, or even thousands, of providers out there. One of those providers is [conversations.im](https://account.conversations.im). If you don’t like to use *conversations.im* use a web search engine of your choice to find another provider. Or maybe your university has one. Or you can run your own. Or ask a friend to run one. Once you've found one, you can use Conversations to create an account. Just select *register new account* on server within the create account dialog.
|
||||
|
||||
##### Domain hosting
|
||||
Using your own domain not only gives you a more recognizable Jabber ID, it also gives you the flexibility to migrate your account between different XMPP providers. This is a good compromise between the responsibilities of having to operate your own server and the downsides of being dependent on a single provider.
|
||||
|
||||
##### Running your own
|
||||
If you already have a server somewhere and are willing and able to put the necessary work in you can run your own XMPP server.
|
||||
|
||||
As of 2023 XMPP has reached a level of maturity where all major XMPP servers ([ejabberd](https://ejabberd.im), [Prosody](https://prosody.im), [Openfire](https://www.igniterealtime.org/projects/openfire/), [Tigase](https://tigase.net/xmpp-server/)) should work well with Conversations.
|
||||
|
||||
Interoperability with Prosody and ejabberd is tested fairly regularly just because of their market share but we occasionally test with other servers too and fix issues as soon as we are being made aware of them.
|
||||
|
||||
#### Where can I set up a custom hostname / port
|
||||
Conversations Classic will automatically look up the SRV records for your domain name
|
||||
which can point to any hostname port combination. If your server doesn’t provide
|
||||
those please contact your admin and have them read
|
||||
[this](http://prosody.im/doc/dns#srv_records). If your server operator is unwilling
|
||||
to fix this you can enable advanced server settings in the expert settings of
|
||||
Conversations Classic.
|
||||
|
||||
#### I get 'Incompatible Server'
|
||||
|
||||
As regular user you should be picking a different server. The server you selected
|
||||
is probably insecure and/or very old.
|
||||
|
||||
If you are a server administrator you should make sure that your server provides
|
||||
either STARTTLS or [XEP-0368: SRV records for XMPP over TLS](https://xmpp.org/extensions/xep-0368.html).
|
||||
|
||||
On rare occasions this error message might also be caused by a server not providing
|
||||
a login (SASL) mechanism that Conversations Classic is able to handle. Conversations Classic supports
|
||||
SCRAM-SHA1, PLAIN, EXTERNAL (client certs) and DIGEST-MD5.
|
||||
|
||||
#### I get 'Bind failure'. What does that mean?
|
||||
|
||||
Some Bind failures are transient and resolve themselves after a reconnect.
|
||||
|
||||
When trying to connect to OpenFire the bind failure can be a permanent problem when the domain part of the Jabber ID entered in Conversations Classic doesn’t match the domain the OpenFire server feels responsible for. For example OpenFire is configured to use the domain `a.tld` but the Jabber ID entered is `user@b.tld` where `b.tld` also points to the same host. During bind OpenFire tries to reassign the Jabber to `user@a.tld`. Conversations Classic doesn’t like that.
|
||||
This can be fixed by creating a new account in Conversations Classic that uses the Jabber ID `user@a.tld`.
|
||||
|
||||
Note: This is kind of a weird quirk in OpenFire. Most other servers would just throw a 'Server not responsible for domain' error instead of attempting to reassign the Jabber ID.
|
||||
|
||||
Maybe you attempted to use the Jabber ID `test@b.tld` because `a.tld` doesn’t point to the correct host. In that case you might have to enable the extended connection settings in the expert settings of Conversations and set a host name.
|
||||
|
||||
#### I get 'Stream opening error'. What does that mean?
|
||||
|
||||
In most cases this error is caused by ejabberd advertising support for TLSv1.3 but not properly supporting it. This can happen if the OpenSSL version on the server already supports TLSv1.3 but the fast\_tls wrapper library used by ejabberd not (properly) support it. Upgrading fast\_tls and ejabberd or - theoretically - downgrading OpenSSL should fix the issue. A work around is to explicitly disable TLSv1.3 support in the ejabberd configuration. More information can be found on [this issue on the ejabberd issue tracker](https://github.com/processone/ejabberd/issues/2614).
|
||||
|
||||
**The battery consumption and the entire behavior of Conversations Classic will remain the same (as good or as bad as it was before). Why is Google doing this to you? We have no idea.**
|
||||
|
||||
##### Android <= 7.1 or Conversations Classic from F-Droid (all Android versions)
|
||||
The foreground notification is still controlled over the expert settings within Conversations Classic as it always has been. Whether or not you need to enable it depends on how aggressive the non-standard 'power saving' features are that your phone vendor has built into the operating system.
|
||||
|
||||
##### Android 8.x
|
||||
Long press the permanent notification and disable that particular type of notification by moving the slider to the left. This will make the notification disappear but create another notification (this time created by the operating system itself.) that will complain about Conversations (and other apps) using battery. Starting with Android 8.1 you can disable that notification again with the same method described above.
|
||||
|
||||
##### Android 9.0+
|
||||
Long press the permanent notification and press the info `(i)` button to get into the App info screen. In that screen touch the 'Notification' entry. In the next screen remove the checkbox for the 'Foreground service' entry.
|
||||
|
||||
#### Conversations doesn’t work for me. Where can I get help?
|
||||
|
||||
You can join our conference room on [`xmppclient-dev@conference.narayana.im`](xmpp:xmppclient-dev@conference.narayana.im).
|
||||
A lot of people in there are able to answer basic questions about the usage of
|
||||
Conversations Classic or can provide you with tips on running your own XMPP server. If
|
||||
you found a bug or your app crashes please read the Developer / Report Bugs
|
||||
section of this document.
|
||||
|
||||
#### How does the address book integration work?
|
||||
|
||||
The address book integration was designed to protect your privacy. Conversations Classic
|
||||
neither uploads contacts from your address book to your server nor fills your
|
||||
address book with unnecessary contacts from your online roster. If you manually
|
||||
add a Jabber ID to your phones address book Conversations Classic will use the name and
|
||||
the profile picture of this contact. To make the process of adding Jabber IDs to
|
||||
your address book easier you can click on the profile picture in the contact
|
||||
details within Conversations Classic. This will start an "add to address book" intent
|
||||
with the JID as the payload. This doesn't require Conversations Classic to have write
|
||||
permissions on your address book but also doesn't require you to copy/paste a
|
||||
JID from one app to another.
|
||||
|
||||
#### I get 'delivery failed' on my messages
|
||||
|
||||
If you get delivery failed on images it's probably because the recipient lost
|
||||
network connectivity during reception. In that case you can try it again at a
|
||||
later time.
|
||||
|
||||
For text messages the answer to your question is a little bit more complex.
|
||||
When you see 'delivery failed' on text messages, it is always something that is
|
||||
being reported by the server. The most common reason for this is that the
|
||||
recipient failed to resume a connection. When a client loses connectivity for a
|
||||
short time the client usually has a five minute window to pick up that
|
||||
connection again. When the client fails to do so because the network
|
||||
connectivity is out for longer than that all messages sent to that client will
|
||||
be returned to the sender resulting in a delivery failed.
|
||||
|
||||
Instead of returning a message to the sender both ejabberd and prosody have the
|
||||
ability to store messages in offline storage when the disconnecting client is
|
||||
the only client. In prosody this is available via an extra module called
|
||||
```mod_smacks_offline```. In ejabberd this is available via some configuration
|
||||
settings.
|
||||
|
||||
Other less common reasons are that the message you sent didn't meet some
|
||||
criteria enforced by the server (too large, too many). Another reason could be
|
||||
that the recipient is offline and the server doesn't provide offline storage.
|
||||
|
||||
Usually you are able to distinguish between these two groups in the fact that
|
||||
the first one happens always after some time and the second one happens almost
|
||||
instantly.
|
||||
|
||||
#### Where can I see the status of my contacts? How can I set a status or priority?
|
||||
|
||||
Statuses are a horrible metric. Setting them manually to a proper value rarely
|
||||
works because users are either lazy or just forget about them. Setting them
|
||||
automatically does not provide quality results either. Keyboard or mouse
|
||||
activity as indicator for example fails when the user is just looking at
|
||||
something (reading an article, watching a movie). Furthermore automatic setting
|
||||
of status always implies an impact on your privacy (are you sure you want
|
||||
everybody in your contact list to know that you have been using your computer at
|
||||
4am‽).
|
||||
|
||||
In the past status has been used to judge the likelihood of whether or not your
|
||||
messages are being read. This is no longer necessary. With Chat Markers
|
||||
(XEP-0333, supported by Conversations since 0.4) we have the ability to **know**
|
||||
whether or not your messages are being read. Similar things can be said for
|
||||
priorities. In the past priorities have been used (by servers, not by clients!)
|
||||
to route your messages to one specific client. With carbon messages (XEP-0280,
|
||||
supported by Conversations since 0.1) this is no longer necessary. Using
|
||||
priorities to route OTR messages isn't practical either because they are not
|
||||
changeable on the fly. Metrics like last active client (the client which sent
|
||||
the last message) are much better.
|
||||
|
||||
Unfortunately these modern replacements for legacy XMPP features are not widely
|
||||
adopted. However Conversations Classic should be an instant messenger for the future and
|
||||
instead of making Conversations Classic compatible with the past we should work on
|
||||
implementing new, improved technologies and getting them into other XMPP clients
|
||||
as well.
|
||||
|
||||
Making these status and priority optional isn't a solution either because
|
||||
Conversations Classic is trying to get rid of old behaviours and set an example for
|
||||
other clients.
|
||||
|
||||
|
||||
#### How do I backup / move Conversations Classic to a new device?
|
||||
|
||||
Use the Backup button in the Settings.
|
||||
|
||||
#### Conversations Classic is missing a certain feature
|
||||
|
||||
Please report it to our XMPP conference [`xmppclient-dev@conference.narayana.im`](xmpp:xmppclient-dev@conference.narayana.im)
|
||||
|
||||
### Security
|
||||
|
||||
#### Why are there two end-to-end encryption methods and which one should I choose?
|
||||
|
||||
* OMEMO works even when a contact is offline, and works with multiple devices. It also allows asynchronous file-transfer when the server has [HTTP File Upload](http://xmpp.org/extensions/xep-0363.html). However, OMEMO not widely support and is currently implemented only [by a handful of clients](https://omemo.top).
|
||||
* OpenPGP (XEP-0027) is a very old encryption method that has some advantages over OMEMO but should only be used by people who know what they are doing.
|
||||
|
||||
#### How do I use OpenPGP
|
||||
|
||||
Before you continue reading you should note that the OpenPGP support in
|
||||
Conversations Classic is experimental. This is not because it will make the app unstable
|
||||
but because the fundamental concepts of PGP aren't ready for widespread use.
|
||||
The way PGP works is that you trust Key IDs instead of JID's or email addresses.
|
||||
So in theory your contact list should consist of Public-Key-IDs instead of
|
||||
JID's. But of course no email or XMPP client out there implements these
|
||||
concepts. Plus PGP in the context of instant messaging has a couple of
|
||||
downsides: It is vulnerable to replay attacks and it is rather verbose.
|
||||
|
||||
To use OpenPGP you have to install the open source app
|
||||
[OpenKeychain](http://www.openkeychain.org) and then long press on the account in
|
||||
manage accounts and choose renew PGP announcement from the contextual menu.
|
||||
|
||||
#### OMEMO is grayed out. What do I do?
|
||||
OMEMO is only available in 1:1 chats and private (members-only, non-anonymous) group chats. Encrypting public group chats makes little to no sense since anyone (including a hypothetical attacker) can join and a user couldn’t possibily verify all participants anyway. Furthermore for a lot of public group chat it is desirable to give new comers access to the full history.
|
||||
|
||||
#### OMEMO doesn’t work. I get a 'Something went wrong' message in the 'Trust OMEMO Fingerprints' screen.
|
||||
OMEMO has two requirements: Your server and the server of your contact need to support PEP. Both of you can verify that individually by opening your account details and selecting ```Server info``` from the menu. The appearing table should list PEP as available. The second requirement is that the initial sender needs to have access to the published key material. This can either be achieved by having mutual presence subscription (you can verify that by opening the contact details and see if both check boxes *Send presence updates* and *Receive presence updates* are checked) or by using a server that makes the public key material accessible to anyone. In the [Compliance Tester](https://compliance.conversations.im) this is indicated by the 'OMEMO' feature. Since it is very common that the first messages are exchanged *before* adding each other to the contact list it is desirable to use servers that have 'OMEMO support'.
|
||||
|
||||
#### How does the encryption for group chats work?
|
||||
|
||||
##### OMEMO
|
||||
|
||||
OMEMO encryption works only in private (members only) conferences that are non-anonymous. Non-anonymous (being able to discover the real JID of other participants) is a technical requirement to discover the key material. Members only is a sort of arbitrary requirement imposed by Conversations. (see 'OMEMO is grayed out')
|
||||
|
||||
The server of all participants need to pass the OMEMO [Compliance Test](https://conversations.im/compliance/).
|
||||
In other words they either need to run ejabberd 18.01+ or Prosody 0.11+.
|
||||
|
||||
(Alternatively it would also work if all participants had each other in their contact list; But that rarely is the case in larger group chats.)
|
||||
|
||||
The owner of a conference can make a public conference private by going into the conference
|
||||
details and hit the settings button (the one with the gears) and select both *private* and
|
||||
*members only*.
|
||||
|
||||
##### OpenPGP
|
||||
|
||||
Every participant has to announce their OpenPGP key (see answer above).
|
||||
If you would like to send encrypted messages to a conference you have to make
|
||||
sure that you have every participant's public key in your OpenKeychain.
|
||||
Right now there is no check in Conversations Classic to ensure that.
|
||||
You have to take care of that yourself. Go to the conference details and
|
||||
touch every key id (The hexadecimal number below a contact). This will send you
|
||||
to OpenKeychain which will assist you on adding the key. This works best in
|
||||
very small conferences with contacts you are already using OpenPGP with. This
|
||||
feature is regarded experimental. Conversations Classic is the only client that uses
|
||||
XEP-0027 with conferences. (The XEP neither specifically allows nor disallows
|
||||
this.)
|
||||
|
||||
#### What is Blind Trust Before Verification / why are messages marked with a red lock?
|
||||
|
||||
Read more about the concept on https://gultsch.de/trust.html
|
||||
|
||||
#### I found a bug
|
||||
|
||||
Please report it to our XMPP conference [`xmppclient-dev@conference.narayana.im`](xmpp:xmppclient-dev@conference.narayana.im).
|
||||
*In case of issues, bugs, suggestions please contact us directly [`xmppclient-dev@conference.another.im`](xmpp:xmppclient-dev@conference.another.im).*
|
10
build.gradle
|
@ -71,6 +71,7 @@ dependencies {
|
|||
implementation 'com.google.guava:guava:32.1.3-android'
|
||||
implementation 'io.michaelrocks:libphonenumber-android:8.13.17'
|
||||
implementation 'im.conversations.webrtc:webrtc-android:119.0.0'
|
||||
implementation 'org.jitsi:org.otr4j:0.23'
|
||||
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
||||
|
@ -83,6 +84,7 @@ dependencies {
|
|||
|
||||
implementation 'com.github.singpolyma:TokenAutoComplete:bfa93780e0'
|
||||
|
||||
implementation 'com.github.kizitonwose.colorpreference:core:1.1.0'
|
||||
implementation 'com.github.kizitonwose.colorpreference:support:1.1.0'
|
||||
implementation 'com.caverock:androidsvg-aar:1.4'
|
||||
implementation 'com.github.singpolyma:Better-Link-Movement-Method:4df081e1e4'
|
||||
|
@ -102,12 +104,12 @@ android {
|
|||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 34
|
||||
versionCode 42115
|
||||
versionName "2.3.1"
|
||||
versionCode 42116
|
||||
versionName "2.3.2"
|
||||
archivesBaseName += "-$versionName"
|
||||
applicationId "eu.siacs.conversations.classic"
|
||||
applicationId "im.narayana.another"
|
||||
resValue "string", "applicationId", applicationId
|
||||
def appName = "Conversations Classic"
|
||||
def appName = "another.im"
|
||||
resValue "string", "app_name", appName
|
||||
buildConfigField "String", "APP_NAME", "\"$appName\""
|
||||
}
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
xmlns:foaf="http://xmlns.com/foaf/0.1/"
|
||||
xmlns:xmpp="https://linkmauve.fr/ns/xmpp-doap#"
|
||||
xmlns:schema="https://schema.org/">
|
||||
<name>Conversations</name>
|
||||
<name>another.im</name>
|
||||
|
||||
<created>2014-01-14</created>
|
||||
|
||||
<shortdesc xml:lang="en">Android XMPP Client</shortdesc>
|
||||
|
||||
<description xml:lang="en">Conversations is an open source XMPP/Jabber client for the Android platform</description>
|
||||
<description xml:lang="en">another.im is an open source XMPP/Jabber client for the Android platform forked from Conversations</description>
|
||||
|
||||
<homepage rdf:resource="https://conversations.im/"/>
|
||||
<download-page rdf:resource="https://play.google.com/store/apps/details?id=eu.siacs.conversations"/>
|
||||
<bug-database rdf:resource="https://codeberg.org/iNPUTmice/Conversations/issues"/>
|
||||
<homepage rdf:resource="https://another.im/"/>
|
||||
<!--<download-page rdf:resource="https://play.google.com/store/apps/details?id=eu.siacs.conversations"/> -->
|
||||
<bug-database rdf:resource="https://dev.narayana.im/narayana/anotherim/issues"/>
|
||||
<!-- See https://github.com/ewilderj/doap/issues/53 -->
|
||||
<developer-forum rdf:resource="xmpp:conversations@siacs.conference.eu?join"/>
|
||||
<support-forum rdf:resource="xmpp:conversations@siacs.conference.eu?join"/>
|
||||
<developer-forum rdf:resource="xmpp:xmppclient-dev@conference.another.im"/>
|
||||
<support-forum rdf:resource="xmpp:xmppclient-dev@conference.another.im"/>
|
||||
|
||||
<license rdf:resource="https://codeberg.org/iNPUTmice/Conversations/src/branch/master/LICENSE"/>
|
||||
<license rdf:resource="https://dev.narayana.im/narayana/anotherim/src/branch/master/LICENSE"/>
|
||||
|
||||
<!-- See https://github.com/ewilderj/doap/issues/49 -->
|
||||
<language>en</language>
|
||||
|
@ -46,8 +46,8 @@
|
|||
|
||||
<maintainer>
|
||||
<foaf:Person>
|
||||
<foaf:name>Daniel Gultsch</foaf:name>
|
||||
<foaf:homepage rdf:resource="https://gultsch.de/"/>
|
||||
<foaf:name>kosyak</foaf:name>
|
||||
<foaf:homepage rdf:resource="https://another.im/"/>
|
||||
</foaf:Person>
|
||||
</maintainer>
|
||||
|
||||
|
@ -63,6 +63,14 @@
|
|||
<implements rdf:resource="https://xmpp.org/rfcs/rfc6122.html"/>
|
||||
<implements rdf:resource="https://xmpp.org/rfcs/rfc7590.html"/>
|
||||
|
||||
<implements>
|
||||
<xmpp:SupportedXep>
|
||||
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0364.html"/>
|
||||
<xmpp:status>Deferred</xmpp:status>
|
||||
<xmpp:version>0.3.2</xmpp:version>
|
||||
</xmpp:SupportedXep>
|
||||
</implements>
|
||||
|
||||
<implements>
|
||||
<xmpp:SupportedXep>
|
||||
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0027.html"/>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
The app is renamed to Conversations Classic.
|
||||
The app is renamed to another.im.
|
||||
|
||||
* Numerous small fixes
|
||||
* Info about PM on MUC details screen
|
||||
|
|
6
fastlane/metadata/android/en-US/changelogs/4211504.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
* Added account indicator
|
||||
* Group chats are now marked with an additional icon
|
||||
* Saved messages now have a brighter background color
|
||||
* Added nickname in reply in Multi-User Chats(MUC)
|
||||
* Contact status is now displayed separately
|
||||
* Updated Russian and Ukrainian localizations
|
1
fastlane/metadata/android/en-US/changelogs/4211604.txt
Normal file
|
@ -0,0 +1 @@
|
|||
* TODO: OTR и что то еще
|
|
@ -1,42 +1,23 @@
|
|||
Easy to use, reliable, battery friendly. With built-in support for images, group chats and e2e encryption.
|
||||
the Another Instant Messenger is not a messenger,
|
||||
don't believe the words.
|
||||
|
||||
Design principles:
|
||||
we just offer you a standardized xmpp-client with predicted features which work equally on all platforms.
|
||||
in our clients we have realized pure XMPP and you won't step on a hedgehog unexpectedly when you communicate with another xmpp client or server.
|
||||
|
||||
* Be as beautiful and easy to use as possible without sacrificing security or privacy
|
||||
* Rely on existing, well established protocols
|
||||
* Do not require a Google Account or specifically Google Cloud Messaging (GCM)
|
||||
* Require as few permissions as possible
|
||||
because you buy our open-sourced bitcoin,
|
||||
we decided to offer you to buy our open-sourced messenger.
|
||||
ha-ha joke.
|
||||
it's free, really. GPLv3, whatever.
|
||||
|
||||
Features:
|
||||
for Android, it's just an improved fork of Conversations,
|
||||
|
||||
* End-to-end encryption with either <a href="https://en.wikipedia.org/wiki/OMEMO">OMEMO</a> or <a href="http://openpgp.org/about/">OpenPGP</a>
|
||||
* Sending and receiving images
|
||||
* Encrypted audio and video calls (DTLS-SRTP) with DTMF dialpad
|
||||
* Intuitive UI that follows Android Design guidelines
|
||||
* Pictures / Avatars for your Contacts
|
||||
* Syncs with desktop client
|
||||
* Conferences (with support for bookmarks)
|
||||
* Address book integration
|
||||
* Multiple accounts / unified inbox
|
||||
* Builtin image editor
|
||||
* Very low impact on battery life
|
||||
all necessary XEP's was realized by Conversations devs but we added a cherry on top of this.
|
||||
on the server side we are offering free to use Prosody server,
|
||||
just connect to [another.im](xmpp:xmppclient-dev@conference.another.im), but we are encouroge you to don't trust us, self-host.
|
||||
|
||||
XMPP Features:
|
||||
OTR encryption is also supported as 'secret chats' due to otr has been designed for one-time sessions and the concept of 'secret chats' fully corresponds to the idea of the OTR.
|
||||
|
||||
Conversations Classic works with every XMPP server out there. However XMPP is an extensible protocol. These extensions are standardized as well in so called XEP’s. Conversations Classic supports a couple of those to make the overall user experience better. There is a chance that your current XMPP server does not support these extensions. Therefore to get the most out of Conversations Classic you should consider either switching to an XMPP server that does or - even better - run your own XMPP server for you and your friends.
|
||||
also you can just download <a href="https://dev.narayana.im/narayana/anotherim">the source code</a>, compile it and install.
|
||||
|
||||
These XEPs are - as of now:
|
||||
|
||||
* XEP-0050: Ad-Hoc Commands lets to interact with gateways.
|
||||
* XEP-0065: SOCKS5 Bytestreams (or mod_proxy65). Will be used to transfer files if both parties are behind a firewall (NAT).
|
||||
* XEP-0163: Personal Eventing Protocol for avatars.
|
||||
* XEP-0191: Blocking command lets you blacklist spammers or block contacts without removing them from your roster.
|
||||
* XEP-0198: Stream Management allows XMPP to survive small network outages and changes of the underlying TCP connection.
|
||||
* XEP-0215: External Service Discovery will be used to discover STUN and TURN servers which facilitate P2P A/V calls.
|
||||
* XEP-0237: Roster Versioning mainly to save bandwidth on poor mobile connections.
|
||||
* XEP-0280: Message Carbons which automatically syncs the messages you send to your desktop client and thus allows you to switch seamlessly from your mobile client to your desktop client and back within one conversation.
|
||||
* XEP-0308: Last Message Correction allows you to edit last message as well as retract it.
|
||||
* XEP-0313: Message Archive Management synchronize message history with the server. Catch up with messages that were sent while Conversations Classic was offline.
|
||||
* XEP-0352: Client State Indication lets the server know whether or not Conversations Classic is in the background. Allows the server to save bandwidth by withholding unimportant packages.
|
||||
* XEP-0363: HTTP File Upload allows you to share files in conferences and with offline contacts. Requires an additional component on your server.
|
||||
* XEP-0461: Message Replies provides support of native replies, which also works in many transports (gateways) as well.
|
||||
only those who seeks will realize the way to pay us,
|
||||
we can offer you additional server-side features and some telecommunication magic on our <a href="https://narayana.im">narayana.im</a>
|
|
@ -1 +1 @@
|
|||
Encrypted, easy-to-use XMPP instant messenger for your mobile device
|
||||
Yet Another Conversations fork but...
|
|
@ -1,4 +1,4 @@
|
|||
Приложение переименовано в Conversations Classic.
|
||||
Приложение переименовано в another.im.
|
||||
|
||||
* Многочисленные мелкие исправления
|
||||
* Информация о личных сообщениях в групповом чате на экране сведений
|
||||
|
|
6
fastlane/metadata/android/ru/changelogs/4211504.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
* Добавлен индикатор учетной записи
|
||||
* Групповые чаты теперь отмечены дополнительным значком
|
||||
* Закрепленные сообщения теперь имеют более яркий цвет фона
|
||||
* Добавлен никнейм в ответ в многопользовательских чатах(MUC)
|
||||
* Статус контакта теперь отображается отдельно
|
||||
* Обновлены русская и украинская локализации
|
1
fastlane/metadata/android/ru/changelogs/4211604.txt
Normal file
|
@ -0,0 +1 @@
|
|||
* TODO: OTR и что то еще
|
|
@ -1,42 +1,23 @@
|
|||
Надёжный, простой в использовании, сберегающий заряд аккумулятора. Обладает встроенной поддержкой изображений, групповых чатов и сквозного шифрования.
|
||||
Another Instant Messenger - это не просто мессенджер,
|
||||
не верьте слухам.
|
||||
|
||||
Принципы проектирования:
|
||||
Мы просто предлагаем вам стандартный XMPP-клиент с предсказуемым функционалом, который одинаково работает на всех платформах.
|
||||
В наших клиентах мы реализовали чистый XMPP, и вы не столкнетесь в неожиданными проблемами, при общении с другими XMPP-клиентами или серверами.
|
||||
|
||||
* Быть предельно красивым и простым в использовании, не жертвуя безопасностью или конфиденциальностью
|
||||
* Полагаться на существующие, устоявшиеся протоколы
|
||||
* Не требовать учётной записи Google, в частности Google Cloud Messaging (GCM)
|
||||
* Требовать как можно меньше разрешений
|
||||
когда то вы купили биткойн из-за его открытого кода,
|
||||
поэтому мы решили предложить вам купить наш мессенджер с открытым исходным кодом.
|
||||
Шутка.
|
||||
Он бесплатный, правда. GPLv3, по...
|
||||
|
||||
Функции:
|
||||
Для андройд это просто улучшенный форк Conversations,
|
||||
|
||||
* Сквозное шифрование (от отправителя к получателю) при помощи <a href="https://en.wikipedia.org/wiki/OMEMO">OMEMO</a> или <a href="http://openpgp.org/about/">OpenPGP</a>
|
||||
* Отправка и получение изображений
|
||||
* Зашифрованные голосовые и видеозвонки (DTLS-SRTP) с DTMF-клавиатурой
|
||||
* Интуитивно понятный интерфейс пользователя, соответствующий указаниям Android Design
|
||||
* Изображения / Аватары для Ваших контактов
|
||||
* Синхронизация с настольным клиентом
|
||||
* Конференции (с поддержкой закладок)
|
||||
* Интеграция адресной книги
|
||||
* Несколько учётных записей / единая папка входящих
|
||||
* Встроенный редактор изображений
|
||||
* Крайне низкое влияние на время жизни от аккумулятора
|
||||
Все необходимые XEP'ы были реализованы разработчиками Conversations, но мы добавили вишенку сверху.
|
||||
На стороне сервера мы предлагаем бесплатный сервер на базе Prosody,
|
||||
просто подключитесь к [another.im](xmpp:xmppclient-dev@conference.another.im), но мы призываем вас не доверять нам, используйте собственный хостинг.
|
||||
|
||||
Функции XMPP:
|
||||
Шифрование OTR также поддерживается как «секретные чаты», поскольку OTR был разработан для одноразовых сессий, а концепция «секретных чатов» полностью соответствует идее OTR.
|
||||
|
||||
Conversations Classic работает с любым сервером XMPP. Однако, XMPP — расширяемый протокол. Расширения также стандартизированы в так называемых XEP. Conversations Classic поддерживает некоторые из них, дабы улучшить общий опыт использования. Может оказаться, что Ваш текущий сервер XMPP не поддерживает эти расширения. Поэтому, чтобы получить максимум от Conversations Classic, рассмотрите переход на XMPP-сервер с поддержкой этих расширений, или — ещё лучше — запускайте собственный сервер XMPP для себя и своих друзей.
|
||||
также вы можете просто скачать <a href=«https://dev.narayana.im/narayana/anotherim»>исходный код</a>, скомпилировать его и установить.
|
||||
|
||||
В настоящее время поддерживаются такие XEP:
|
||||
|
||||
* XEP-0050: Контекстные Команды, позволяет взаимодействовать с мостами.
|
||||
* XEP-0065: Байтовые Потоки SOCKS5 (либо mod_proxy65). Используется для передачи файлов, если обе стороны находятся за брандмауэром (NAT).
|
||||
* XEP-0163: Персональный Протокол Событий, для аватаров.
|
||||
* XEP-0191: Команда Блокировки, позволяет Вам заносить спамеров в чёрный список или блокировать контакты, не удаляя их из своего списка.
|
||||
* XEP-0198: Управление Потоками, позволяет XMPP выдерживать небольшие перебои в сети и смены основного TCP-соединения.
|
||||
* XEP-0215: Поиск Внешних Сервисов, позволяет находить STUN- и TURN-сервера, когда аудио-/видеозвонок невозможно осуществить напрямую.
|
||||
* XEP-0237: Версионирование Списка Контактов, прежде всего для сберегания мобильного трафика.
|
||||
* XEP-0280: Сообщения под Копирку, автоматически синхронизирует отправленные сообщений на настольный клиент, чем позволяет плавно переключаться между мобильным и настольным клиентами в рамках одного разговора.
|
||||
* XEP-0308: Исправление Последнего Сообщения, позволяет отредактировать или отозвать сообщение.
|
||||
* XEP-0313: Управление Архивом Сообщений, синхронизирует историю сообщений с сервером. Узнавайте о сообщениях, отправленных, пока Conversations Classic находился оффлайн.
|
||||
* XEP-0352: Индикация Состояния Клиента, сообщает серверу, работает ли Conversations Classic в фоновом режиме. Позволяет серверу сберегать пропускную способность, удерживая неважные пакеты.
|
||||
* XEP-0363: Загрузка Файлов по HTTP, позволяет обмениваться файлами в конференциях и с оффлайн-контактами. Требует дополнительного компонента на Вашем сервере.
|
||||
* XEP-0461: Ответы на Сообщения, предоставляет поддержку привязанных к сообщению ответов, которые также работают со многими транспортами (мостами).
|
||||
только те, кто ищет, поймут, как нам платить,
|
||||
мы можем предложить вам дополнительные услуги и немного телекоммуникационной магии на нашем <a href=«https://narayana.im»>narayana.im</a>.
|
|
@ -1 +1 @@
|
|||
Простой в использовании XMPP-клиент с поддержкой шифрования для Вашого телефона
|
||||
Очередной клон Conversations, но...
|
|
@ -1,4 +1,4 @@
|
|||
Застосунок перейменовано на Conversations Classic.
|
||||
Застосунок перейменовано на another.im.
|
||||
|
||||
* Численні дрібні виправлення
|
||||
* Інформація про особисті повідомлення в груповому чаті на екрані деталей
|
||||
|
|
6
fastlane/metadata/android/uk/changelogs/4211504.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
* Додано індикатор облікового запису
|
||||
* Групові чати тепер позначено додатковою піктограмою
|
||||
* Закріплені повідомлення тепер мають яскравіший колір тла
|
||||
* Додано нікнейм у відповідь у групових чатах
|
||||
* Статус контакту тепер відображається окремо
|
||||
* Оновлено російську й українську локалізації
|
1
fastlane/metadata/android/uk/changelogs/4211604.txt
Normal file
|
@ -0,0 +1 @@
|
|||
* TODO: OTR и что то еще
|
|
@ -1,42 +1,23 @@
|
|||
Надійний, простий у використанні, ощадливо витрачає заряд акумулятора. Має вбудовану підтримку зображень, групових чатів і наскрізного шифрування.
|
||||
Another Instant Messenger - це не просто месенджер,
|
||||
не вірте чуткам.
|
||||
|
||||
Принципи проєктування:
|
||||
Ми просто пропонуємо вам стандартний XMPP-клієнт із передбачуваним функціоналом, який однаково працює на всіх платформах.
|
||||
У наших клієнтах ми реалізували чистий XMPP, і ви не зіштовхнетеся з неочікуваними проблемами, при спілкуванні з іншими XMPP-клієнтами чи серверами.
|
||||
|
||||
* Бути максимально красивим та простим у використанні, не жертвуючи безпекою чи конфіденційністю
|
||||
* Покладатися на існуючі, добре встановлені протоколи
|
||||
* Не вимагати облікового запису Google, зокрема Google Cloud Messaging (GCM)
|
||||
* Вимагати якомога менше дозволів
|
||||
колись ви купили біткойн через його відкритий код,
|
||||
тому ми вирішили запропонувати вам купити наш месенджер із відкритим вихідним кодом.
|
||||
Жарт.
|
||||
Він безкоштовний, правда. GPLv3, по...
|
||||
|
||||
Функції:
|
||||
Для андройд це просто покращений форк Conversations,
|
||||
|
||||
* Наскрізне шифрування (від відправника до одержувача) за допомогою <a href="https://en.wikipedia.org/wiki/OMEMO">OMEMO</a> або <a href="http://openpgp.org/about/">OpenPGP</a>
|
||||
* Надсилання та отримання зображень
|
||||
* Зашифровані голосові та відеодзвінки (DTLS-SRTP) з DTMF-клавіатурою
|
||||
* Інтуїтивно зрозумілий інтерфейс користувача, який відповідає вказівкам Android Design
|
||||
* Зображення / Аватари для Ваших контактів
|
||||
* Синхронізація з настільним клієнтом
|
||||
* Конференції (з підтримкою закладок)
|
||||
* Інтеграція адресної книги
|
||||
* Кілька облікових записів / єдина папка вхідних
|
||||
* Вбудований редактор зображень
|
||||
* Дуже низький вплив на термін служби акумулятора
|
||||
Всі необхідні XEP'и були реалізовані розробниками Conversations, але ми додали зверху вишні (дивовижні).
|
||||
На боці сервера ми пропонуємо безкоштовний сервер на базі Prosody,
|
||||
просто підключіться до [another.im](xmpp:xmppclient-dev@conference.another.im), але ми закликаємо вас не довірять нам, використовуйте власний хостинг.
|
||||
|
||||
Функції XMPP:
|
||||
Шифрування OTR також підтримується як «секретні чати», оскільки OTR був розроблений для одноразових сесій, а концепція «секретних чатів» цілком відповідає ідеї OTR.
|
||||
|
||||
Conversations Classic працює з будь-яким сервером XMPP. Проте XMPP — розширюваний протокол. Розширення також стандартизовані в так званих XEP. Conversations Classic підтримує кілька з них, щоб покращити загальний досвід користування. Може виявитися, що Ваш поточний сервер XMPP не підтримує цих розширень. Тому, щоб отримати максимум від Conversations Classic, розгляньте перехід на XMPP-сервер з підтримкою цих розширень або — ще краще — запускайте власний сервер XMPP для себе і своїх друзів.
|
||||
також ви можете просто скачати [вихідний код](https://dev.narayana.im/narayana/anotherim), скомпілювати його і встановити.
|
||||
|
||||
На даний час підтримуються такі XEP:
|
||||
|
||||
* XEP-0050: Контекстові Команди, дозволяє взаємодіяти з мостами.
|
||||
* XEP-0065: Байтові Потоки SOCKS5 (або mod_proxy65). Використовується для передачі файлів, якщо обидві сторони знаходяться за брандмауером (NAT).
|
||||
* XEP-0163: Персональний Протокол Подій, для аватарів.
|
||||
* XEP-0191: Команда Блокування, дозволяє Вам заносити спамерів у чорний список або блокувати контакти, не видаляючи їх зі свого списку.
|
||||
* XEP-0198: Керування Потоками, дозволяє XMPP витримувати невеликі перебої в мережі та зміни основного TCP-з'єднання.
|
||||
* XEP-0215: Пошук Зовнішніх Сервісів, дозволяє знаходити STUN- та TURN-сервери, коли аудіо-/відеодзвінок неможливо здійснити напряму.
|
||||
* XEP-0237: Версіонування Списку Контактів, передусім для заощадження мобільного трафіку.
|
||||
* XEP-0280: Повідомлення під Копірку, автоматично синхронізує надіслані повідомлення на настільний клієнт, чим дозволяє плавно перемикатися між мобільним і настільним клієнтами в рамках однієї розмови.
|
||||
* XEP-0308: Виправлення Останнього Повідомлення, дозволяє відредагувати чи відкликати повідомлення.
|
||||
* XEP-0313: Керування Архівом Повідомлень, синхронізує історію повідомлень із сервером. Дізнавайтеся про повідомлення, надіслані, поки Conversations Classic був офлайн.
|
||||
* XEP-0352: Індикація Стану Клієнта, повідомляє серверу, чи працює Conversations Classic у фоновому режимі. Дозволяє серверу заощаджувати пропускну здатність, утримуючи неважливі пакети.
|
||||
* XEP-0363: Завантаження Файлів за HTTP, дозволяє обмінюватися файлами в конференціях і з офлайн-контактами. Потребує додаткового компонента на Вашому сервері.
|
||||
* XEP-0461: Відповіді на Повідомлення, надає підтримку привʼязаних до повідомлення відповідей, які також працюють із багатьма транспортами (мостами).
|
||||
тільки ті, хто шукають, збагнуть, куди в нас гроші запихувати,
|
||||
ми можемо запропонувати вам додаткові послуги і трішки телекомунікаційної магії на нашому [narayana.im](https://narayana.im).
|
||||
|
|
|
@ -36,6 +36,7 @@ import eu.siacs.conversations.services.XmppConnectionService;
|
|||
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
|
||||
import eu.siacs.conversations.ui.adapter.AccountAdapter;
|
||||
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
|
||||
import eu.siacs.conversations.utils.UIHelper;
|
||||
import eu.siacs.conversations.xmpp.Jid;
|
||||
import eu.siacs.conversations.xmpp.XmppConnection;
|
||||
|
||||
|
@ -44,8 +45,14 @@ import static eu.siacs.conversations.utils.PermissionUtils.writeGranted;
|
|||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.navigation.NavigationBarView;
|
||||
import com.kizitonwose.colorpreference.ColorDialog;
|
||||
import com.kizitonwose.colorpreference.ColorShape;
|
||||
|
||||
public class ManageAccountActivity extends XmppActivity implements OnAccountUpdate, KeyChainAliasCallback, XmppConnectionService.OnAccountCreated, AccountAdapter.OnTglAccountState {
|
||||
public class ManageAccountActivity extends XmppActivity implements OnAccountUpdate,
|
||||
KeyChainAliasCallback,
|
||||
XmppConnectionService.OnAccountCreated,
|
||||
AccountAdapter.OnTglAccountState,
|
||||
ColorDialog.OnColorSelectedListener {
|
||||
|
||||
private final String STATE_SELECTED_ACCOUNT = "selected_account";
|
||||
|
||||
|
@ -61,6 +68,18 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
|
||||
protected Pair<Integer, Intent> mPostponedActivityResult = null;
|
||||
|
||||
private AccountAdapter.ColorSelectorListener colorSelectorListener = new AccountAdapter.ColorSelectorListener() {
|
||||
@Override
|
||||
public void onColorPickerRequested(Jid accountJid, int currentColor) {
|
||||
new ColorDialog.Builder(ManageAccountActivity.this)
|
||||
.setColorShape(ColorShape.CIRCLE)
|
||||
.setColorChoices(R.array.themeColorsOverride)
|
||||
.setSelectedColor(currentColor)
|
||||
.setTag(accountJid.asBareJid().toEscapedString())
|
||||
.show();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onAccountUpdate() {
|
||||
refreshUi();
|
||||
|
@ -102,7 +121,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
}
|
||||
|
||||
accountListView = findViewById(R.id.account_list);
|
||||
this.mAccountAdapter = new AccountAdapter(this, accountList);
|
||||
this.mAccountAdapter = new AccountAdapter(this, accountList, colorSelectorListener);
|
||||
accountListView.setAdapter(this.mAccountAdapter);
|
||||
accountListView.setOnItemClickListener((arg0, view, position, arg3) -> switchToAccount(accountList.get(position)));
|
||||
registerForContextMenu(accountListView);
|
||||
|
@ -158,6 +177,13 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
super.onSaveInstanceState(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
colorSelectorListener = null;
|
||||
mAccountAdapter.colorSelectorListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
|
@ -349,6 +375,12 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onColorSelected(int newColor, String tag) {
|
||||
UIHelper.overrideAccountColor(this, tag, newColor);
|
||||
refreshUiReal();
|
||||
}
|
||||
|
||||
private void addAccountFromKey() {
|
||||
try {
|
||||
KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
|
||||
|
|
BIN
src/conversations/res/.DS_Store
vendored
Normal file
22
src/conversations/res/drawable-anydpi/ic_notification.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="1080"
|
||||
android:viewportHeight="1080"
|
||||
android:tint="#FFFFFF">
|
||||
<group android:scaleX="0.92"
|
||||
android:scaleY="0.92"
|
||||
android:translateX="43.2"
|
||||
android:translateY="43.2">>
|
||||
<group
|
||||
android:scaleX="0.95"
|
||||
android:scaleY="0.95"
|
||||
android:pivotX="540"
|
||||
android:pivotY="540">
|
||||
<path android:fillColor="#FFFFFF" android:fillType="nonZero" android:pathData="M1.3,248C10.3,235.5 24.5,249.6 35.6,252C61.5,261.8 87.3,271.8 113.1,281.7C181.5,310.4 252.6,330.3 323.7,350.2C331.2,352.4 342,355.7 342.7,364.9C342.3,387.8 342.6,410.9 344.9,433.5C349.4,473 358.4,511.3 369.3,549.6C395.9,631.7 434.7,710.2 486,779.8C502.5,803.8 522.2,825.1 541.4,846.9C545,851.9 551,840 553.8,838.5C652.8,730.3 725.2,592.7 745.2,447.1C750.6,422 749.3,394.7 751,368.9C750.4,363.9 748.5,357.6 753,353.4C763.8,344 780,342.7 793.2,337.9C814.8,331.7 835.9,324.8 857.5,318.8C910.2,303.2 961.8,284.6 1012.8,264.1C1030.3,257.9 1047.4,250.9 1064.6,244C1068.4,242.5 1073.6,241.3 1076.4,245.4C1076.9,246.1 1077.6,247 1078.7,247L1078.7,265.9C1055.3,535 852.4,763.9 630.7,902C626.7,905.8 609.7,910.5 616.2,914.4C649.6,941.6 686.4,964.5 725.5,983C748.9,993.9 773,1003.5 798,1010.2C811.8,1012 826,1028 805.7,1033L803.1,1033C741.8,1027.2 680.5,1011.4 623.1,988.3C602.3,980 582,970.4 561.6,961.4C547.7,955.8 540.7,946.2 526.3,957.1C452.7,990.7 373.8,1013.1 294.4,1025.8C293.1,1025.8 291.9,1025.8 290.7,1026.2C284.2,1028.8 274.6,1019.7 280.3,1014.4C287.4,1004.6 300.7,1004.6 311.1,1000.3C326.7,994.8 342.1,988.9 357.3,982.5C397.1,964.2 435.1,941.5 469.7,914.7C473.9,913 458.7,906.2 457.1,904.8C423.7,884.5 391.4,862.5 360.3,838.9C179.2,698.7 20.2,495.8 1.3,261.2Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
<path android:fillColor="#FFFFFF" android:fillType="nonZero" android:pathData="M553.7,47C677.9,53 759.1,187.4 698.7,299.1C637.6,418.1 460.9,420.1 395.5,304.1C332.4,190.8 408.6,55.6 536.9,47Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
Before Width: | Height: | Size: 809 B After Width: | Height: | Size: 622 B |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 551 B After Width: | Height: | Size: 414 B |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 835 B |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 48 KiB |
|
@ -1,13 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="1146.7721"
|
||||
android:viewportHeight="1146.7721">
|
||||
<group
|
||||
android:translateX="322.69516"
|
||||
android:translateY="317.38605">
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M253.219,17.719C126.144,17.719 22.469,118.884 22.469,243.75C22.469,368.616 126.138,469.844 253.219,469.844C292.739,469.844 323.216,461.736 358,449.094L468.469,493.625A14.556,14.562 0,0 0,488.063 476.625L458.125,355.656C477.356,321.886 483.938,283.416 483.938,243.75C483.938,118.887 380.293,17.719 253.219,17.719zM143.844,222C157.651,222 168.844,233.193 168.844,247C168.844,260.807 157.651,272 143.844,272C130.037,272 118.844,260.807 118.844,247C118.844,233.193 130.037,222 143.844,222zM253.563,222C267.37,222 278.563,233.193 278.563,247C278.563,260.807 267.37,272 253.563,272C239.755,272 228.563,260.807 228.563,247C228.563,233.193 239.755,222 253.563,222zM363.563,222C377.37,222 388.563,233.193 388.563,247C388.563,260.807 377.37,272 363.563,272C349.755,272 338.563,260.807 338.563,247C338.563,233.193 349.755,222 363.563,222z" />
|
||||
</group>
|
||||
</vector>
|
|
@ -1,13 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="1146.7721"
|
||||
android:viewportHeight="1146.7721">
|
||||
<group
|
||||
android:translateX="322.69516"
|
||||
android:translateY="317.38605">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M253.219,17.719C126.144,17.719 22.469,118.884 22.469,243.75C22.469,368.616 126.138,469.844 253.219,469.844C292.739,469.844 323.216,461.736 358,449.094L468.469,493.625A14.556,14.562 0,0 0,488.063 476.625L458.125,355.656C477.356,321.886 483.938,283.416 483.938,243.75C483.938,118.887 380.293,17.719 253.219,17.719zM143.844,222C157.651,222 168.844,233.193 168.844,247C168.844,260.807 157.651,272 143.844,272C130.037,272 118.844,260.807 118.844,247C118.844,233.193 130.037,222 143.844,222zM253.563,222C267.37,222 278.563,233.193 278.563,247C278.563,260.807 267.37,272 253.563,272C239.755,272 228.563,260.807 228.563,247C228.563,233.193 239.755,222 253.563,222zM363.563,222C377.37,222 388.563,233.193 388.563,247C388.563,260.807 377.37,272 363.563,272C349.755,272 338.563,260.807 338.563,247C338.563,233.193 349.755,222 363.563,222z" />
|
||||
</group>
|
||||
</vector>
|
13
src/conversations/res/drawable/ic_main_logo.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="108dp" android:viewportHeight="1080" android:viewportWidth="1080" android:width="108dp">
|
||||
<group
|
||||
android:scaleX="0.8"
|
||||
android:scaleY="0.8"
|
||||
android:pivotX="540"
|
||||
android:pivotY="540">
|
||||
<path android:fillColor="#FCFDD1" android:fillType="nonZero" android:pathData="M1.3,248C10.3,235.5 24.5,249.6 35.6,252C61.5,261.8 87.3,271.8 113.1,281.7C181.5,310.4 252.6,330.3 323.7,350.2C331.2,352.4 342,355.7 342.7,364.9C342.3,387.8 342.6,410.9 344.9,433.5C349.4,473 358.4,511.3 369.3,549.6C395.9,631.7 434.7,710.2 486,779.8C502.5,803.8 522.2,825.1 541.4,846.9C545,851.9 551,840 553.8,838.5C652.8,730.3 725.2,592.7 745.2,447.1C750.6,422 749.3,394.7 751,368.9C750.4,363.9 748.5,357.6 753,353.4C763.8,344 780,342.7 793.2,337.9C814.8,331.7 835.9,324.8 857.5,318.8C910.2,303.2 961.8,284.6 1012.8,264.1C1030.3,257.9 1047.4,250.9 1064.6,244C1068.4,242.5 1073.6,241.3 1076.4,245.4C1076.9,246.1 1077.6,247 1078.7,247L1078.7,265.9C1055.3,535 852.4,763.9 630.7,902C626.7,905.8 609.7,910.5 616.2,914.4C649.6,941.6 686.4,964.5 725.5,983C748.9,993.9 773,1003.5 798,1010.2C811.8,1012 826,1028 805.7,1033L803.1,1033C741.8,1027.2 680.5,1011.4 623.1,988.3C602.3,980 582,970.4 561.6,961.4C547.7,955.8 540.7,946.2 526.3,957.1C452.7,990.7 373.8,1013.1 294.4,1025.8C293.1,1025.8 291.9,1025.8 290.7,1026.2C284.2,1028.8 274.6,1019.7 280.3,1014.4C287.4,1004.6 300.7,1004.6 311.1,1000.3C326.7,994.8 342.1,988.9 357.3,982.5C397.1,964.2 435.1,941.5 469.7,914.7C473.9,913 458.7,906.2 457.1,904.8C423.7,884.5 391.4,862.5 360.3,838.9C179.2,698.7 20.2,495.8 1.3,261.2Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
<path android:fillColor="#FCFDD1" android:fillType="nonZero" android:pathData="M553.7,47C677.9,53 759.1,187.4 698.7,299.1C637.6,418.1 460.9,420.1 395.5,304.1C332.4,190.8 408.6,55.6 536.9,47Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
</group>
|
||||
|
||||
</vector>
|
4
src/conversations/res/drawable/ic_main_logo_bg.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<shape android:shape="oval"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#52617a"/>
|
||||
</shape>
|
12
src/conversations/res/drawable/main_logo.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/ic_main_logo_bg"/>
|
||||
|
||||
<item
|
||||
android:gravity="center"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:drawable="@drawable/ic_main_logo">
|
||||
</item>
|
||||
</layer-list>
|
15
src/conversations/res/drawable/new_launcher_background.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<group android:scaleX="0.68"
|
||||
android:scaleY="0.68"
|
||||
android:translateX="17.28"
|
||||
android:translateY="17.28">
|
||||
<path
|
||||
android:pathData="M0,0h108v108h-108z"
|
||||
android:fillColor="#52617a"/>
|
||||
</group>
|
||||
</vector>
|
21
src/conversations/res/drawable/new_launcher_foreground.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="1080"
|
||||
android:viewportHeight="1080">
|
||||
<group android:scaleX="0.59"
|
||||
android:scaleY="0.59"
|
||||
android:translateX="221.4"
|
||||
android:translateY="221.4">
|
||||
<group
|
||||
android:scaleX="0.8"
|
||||
android:scaleY="0.8"
|
||||
android:pivotX="540"
|
||||
android:pivotY="540">
|
||||
<path android:fillColor="#FCFDD1" android:fillType="nonZero" android:pathData="M1.3,248C10.3,235.5 24.5,249.6 35.6,252C61.5,261.8 87.3,271.8 113.1,281.7C181.5,310.4 252.6,330.3 323.7,350.2C331.2,352.4 342,355.7 342.7,364.9C342.3,387.8 342.6,410.9 344.9,433.5C349.4,473 358.4,511.3 369.3,549.6C395.9,631.7 434.7,710.2 486,779.8C502.5,803.8 522.2,825.1 541.4,846.9C545,851.9 551,840 553.8,838.5C652.8,730.3 725.2,592.7 745.2,447.1C750.6,422 749.3,394.7 751,368.9C750.4,363.9 748.5,357.6 753,353.4C763.8,344 780,342.7 793.2,337.9C814.8,331.7 835.9,324.8 857.5,318.8C910.2,303.2 961.8,284.6 1012.8,264.1C1030.3,257.9 1047.4,250.9 1064.6,244C1068.4,242.5 1073.6,241.3 1076.4,245.4C1076.9,246.1 1077.6,247 1078.7,247L1078.7,265.9C1055.3,535 852.4,763.9 630.7,902C626.7,905.8 609.7,910.5 616.2,914.4C649.6,941.6 686.4,964.5 725.5,983C748.9,993.9 773,1003.5 798,1010.2C811.8,1012 826,1028 805.7,1033L803.1,1033C741.8,1027.2 680.5,1011.4 623.1,988.3C602.3,980 582,970.4 561.6,961.4C547.7,955.8 540.7,946.2 526.3,957.1C452.7,990.7 373.8,1013.1 294.4,1025.8C293.1,1025.8 291.9,1025.8 290.7,1026.2C284.2,1028.8 274.6,1019.7 280.3,1014.4C287.4,1004.6 300.7,1004.6 311.1,1000.3C326.7,994.8 342.1,988.9 357.3,982.5C397.1,964.2 435.1,941.5 469.7,914.7C473.9,913 458.7,906.2 457.1,904.8C423.7,884.5 391.4,862.5 360.3,838.9C179.2,698.7 20.2,495.8 1.3,261.2Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
<path android:fillColor="#FCFDD1" android:fillType="nonZero" android:pathData="M553.7,47C677.9,53 759.1,187.4 698.7,299.1C637.6,418.1 460.9,420.1 395.5,304.1C332.4,190.8 408.6,55.6 536.9,47Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
21
src/conversations/res/drawable/new_launcher_monochrome.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="1080"
|
||||
android:viewportHeight="1080">
|
||||
<group android:scaleX="0.59"
|
||||
android:scaleY="0.59"
|
||||
android:translateX="221.4"
|
||||
android:translateY="221.4">
|
||||
<group
|
||||
android:scaleX="0.8"
|
||||
android:scaleY="0.8"
|
||||
android:pivotX="540"
|
||||
android:pivotY="540">
|
||||
<path android:fillColor="#000000" android:fillType="nonZero" android:pathData="M1.3,248C10.3,235.5 24.5,249.6 35.6,252C61.5,261.8 87.3,271.8 113.1,281.7C181.5,310.4 252.6,330.3 323.7,350.2C331.2,352.4 342,355.7 342.7,364.9C342.3,387.8 342.6,410.9 344.9,433.5C349.4,473 358.4,511.3 369.3,549.6C395.9,631.7 434.7,710.2 486,779.8C502.5,803.8 522.2,825.1 541.4,846.9C545,851.9 551,840 553.8,838.5C652.8,730.3 725.2,592.7 745.2,447.1C750.6,422 749.3,394.7 751,368.9C750.4,363.9 748.5,357.6 753,353.4C763.8,344 780,342.7 793.2,337.9C814.8,331.7 835.9,324.8 857.5,318.8C910.2,303.2 961.8,284.6 1012.8,264.1C1030.3,257.9 1047.4,250.9 1064.6,244C1068.4,242.5 1073.6,241.3 1076.4,245.4C1076.9,246.1 1077.6,247 1078.7,247L1078.7,265.9C1055.3,535 852.4,763.9 630.7,902C626.7,905.8 609.7,910.5 616.2,914.4C649.6,941.6 686.4,964.5 725.5,983C748.9,993.9 773,1003.5 798,1010.2C811.8,1012 826,1028 805.7,1033L803.1,1033C741.8,1027.2 680.5,1011.4 623.1,988.3C602.3,980 582,970.4 561.6,961.4C547.7,955.8 540.7,946.2 526.3,957.1C452.7,990.7 373.8,1013.1 294.4,1025.8C293.1,1025.8 291.9,1025.8 290.7,1026.2C284.2,1028.8 274.6,1019.7 280.3,1014.4C287.4,1004.6 300.7,1004.6 311.1,1000.3C326.7,994.8 342.1,988.9 357.3,982.5C397.1,964.2 435.1,941.5 469.7,914.7C473.9,913 458.7,906.2 457.1,904.8C423.7,884.5 391.4,862.5 360.3,838.9C179.2,698.7 20.2,495.8 1.3,261.2Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
<path android:fillColor="#000000" android:fillType="nonZero" android:pathData="M553.7,47C677.9,53 759.1,187.4 698.7,299.1C637.6,418.1 460.9,420.1 395.5,304.1C332.4,190.8 408.6,55.6 536.9,47Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
12
src/conversations/res/drawable/splash_logo.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="216dp" android:viewportHeight="1080" android:viewportWidth="1080" android:width="216dp">
|
||||
<group
|
||||
android:scaleX="0.8"
|
||||
android:scaleY="0.8"
|
||||
android:pivotX="540"
|
||||
android:pivotY="540">
|
||||
<path android:fillColor="#FCFDD1" android:fillType="nonZero" android:pathData="M1.3,248C10.3,235.5 24.5,249.6 35.6,252C61.5,261.8 87.3,271.8 113.1,281.7C181.5,310.4 252.6,330.3 323.7,350.2C331.2,352.4 342,355.7 342.7,364.9C342.3,387.8 342.6,410.9 344.9,433.5C349.4,473 358.4,511.3 369.3,549.6C395.9,631.7 434.7,710.2 486,779.8C502.5,803.8 522.2,825.1 541.4,846.9C545,851.9 551,840 553.8,838.5C652.8,730.3 725.2,592.7 745.2,447.1C750.6,422 749.3,394.7 751,368.9C750.4,363.9 748.5,357.6 753,353.4C763.8,344 780,342.7 793.2,337.9C814.8,331.7 835.9,324.8 857.5,318.8C910.2,303.2 961.8,284.6 1012.8,264.1C1030.3,257.9 1047.4,250.9 1064.6,244C1068.4,242.5 1073.6,241.3 1076.4,245.4C1076.9,246.1 1077.6,247 1078.7,247L1078.7,265.9C1055.3,535 852.4,763.9 630.7,902C626.7,905.8 609.7,910.5 616.2,914.4C649.6,941.6 686.4,964.5 725.5,983C748.9,993.9 773,1003.5 798,1010.2C811.8,1012 826,1028 805.7,1033L803.1,1033C741.8,1027.2 680.5,1011.4 623.1,988.3C602.3,980 582,970.4 561.6,961.4C547.7,955.8 540.7,946.2 526.3,957.1C452.7,990.7 373.8,1013.1 294.4,1025.8C293.1,1025.8 291.9,1025.8 290.7,1026.2C284.2,1028.8 274.6,1019.7 280.3,1014.4C287.4,1004.6 300.7,1004.6 311.1,1000.3C326.7,994.8 342.1,988.9 357.3,982.5C397.1,964.2 435.1,941.5 469.7,914.7C473.9,913 458.7,906.2 457.1,904.8C423.7,884.5 391.4,862.5 360.3,838.9C179.2,698.7 20.2,495.8 1.3,261.2Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
<path android:fillColor="#FCFDD1" android:fillType="nonZero" android:pathData="M553.7,47C677.9,53 759.1,187.4 698.7,299.1C637.6,418.1 460.9,420.1 395.5,304.1C332.4,190.8 408.6,55.6 536.9,47Z" android:strokeColor="#00000000" android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.5"/>
|
||||
|
||||
</group>
|
||||
</vector>
|
6
src/conversations/res/mipmap-anydpi-v26/new_launcher.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/new_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/new_launcher_foreground"/>
|
||||
<monochrome android:drawable="@drawable/new_launcher_monochrome"/>
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/new_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/new_launcher_foreground"/>
|
||||
<monochrome android:drawable="@drawable/new_launcher_monochrome"/>
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 2.4 KiB |
BIN
src/conversations/res/mipmap-hdpi/new_launcher.webp
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 4.1 KiB |
BIN
src/conversations/res/mipmap-hdpi/new_launcher_round.webp
Normal file
After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
BIN
src/conversations/res/mipmap-mdpi/new_launcher.webp
Normal file
After Width: | Height: | Size: 842 B |
Before Width: | Height: | Size: 2.7 KiB |
BIN
src/conversations/res/mipmap-mdpi/new_launcher_round.webp
Normal file
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.3 KiB |
BIN
src/conversations/res/mipmap-xhdpi/new_launcher.webp
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 5.9 KiB |
BIN
src/conversations/res/mipmap-xhdpi/new_launcher_round.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 4.7 KiB |
BIN
src/conversations/res/mipmap-xxhdpi/new_launcher.webp
Normal file
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 9.1 KiB |
BIN
src/conversations/res/mipmap-xxhdpi/new_launcher_round.webp
Normal file
After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 6.4 KiB |
BIN
src/conversations/res/mipmap-xxxhdpi/new_launcher.webp
Normal file
After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 13 KiB |
BIN
src/conversations/res/mipmap-xxxhdpi/new_launcher_round.webp
Normal file
After Width: | Height: | Size: 8.6 KiB |
|
@ -3,9 +3,9 @@
|
|||
<string name="pick_a_server">Выберите своего XMPP-провайдера</string>
|
||||
<string name="use_conversations.im">Использовать conversations.im</string>
|
||||
<string name="create_new_account">Создать новый аккаунт</string>
|
||||
<string name="do_you_have_an_account">У вас есть аккаунт XMPP\? Если вы использовали Conversations или другой XMPP-клиент в прошлом, то скорее всего, он у вас есть. Если у вас нет аккаунта, вы можете создать его прямо сейчас.
|
||||
<string name="do_you_have_an_account">У вас есть аккаунт XMPP\? Если вы использовали another.im или другой XMPP-клиент в прошлом, то скорее всего, он у вас есть. Если у вас нет аккаунта, вы можете создать его прямо сейчас.
|
||||
\nПодсказка: Некоторые провайдеры электронной почты также регистрируют аккаунты XMPP.</string>
|
||||
<string name="server_select_text">XMPP - это независимая сеть обмена сообщениями. Conversations позволяет вам подключиться к любому XMPP-серверу на ваш выбор.\nЕсли у вас нет сервера, предлагаем вам зарегистрировать аккаунт на conversations.im, сервере, специально предназначенном для работы с Conversations.</string>
|
||||
<string name="server_select_text">XMPP - это независимая сеть обмена сообщениями. another.im позволяет вам подключиться к любому XMPP-серверу на ваш выбор.\nЕсли у вас нет сервера, предлагаем вам зарегистрировать аккаунт на another.im, сервере, специально предназначенном для работы с another.im.</string>
|
||||
<string name="magic_create_text_on_x">Вас пригласили на %1$s. Мы проведём вас через процесс создания аккаунта.
|
||||
\nАккаунт на %1$s позволит вам общаться с пользователями и на этом, и на других серверах, используя ваш полный XMPP-адрес.</string>
|
||||
<string name="magic_create_text_fixed">Вас пригласили на %1$s. Вам уже назначили имя пользователя. Мы проведём вас через процесс создания аккаунта.
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
<string name="pick_a_server">Виберіть постачальника послуг обміну повідомленнями XMPP</string>
|
||||
<string name="use_conversations.im">Скористатися conversations.im</string>
|
||||
<string name="create_new_account">Створити новий обліковий запис</string>
|
||||
<string name="do_you_have_an_account">Уже маєте обліковий запис XMPP\? Можливо, користуєтеся іншою програмою XMPP або користувалися Conversations раніше. Якщо ні, можете створити новий обліковий запис XMPP просто зараз.
|
||||
<string name="do_you_have_an_account">Уже маєте обліковий запис XMPP\? Можливо, користуєтеся іншою програмою XMPP або користувалися another.im раніше. Якщо ні, можете створити новий обліковий запис XMPP просто зараз.
|
||||
\nЗверніть увагу, що деякі постачальники електронної пошти у той же час надають облікові записи XMPP.</string>
|
||||
<string name="server_select_text">XMPP — це мережа обміну повідомленнями, незалежна від постачальників. Можете використовувати цю програму з будь-яким XMPP-сервером, який оберете.
|
||||
\nПроте для зручності ми спростили створення облікового запису на conversations.im — у постачальника, спеціально налаштованого на роботу з Conversations.</string>
|
||||
\nПроте для зручності ми спростили створення облікового запису на another.im — у постачальника, спеціально налаштованого на роботу з another.im.</string>
|
||||
<string name="magic_create_text_on_x">Вас запросили до %1$s. Ми проведемо Вас крок за кроком, щоб створити обліковий запис.
|
||||
\nОбравши %1$s в якості свого постачальника, Ви зможете спілкуватися з користувачами інших постачальників, для цього повідомте їм свою повну адресу XMPP.</string>
|
||||
<string name="magic_create_text_fixed">Вас запросили до %1$s. Для Вас створено ім\'я користувача. Ми проведемо Вас крок за кроком, щоб створити обліковий запис.
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<string name="pick_a_server">Pick your XMPP provider</string>
|
||||
<string name="use_conversations.im">Use conversations.im</string>
|
||||
<string name="create_new_account">Create new account</string>
|
||||
<string name="do_you_have_an_account">Do you already have an XMPP account? This might be the case if you are already using a different XMPP client or have used Conversations before. If not you can create a new XMPP account right now.\nHint: Some email providers also provide XMPP accounts.</string>
|
||||
<string name="server_select_text">XMPP is a provider independent instant messaging network. You can use this client with what ever XMPP server you choose.\nHowever for your convenience we made it easy to create an account on conversations.im; a provider specially suited for the use with Conversations.</string>
|
||||
<string name="do_you_have_an_account">Do you already have an XMPP account? This might be the case if you are already using a different XMPP client or have used another.im before. If not you can create a new XMPP account right now.\nHint: Some email providers also provide XMPP accounts.</string>
|
||||
<string name="server_select_text">XMPP is a provider independent instant messaging network. You can use this client with what ever XMPP server you choose.\nHowever for your convenience we made it easy to create an account on another.im.</string>
|
||||
<string name="magic_create_text_on_x">You have been invited to %1$s. We will guide you through the process of creating an account.\nWhen picking %1$s as a provider you will be able to communicate with users of other providers by giving them your full XMPP address.</string>
|
||||
<string name="magic_create_text_fixed">You have been invited to %1$s. A username has already been picked for you. We will guide you through the process of creating an account.\nYou will be able to communicate with users of other providers by giving them your full XMPP address.</string>
|
||||
<string name="your_server_invitation">Your server invitation</string>
|
||||
|
|
|
@ -299,6 +299,11 @@
|
|||
<activity
|
||||
android:name=".ui.PublishGroupChatProfilePictureActivity"
|
||||
android:label="@string/group_chat_avatar" />
|
||||
<activity
|
||||
android:name=".ui.VerifyOTRActivity"
|
||||
android:label="@string/verify_otr"
|
||||
android:exported="false"
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.ShareWithActivity"
|
||||
android:exported="true"
|
||||
|
|
|
@ -15,9 +15,10 @@ import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
|||
public final class Config {
|
||||
private static final int UNENCRYPTED = 1;
|
||||
private static final int OPENPGP = 2;
|
||||
private static final int OTR = 4;
|
||||
private static final int OMEMO = 8;
|
||||
|
||||
private static final int ENCRYPTION_MASK = UNENCRYPTED | OPENPGP | OMEMO;
|
||||
private static final int ENCRYPTION_MASK = UNENCRYPTED | OPENPGP | OTR | OMEMO;
|
||||
|
||||
public static boolean supportUnencrypted() {
|
||||
return (ENCRYPTION_MASK & UNENCRYPTED) != 0;
|
||||
|
@ -31,6 +32,10 @@ public final class Config {
|
|||
return (ENCRYPTION_MASK & OMEMO) != 0;
|
||||
}
|
||||
|
||||
public static boolean supportOtr() {
|
||||
return (ENCRYPTION_MASK & OTR) != 0;
|
||||
}
|
||||
|
||||
public static boolean omemoOnly() {
|
||||
return !multipleEncryptionChoices() && supportOmemo();
|
||||
}
|
||||
|
|
312
src/main/java/eu/siacs/conversations/crypto/OtrService.java
Normal file
|
@ -0,0 +1,312 @@
|
|||
package eu.siacs.conversations.crypto;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import net.java.otr4j.OtrEngineHost;
|
||||
import net.java.otr4j.OtrException;
|
||||
import net.java.otr4j.OtrPolicy;
|
||||
import net.java.otr4j.OtrPolicyImpl;
|
||||
import net.java.otr4j.crypto.OtrCryptoEngineImpl;
|
||||
import net.java.otr4j.crypto.OtrCryptoException;
|
||||
import net.java.otr4j.session.FragmenterInstructions;
|
||||
import net.java.otr4j.session.InstanceTag;
|
||||
import net.java.otr4j.session.SessionID;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.DSAPrivateKeySpec;
|
||||
import java.security.spec.DSAPublicKeySpec;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.entities.Account;
|
||||
import eu.siacs.conversations.entities.Conversation;
|
||||
import eu.siacs.conversations.generator.MessageGenerator;
|
||||
import eu.siacs.conversations.services.XmppConnectionService;
|
||||
import eu.siacs.conversations.xmpp.Jid;
|
||||
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
||||
import eu.siacs.conversations.xmpp.jid.OtrJidHelper;
|
||||
import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
|
||||
|
||||
public class OtrService extends OtrCryptoEngineImpl implements OtrEngineHost {
|
||||
|
||||
private Account account;
|
||||
private OtrPolicy otrPolicy;
|
||||
private KeyPair keyPair;
|
||||
private XmppConnectionService mXmppConnectionService;
|
||||
|
||||
public OtrService(XmppConnectionService service, Account account) {
|
||||
this.account = account;
|
||||
this.otrPolicy = new OtrPolicyImpl();
|
||||
this.otrPolicy.setAllowV1(false);
|
||||
this.otrPolicy.setAllowV2(true);
|
||||
this.otrPolicy.setAllowV3(true);
|
||||
this.keyPair = loadKey(account.getKeys());
|
||||
this.mXmppConnectionService = service;
|
||||
}
|
||||
|
||||
private KeyPair loadKey(final JSONObject keys) {
|
||||
if (keys == null) {
|
||||
return null;
|
||||
}
|
||||
synchronized (keys) {
|
||||
try {
|
||||
BigInteger x = new BigInteger(keys.getString("otr_x"), 16);
|
||||
BigInteger y = new BigInteger(keys.getString("otr_y"), 16);
|
||||
BigInteger p = new BigInteger(keys.getString("otr_p"), 16);
|
||||
BigInteger q = new BigInteger(keys.getString("otr_q"), 16);
|
||||
BigInteger g = new BigInteger(keys.getString("otr_g"), 16);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("DSA");
|
||||
DSAPublicKeySpec pubKeySpec = new DSAPublicKeySpec(y, p, q, g);
|
||||
DSAPrivateKeySpec privateKeySpec = new DSAPrivateKeySpec(x, p, q, g);
|
||||
PublicKey publicKey = keyFactory.generatePublic(pubKeySpec);
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec);
|
||||
return new KeyPair(publicKey, privateKey);
|
||||
} catch (JSONException e) {
|
||||
return null;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
return null;
|
||||
} catch (InvalidKeySpecException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveKey() {
|
||||
PublicKey publicKey = keyPair.getPublic();
|
||||
PrivateKey privateKey = keyPair.getPrivate();
|
||||
KeyFactory keyFactory;
|
||||
try {
|
||||
keyFactory = KeyFactory.getInstance("DSA");
|
||||
DSAPrivateKeySpec privateKeySpec = keyFactory.getKeySpec(
|
||||
privateKey, DSAPrivateKeySpec.class);
|
||||
DSAPublicKeySpec publicKeySpec = keyFactory.getKeySpec(publicKey,
|
||||
DSAPublicKeySpec.class);
|
||||
this.account.setKey("otr_x", privateKeySpec.getX().toString(16));
|
||||
this.account.setKey("otr_g", privateKeySpec.getG().toString(16));
|
||||
this.account.setKey("otr_p", privateKeySpec.getP().toString(16));
|
||||
this.account.setKey("otr_q", privateKeySpec.getQ().toString(16));
|
||||
this.account.setKey("otr_y", publicKeySpec.getY().toString(16));
|
||||
} catch (final NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (final InvalidKeySpecException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void askForSecret(SessionID id, InstanceTag instanceTag, String question) {
|
||||
try {
|
||||
final Jid jid = OtrJidHelper.fromSessionID(id);
|
||||
Conversation conversation = this.mXmppConnectionService.find(this.account, jid, jid);
|
||||
if (conversation != null) {
|
||||
conversation.smp().hint = question;
|
||||
conversation.smp().status = Conversation.Smp.STATUS_CONTACT_REQUESTED;
|
||||
mXmppConnectionService.updateConversationUi();
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": smp in invalid session " + id.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishedSessionMessage(SessionID arg0, String arg1)
|
||||
throws OtrException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFallbackMessage(SessionID arg0) {
|
||||
return MessageGenerator.OTR_FALLBACK_MESSAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getLocalFingerprintRaw(SessionID arg0) {
|
||||
try {
|
||||
return getFingerprintRaw(getPublicKey());
|
||||
} catch (OtrCryptoException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public PublicKey getPublicKey() {
|
||||
if (this.keyPair == null) {
|
||||
return null;
|
||||
}
|
||||
return this.keyPair.getPublic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyPair getLocalKeyPair(SessionID arg0) throws OtrException {
|
||||
if (this.keyPair == null) {
|
||||
KeyPairGenerator kg;
|
||||
try {
|
||||
kg = KeyPairGenerator.getInstance("DSA");
|
||||
this.keyPair = kg.genKeyPair();
|
||||
this.saveKey();
|
||||
mXmppConnectionService.databaseBackend.updateAccount(account);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.d(Config.LOGTAG,
|
||||
"error generating key pair " + e.getMessage());
|
||||
}
|
||||
}
|
||||
return this.keyPair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReplyForUnreadableMessage(SessionID arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OtrPolicy getSessionPolicy(SessionID arg0) {
|
||||
return otrPolicy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectMessage(SessionID session, String body)
|
||||
throws OtrException {
|
||||
MessagePacket packet = new MessagePacket();
|
||||
packet.setFrom(account.getJid());
|
||||
if (session.getUserID().isEmpty()) {
|
||||
packet.setAttribute("to", session.getAccountID());
|
||||
} else {
|
||||
packet.setAttribute("to", session.getAccountID() + "/" + session.getUserID());
|
||||
}
|
||||
packet.setBody(body);
|
||||
MessageGenerator.addMessageHints(packet);
|
||||
try {
|
||||
Jid jid = OtrJidHelper.fromSessionID(session);
|
||||
Conversation conversation = mXmppConnectionService.find(account, jid, jid);
|
||||
if (conversation != null && conversation.setOutgoingChatState(Config.DEFAULT_CHAT_STATE)) {
|
||||
if (mXmppConnectionService.sendChatStates()) {
|
||||
packet.addChild(ChatState.toElement(conversation.getOutgoingChatState()));
|
||||
}
|
||||
}
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
|
||||
}
|
||||
|
||||
packet.setType(MessagePacket.TYPE_CHAT);
|
||||
packet.addChild("encryption", "urn:xmpp:eme:0").setAttribute("namespace", "urn:xmpp:otr:0");
|
||||
account.getXmppConnection().sendMessagePacket(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageFromAnotherInstanceReceived(SessionID session) {
|
||||
sendOtrErrorMessage(session, "Message from another OTR-instance received");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void multipleInstancesDetected(SessionID arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requireEncryptedMessage(SessionID arg0, String arg1)
|
||||
throws OtrException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(SessionID arg0, String arg1) throws OtrException {
|
||||
Log.d(Config.LOGTAG, "show error");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void smpAborted(SessionID id) throws OtrException {
|
||||
setSmpStatus(id, Conversation.Smp.STATUS_NONE);
|
||||
}
|
||||
|
||||
private void setSmpStatus(SessionID id, int status) {
|
||||
try {
|
||||
final Jid jid = OtrJidHelper.fromSessionID(id);
|
||||
Conversation conversation = this.mXmppConnectionService.find(this.account, jid, jid);
|
||||
if (conversation != null) {
|
||||
conversation.smp().status = status;
|
||||
mXmppConnectionService.updateConversationUi();
|
||||
}
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void smpError(SessionID id, int arg1, boolean arg2)
|
||||
throws OtrException {
|
||||
setSmpStatus(id, Conversation.Smp.STATUS_NONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unencryptedMessageReceived(SessionID arg0, String arg1)
|
||||
throws OtrException {
|
||||
throw new OtrException(new Exception("unencrypted message received"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unreadableMessageReceived(SessionID session) throws OtrException {
|
||||
Log.d(Config.LOGTAG, "unreadable message received");
|
||||
sendOtrErrorMessage(session, "You sent me an unreadable OTR-encrypted message");
|
||||
}
|
||||
|
||||
public void sendOtrErrorMessage(SessionID session, String errorText) {
|
||||
try {
|
||||
Jid jid = OtrJidHelper.fromSessionID(session);
|
||||
Conversation conversation = mXmppConnectionService.find(account, jid, jid);
|
||||
String id = conversation == null ? null : conversation.getLastReceivedOtrMessageId();
|
||||
if (id != null) {
|
||||
MessagePacket packet = mXmppConnectionService.getMessageGenerator()
|
||||
.generateOtrError(jid, id, errorText);
|
||||
packet.setFrom(account.getJid());
|
||||
mXmppConnectionService.sendMessagePacket(account, packet);
|
||||
Log.d(Config.LOGTAG, packet.toString());
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid().toString()
|
||||
+ ": unreadable OTR message in " + conversation.getName());
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unverify(SessionID id, String arg1) {
|
||||
setSmpStatus(id, Conversation.Smp.STATUS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verify(SessionID id, String fingerprint, boolean approved) {
|
||||
Log.d(Config.LOGTAG, "OtrService.verify(" + id.toString() + "," + fingerprint + "," + String.valueOf(approved) + ")");
|
||||
try {
|
||||
final Jid jid = OtrJidHelper.fromSessionID(id);
|
||||
Conversation conversation = this.mXmppConnectionService.find(this.account, jid, jid);
|
||||
if (conversation != null) {
|
||||
if (approved) {
|
||||
conversation.getContact().addOtrFingerprint(fingerprint);
|
||||
}
|
||||
conversation.smp().hint = null;
|
||||
conversation.smp().status = Conversation.Smp.STATUS_VERIFIED;
|
||||
mXmppConnectionService.updateConversationUi();
|
||||
mXmppConnectionService.syncRosterToDisk(conversation.getAccount());
|
||||
}
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FragmenterInstructions getFragmenterInstructions(SessionID sessionID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -8,20 +8,27 @@ import android.util.Log;
|
|||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.java.otr4j.crypto.OtrCryptoEngineImpl;
|
||||
import net.java.otr4j.crypto.OtrCryptoException;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.security.PublicKey;
|
||||
import java.security.interfaces.DSAPublicKey;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.crypto.OtrService;
|
||||
import eu.siacs.conversations.crypto.PgpDecryptionService;
|
||||
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
||||
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
|
||||
|
@ -93,6 +100,7 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
|
|||
protected String avatar;
|
||||
protected String hostname = null;
|
||||
protected int port = 5222;
|
||||
private OtrService mOtrService = null;
|
||||
protected boolean online = false;
|
||||
private String rosterVersion;
|
||||
private String displayName = null;
|
||||
|
@ -100,6 +108,7 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
|
|||
private PgpDecryptionService pgpDecryptionService = null;
|
||||
private XmppConnection xmppConnection = null;
|
||||
private long mEndGracePeriod = 0L;
|
||||
private String otrFingerprint;
|
||||
private final Map<Jid, Bookmark> bookmarks = new HashMap<>();
|
||||
private Presence.Status presenceStatus;
|
||||
private String presenceStatusMessage;
|
||||
|
@ -535,6 +544,7 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
|
|||
}
|
||||
|
||||
public void initAccountServices(final XmppConnectionService context) {
|
||||
this.mOtrService = new OtrService(context, this);
|
||||
this.axolotlService = new AxolotlService(this, context);
|
||||
this.pgpDecryptionService = new PgpDecryptionService(context);
|
||||
if (xmppConnection != null) {
|
||||
|
@ -542,6 +552,10 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
|
|||
}
|
||||
}
|
||||
|
||||
public OtrService getOtrService() {
|
||||
return this.mOtrService;
|
||||
}
|
||||
|
||||
public PgpDecryptionService getPgpDecryptionService() {
|
||||
return this.pgpDecryptionService;
|
||||
}
|
||||
|
@ -554,6 +568,27 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
|
|||
this.xmppConnection = connection;
|
||||
}
|
||||
|
||||
public String getOtrFingerprint() {
|
||||
if (this.otrFingerprint == null) {
|
||||
try {
|
||||
if (this.mOtrService == null) {
|
||||
return null;
|
||||
}
|
||||
final PublicKey publicKey = this.mOtrService.getPublicKey();
|
||||
if (publicKey == null || !(publicKey instanceof DSAPublicKey)) {
|
||||
return null;
|
||||
}
|
||||
this.otrFingerprint = new OtrCryptoEngineImpl().getFingerprint(publicKey).toLowerCase(Locale.US);
|
||||
return this.otrFingerprint;
|
||||
} catch (final OtrCryptoException ignored) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return this.otrFingerprint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getRosterVersion() {
|
||||
if (this.rosterVersion == null) {
|
||||
return "";
|
||||
|
@ -721,6 +756,10 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
|
|||
|
||||
private List<XmppUri.Fingerprint> getFingerprints() {
|
||||
ArrayList<XmppUri.Fingerprint> fingerprints = new ArrayList<>();
|
||||
final String otr = this.getOtrFingerprint();
|
||||
if (otr != null) {
|
||||
fingerprints.add(new XmppUri.Fingerprint(XmppUri.FingerprintType.OTR, otr));
|
||||
}
|
||||
if (axolotlService == null) {
|
||||
return fingerprints;
|
||||
}
|
||||
|
|
|
@ -348,6 +348,47 @@ public class Contact implements ListItem, Blockable {
|
|||
return groups;
|
||||
}
|
||||
|
||||
public ArrayList<String> getOtrFingerprints() {
|
||||
synchronized (this.keys) {
|
||||
final ArrayList<String> fingerprints = new ArrayList<String>();
|
||||
try {
|
||||
if (this.keys.has("otr_fingerprints")) {
|
||||
final JSONArray prints = this.keys.getJSONArray("otr_fingerprints");
|
||||
for (int i = 0; i < prints.length(); ++i) {
|
||||
final String print = prints.isNull(i) ? null : prints.getString(i);
|
||||
if (print != null && !print.isEmpty()) {
|
||||
fingerprints.add(prints.getString(i).toLowerCase(Locale.US));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final JSONException ignored) {
|
||||
|
||||
}
|
||||
return fingerprints;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addOtrFingerprint(String print) {
|
||||
synchronized (this.keys) {
|
||||
if (getOtrFingerprints().contains(print)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
JSONArray fingerprints;
|
||||
if (!this.keys.has("otr_fingerprints")) {
|
||||
fingerprints = new JSONArray();
|
||||
} else {
|
||||
fingerprints = this.keys.getJSONArray("otr_fingerprints");
|
||||
}
|
||||
fingerprints.put(print);
|
||||
this.keys.put("otr_fingerprints", fingerprints);
|
||||
return true;
|
||||
} catch (final JSONException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long getPgpKeyId() {
|
||||
synchronized (this.keys) {
|
||||
if (this.keys.has("pgp_keyid")) {
|
||||
|
|
|
@ -71,6 +71,7 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.security.interfaces.DSAPublicKey;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
@ -81,6 +82,7 @@ import java.util.Collections;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
|
@ -132,6 +134,12 @@ import me.saket.bettermovementmethod.BetterLinkMovementMethod;
|
|||
|
||||
import static eu.siacs.conversations.entities.Bookmark.printableValue;
|
||||
|
||||
import net.java.otr4j.OtrException;
|
||||
import net.java.otr4j.crypto.OtrCryptoException;
|
||||
import net.java.otr4j.session.SessionID;
|
||||
import net.java.otr4j.session.SessionImpl;
|
||||
import net.java.otr4j.session.SessionStatus;
|
||||
|
||||
|
||||
public class Conversation extends AbstractEntity implements Blockable, Comparable<Conversation>, Conversational, AvatarService.Avatarable {
|
||||
public static final String TABLENAME = "conversations";
|
||||
|
@ -180,10 +188,16 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
private int mode;
|
||||
private JSONObject attributes;
|
||||
private Jid nextCounterpart;
|
||||
private boolean hasPermanentCounterpart;
|
||||
private transient SessionImpl otrSession;
|
||||
private transient String otrFingerprint = null;
|
||||
private Smp mSmp = new Smp();
|
||||
private transient MucOptions mucOptions = null;
|
||||
private byte[] symmetricKey;
|
||||
private boolean messagesLeftOnServer = true;
|
||||
private ChatState mOutgoingChatState = Config.DEFAULT_CHAT_STATE;
|
||||
private ChatState mIncomingChatState = Config.DEFAULT_CHAT_STATE;
|
||||
private String mLastReceivedOtrMessageId = null;
|
||||
private String mFirstMamReference = null;
|
||||
protected Message replyTo = null;
|
||||
protected int mCurrentTab = -1;
|
||||
|
@ -216,6 +230,9 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
this.attributes = new JSONObject();
|
||||
}
|
||||
this.nextCounterpart = nextCounterpart;
|
||||
if (nextCounterpart != null) {
|
||||
hasPermanentCounterpart = true;
|
||||
}
|
||||
}
|
||||
|
||||
public String getContactUuid() {
|
||||
|
@ -490,6 +507,17 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
}
|
||||
}
|
||||
|
||||
public void findUnsentMessagesWithEncryption(int encryptionType, OnMessageFound onMessageFound) {
|
||||
synchronized (this.messages) {
|
||||
for (Message message : this.messages) {
|
||||
if ((message.getStatus() == Message.STATUS_UNSEND || message.getStatus() == Message.STATUS_WAITING)
|
||||
&& (message.getEncryption() == encryptionType)) {
|
||||
onMessageFound.onMessageFound(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void findUnsentTextMessages(OnMessageFound onMessageFound) {
|
||||
final ArrayList<Message> results = new ArrayList<>();
|
||||
synchronized (this.messages) {
|
||||
|
@ -662,6 +690,14 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
return getContact().getBlockedJid();
|
||||
}
|
||||
|
||||
public String getLastReceivedOtrMessageId() {
|
||||
return this.mLastReceivedOtrMessageId;
|
||||
}
|
||||
|
||||
public void setLastReceivedOtrMessageId(String id) {
|
||||
this.mLastReceivedOtrMessageId = id;
|
||||
}
|
||||
|
||||
public int countMessages() {
|
||||
synchronized (this.messages) {
|
||||
return this.messages.size();
|
||||
|
@ -905,7 +941,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
values.put(STATUS, status);
|
||||
values.put(MODE, mode);
|
||||
|
||||
if (nextCounterpart != null) {
|
||||
if (nextCounterpart != null && hasPermanentCounterpart) {
|
||||
values.put(NEXT_COUNTERPART, nextCounterpart.toString());
|
||||
}
|
||||
|
||||
|
@ -923,6 +959,124 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
this.mode = mode;
|
||||
}
|
||||
|
||||
public SessionImpl startOtrSession(String presence, boolean sendStart) {
|
||||
if (this.otrSession != null) {
|
||||
return this.otrSession;
|
||||
} else {
|
||||
final SessionID sessionId = new SessionID(this.getJid().asBareJid().toString(),
|
||||
presence,
|
||||
"xmpp");
|
||||
this.otrSession = new SessionImpl(sessionId, getAccount().getOtrService());
|
||||
try {
|
||||
if (sendStart) {
|
||||
this.otrSession.startSession();
|
||||
return this.otrSession;
|
||||
}
|
||||
return this.otrSession;
|
||||
} catch (OtrException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public SessionImpl getOtrSession() {
|
||||
return this.otrSession;
|
||||
}
|
||||
|
||||
public void resetOtrSession() {
|
||||
this.otrFingerprint = null;
|
||||
this.otrSession = null;
|
||||
this.mSmp.hint = null;
|
||||
this.mSmp.secret = null;
|
||||
this.mSmp.status = Smp.STATUS_NONE;
|
||||
}
|
||||
|
||||
public Smp smp() {
|
||||
return mSmp;
|
||||
}
|
||||
|
||||
public boolean startOtrIfNeeded() {
|
||||
if (this.otrSession != null && this.otrSession.getSessionStatus() != SessionStatus.ENCRYPTED) {
|
||||
try {
|
||||
this.otrSession.startSession();
|
||||
return true;
|
||||
} catch (OtrException e) {
|
||||
this.resetOtrSession();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean endOtrIfNeeded() {
|
||||
if (this.otrSession != null) {
|
||||
if (this.otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
|
||||
try {
|
||||
this.otrSession.endSession();
|
||||
this.resetOtrSession();
|
||||
return true;
|
||||
} catch (OtrException e) {
|
||||
this.resetOtrSession();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
this.resetOtrSession();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasValidOtrSession() {
|
||||
return this.otrSession != null;
|
||||
}
|
||||
|
||||
public synchronized String getOtrFingerprint() {
|
||||
if (this.otrFingerprint == null) {
|
||||
try {
|
||||
if (getOtrSession() == null || getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
|
||||
return null;
|
||||
}
|
||||
DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession().getRemotePublicKey();
|
||||
this.otrFingerprint = getAccount().getOtrService().getFingerprint(remotePubKey).toLowerCase(Locale.US);
|
||||
} catch (final OtrCryptoException ignored) {
|
||||
return null;
|
||||
} catch (final UnsupportedOperationException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return this.otrFingerprint;
|
||||
}
|
||||
|
||||
public boolean verifyOtrFingerprint() {
|
||||
final String fingerprint = getOtrFingerprint();
|
||||
if (fingerprint != null) {
|
||||
getContact().addOtrFingerprint(fingerprint);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOtrFingerprintVerified() {
|
||||
return getContact().getOtrFingerprints().contains(getOtrFingerprint());
|
||||
}
|
||||
|
||||
public class Smp {
|
||||
public static final int STATUS_NONE = 0;
|
||||
public static final int STATUS_CONTACT_REQUESTED = 1;
|
||||
public static final int STATUS_WE_REQUESTED = 2;
|
||||
public static final int STATUS_FAILED = 3;
|
||||
public static final int STATUS_VERIFIED = 4;
|
||||
|
||||
public String secret = null;
|
||||
public String hint = null;
|
||||
public int status = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* short for is Private and Non-anonymous
|
||||
*/
|
||||
|
@ -959,14 +1113,23 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
return this.nextCounterpart;
|
||||
}
|
||||
|
||||
public boolean hasPermanentCounterpart() {
|
||||
return hasPermanentCounterpart;
|
||||
}
|
||||
|
||||
public void setNextCounterpart(Jid jid) {
|
||||
this.nextCounterpart = jid;
|
||||
}
|
||||
|
||||
public int getNextEncryption() {
|
||||
if (!Config.supportOmemo() && !Config.supportOpenPgp()) {
|
||||
if (!Config.supportOmemo() && !Config.supportOpenPgp() && !Config.supportOtr()) {
|
||||
return Message.ENCRYPTION_NONE;
|
||||
}
|
||||
|
||||
if (Config.supportOtr() && nextCounterpart != null && getMode() == MODE_SINGLE && hasPermanentCounterpart) {
|
||||
return Message.ENCRYPTION_OTR;
|
||||
}
|
||||
|
||||
if (OmemoSetting.isAlways()) {
|
||||
return suitableForOmemoByDefault(this) ? Message.ENCRYPTION_AXOLOTL : Message.ENCRYPTION_NONE;
|
||||
}
|
||||
|
@ -977,7 +1140,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
defaultEncryption = Message.ENCRYPTION_NONE;
|
||||
}
|
||||
int encryption = this.getIntAttribute(ATTRIBUTE_NEXT_ENCRYPTION, defaultEncryption);
|
||||
if (encryption == Message.ENCRYPTION_OTR || encryption < 0) {
|
||||
if (encryption < 0) {
|
||||
return defaultEncryption;
|
||||
} else {
|
||||
return encryption;
|
||||
|
@ -993,6 +1156,10 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
return nextMessage == null ? "" : nextMessage;
|
||||
}
|
||||
|
||||
public boolean smpRequested() {
|
||||
return smp().status == Smp.STATUS_CONTACT_REQUESTED;
|
||||
}
|
||||
|
||||
public @Nullable
|
||||
Draft getDraft() {
|
||||
long timestamp = getLongAttribute(ATTRIBUTE_NEXT_MESSAGE_TIMESTAMP, 0);
|
||||
|
@ -1015,6 +1182,14 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
return changed;
|
||||
}
|
||||
|
||||
public void setSymmetricKey(byte[] key) {
|
||||
this.symmetricKey = key;
|
||||
}
|
||||
|
||||
public byte[] getSymmetricKey() {
|
||||
return this.symmetricKey;
|
||||
}
|
||||
|
||||
public Bookmark getBookmark() {
|
||||
return this.account.getBookmark(this.contactJid);
|
||||
}
|
||||
|
@ -1231,14 +1406,14 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
String res2 = nextCounterpart == null ? null : nextCounterpart.getResource();
|
||||
|
||||
if (nextCounterpart == null) {
|
||||
if (!message.isPrivateMessage()) {
|
||||
if (!message.isPrivateMessage() && message.encryption != Message.ENCRYPTION_OTR) {
|
||||
synchronized (this.messages) {
|
||||
this.messages.add(message);
|
||||
actualizeReplyMessages(this.messages, List.of(message));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (message.isPrivateMessage() && Objects.equals(res1, res2)) {
|
||||
if ((message.isPrivateMessage() || message.encryption == Message.ENCRYPTION_OTR) && Objects.equals(res1, res2)) {
|
||||
synchronized (this.messages) {
|
||||
this.messages.add(message);
|
||||
actualizeReplyMessages(this.messages, List.of(message));
|
||||
|
@ -1260,14 +1435,14 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
}
|
||||
|
||||
if (nextCounterpart == null) {
|
||||
if (!message.isPrivateMessage()) {
|
||||
if (!message.isPrivateMessage() && message.encryption != Message.ENCRYPTION_OTR) {
|
||||
synchronized (this.messages) {
|
||||
properListToAdd.add(Math.min(offset, properListToAdd.size()), message);
|
||||
actualizeReplyMessages(properListToAdd, List.of(message));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (message.isPrivateMessage() && Objects.equals(res1, res2)) {
|
||||
if ((message.isPrivateMessage() || message.encryption == Message.ENCRYPTION_OTR) && Objects.equals(res1, res2)) {
|
||||
synchronized (this.messages) {
|
||||
properListToAdd.add(Math.min(offset, properListToAdd.size()), message);
|
||||
actualizeReplyMessages(properListToAdd, List.of(message));
|
||||
|
@ -1291,7 +1466,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
|
||||
if (nextCounterpart == null) {
|
||||
for(Message m : messages) {
|
||||
if (!m.isPrivateMessage()) {
|
||||
if (!m.isPrivateMessage() && m.encryption != Message.ENCRYPTION_OTR) {
|
||||
newM.add(m);
|
||||
}
|
||||
}
|
||||
|
@ -1302,7 +1477,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
String res2 = nextCounterpart == null ? null : nextCounterpart.getResource();
|
||||
|
||||
|
||||
if (m.isPrivateMessage() && Objects.equals(res1, res2)) {
|
||||
if ((m.isPrivateMessage() || m.encryption == Message.ENCRYPTION_OTR) && Objects.equals(res1, res2)) {
|
||||
newM.add(m);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,7 +352,10 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
|
|||
}
|
||||
|
||||
public String replyId() {
|
||||
return conversation.getMode() == Conversation.MODE_MULTI || getRemoteMsgId() == null ? getServerMsgId() : getRemoteMsgId();
|
||||
if (conversation.getMode() == Conversation.MODE_MULTI) return getServerMsgId();
|
||||
final String remote = getRemoteMsgId();
|
||||
if (remote == null && getStatus() > STATUS_RECEIVED) return getUuid();
|
||||
return remote;
|
||||
}
|
||||
|
||||
public Message reply() {
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
public interface Transferable {
|
||||
|
||||
List<String> VALID_IMAGE_EXTENSIONS = Arrays.asList("webp", "jpeg", "jpg", "png", "jpe");
|
||||
List<String> VALID_CRYPTO_EXTENSIONS = Arrays.asList("pgp", "gpg");
|
||||
List<String> VALID_CRYPTO_EXTENSIONS = Arrays.asList("pgp", "gpg", "otr");
|
||||
|
||||
int STATUS_UNKNOWN = 0x200;
|
||||
int STATUS_CHECKING = 0x201;
|
||||
|
|
|
@ -57,6 +57,9 @@ public abstract class AbstractGenerator {
|
|||
private final String[] PRIVACY_SENSITIVE = {
|
||||
"urn:xmpp:time" //XEP-0202: Entity Time leaks time zone
|
||||
};
|
||||
private final String[] OTR = {
|
||||
"urn:xmpp:otr:0"
|
||||
};
|
||||
private final String[] VOIP_NAMESPACES = {
|
||||
Namespace.JINGLE_TRANSPORT_ICE_UDP,
|
||||
Namespace.JINGLE_FEATURE_AUDIO,
|
||||
|
@ -125,6 +128,9 @@ public abstract class AbstractGenerator {
|
|||
features.addAll(Arrays.asList(PRIVACY_SENSITIVE));
|
||||
features.addAll(Arrays.asList(VOIP_NAMESPACES));
|
||||
}
|
||||
if (Config.supportOtr()) {
|
||||
features.addAll(Arrays.asList(OTR));
|
||||
}
|
||||
if (mXmppConnectionService.broadcastLastActivity()) {
|
||||
features.add(Namespace.IDLE);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package eu.siacs.conversations.generator;
|
||||
|
||||
import net.java.otr4j.OtrException;
|
||||
import net.java.otr4j.session.Session;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
@ -24,6 +27,7 @@ import eu.siacs.conversations.xmpp.jingle.Media;
|
|||
import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
|
||||
|
||||
public class MessageGenerator extends AbstractGenerator {
|
||||
public static final String OTR_FALLBACK_MESSAGE = "I would like to start a private (OTR encrypted) conversation but your client doesn’t seem to support that";
|
||||
private static final String OMEMO_FALLBACK_MESSAGE = "I sent you an OMEMO encrypted message but your client doesn’t seem to support that. Find more information on https://conversations.im/omemo";
|
||||
private static final String PGP_FALLBACK_MESSAGE = "I sent you a PGP encrypted message but your client doesn’t seem to support that.";
|
||||
|
||||
|
@ -102,6 +106,36 @@ public class MessageGenerator extends AbstractGenerator {
|
|||
return packet;
|
||||
}
|
||||
|
||||
public static void addMessageHints(MessagePacket packet) {
|
||||
packet.addChild("private", "urn:xmpp:carbons:2");
|
||||
packet.addChild("no-copy", "urn:xmpp:hints");
|
||||
packet.addChild("no-permanent-store", "urn:xmpp:hints");
|
||||
packet.addChild("no-permanent-storage", "urn:xmpp:hints"); //do not copy this. this is wrong. it is *store*
|
||||
}
|
||||
|
||||
public MessagePacket generateOtrChat(Message message) {
|
||||
Conversation conversation = (Conversation) message.getConversation();
|
||||
Session otrSession = conversation.getOtrSession();
|
||||
if (otrSession == null) {
|
||||
return null;
|
||||
}
|
||||
MessagePacket packet = preparePacket(message);
|
||||
addMessageHints(packet);
|
||||
try {
|
||||
String content;
|
||||
if (message.hasFileOnRemoteHost()) {
|
||||
content = message.getFileParams().url.toString();
|
||||
} else {
|
||||
content = message.getBody();
|
||||
}
|
||||
packet.setBody(otrSession.transformSending(content)[0]);
|
||||
packet.addChild("encryption", "urn:xmpp:eme:0").setAttribute("namespace", "urn:xmpp:otr:0");
|
||||
return packet;
|
||||
} catch (OtrException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public MessagePacket generateChat(Message message) {
|
||||
MessagePacket packet = preparePacket(message);
|
||||
String content;
|
||||
|
@ -233,6 +267,19 @@ public class MessageGenerator extends AbstractGenerator {
|
|||
return packet;
|
||||
}
|
||||
|
||||
public MessagePacket generateOtrError(Jid to, String id, String errorText) {
|
||||
MessagePacket packet = new MessagePacket();
|
||||
packet.setType(MessagePacket.TYPE_ERROR);
|
||||
packet.setAttribute("id", id);
|
||||
packet.setTo(to);
|
||||
Element error = packet.addChild("error");
|
||||
error.setAttribute("code", "406");
|
||||
error.setAttribute("type", "modify");
|
||||
error.addChild("not-acceptable", "urn:ietf:params:xml:ns:xmpp-stanzas");
|
||||
error.addChild("text").setContent("?OTR Error:" + errorText);
|
||||
return packet;
|
||||
}
|
||||
|
||||
public MessagePacket sessionProposal(final JingleConnectionManager.RtpSessionProposal proposal) {
|
||||
final MessagePacket packet = new MessagePacket();
|
||||
packet.setType(MessagePacket.TYPE_CHAT); //we want to carbon copy those
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
package eu.siacs.conversations.parser;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import net.java.otr4j.session.Session;
|
||||
import net.java.otr4j.session.SessionStatus;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -16,6 +23,7 @@ import java.util.UUID;
|
|||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.crypto.OtrService;
|
||||
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
||||
import eu.siacs.conversations.crypto.axolotl.BrokenSessionException;
|
||||
import eu.siacs.conversations.crypto.axolotl.NotEncryptedForThisDeviceException;
|
||||
|
@ -28,9 +36,11 @@ import eu.siacs.conversations.entities.Conversation;
|
|||
import eu.siacs.conversations.entities.Conversational;
|
||||
import eu.siacs.conversations.entities.Message;
|
||||
import eu.siacs.conversations.entities.MucOptions;
|
||||
import eu.siacs.conversations.entities.Presence;
|
||||
import eu.siacs.conversations.entities.ReadByMarker;
|
||||
import eu.siacs.conversations.entities.ReceiptRequest;
|
||||
import eu.siacs.conversations.entities.RtpSessionStatus;
|
||||
import eu.siacs.conversations.entities.ServiceDiscoveryResult;
|
||||
import eu.siacs.conversations.http.HttpConnectionManager;
|
||||
import eu.siacs.conversations.services.MessageArchiveService;
|
||||
import eu.siacs.conversations.services.QuickConversationsService;
|
||||
|
@ -49,6 +59,7 @@ import eu.siacs.conversations.xmpp.pep.Avatar;
|
|||
import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
|
||||
|
||||
public class MessageParser extends AbstractParser implements OnMessagePacketReceived {
|
||||
private static final List<String> CLIENTS_SENDING_HTML_IN_OTR = Arrays.asList("Pidgin", "Adium", "Trillian");
|
||||
|
||||
private static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss", Locale.ENGLISH);
|
||||
|
||||
|
@ -95,6 +106,30 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
return result != null ? result : fallback;
|
||||
}
|
||||
|
||||
private static boolean clientMightSendHtml(Account account, Jid from) {
|
||||
String resource = from.getResource();
|
||||
if (resource == null) {
|
||||
return false;
|
||||
}
|
||||
Presence presence = account.getRoster().getContact(from).getPresences().getPresencesMap().get(resource);
|
||||
ServiceDiscoveryResult disco = presence == null ? null : presence.getServiceDiscoveryResult();
|
||||
if (disco == null) {
|
||||
return false;
|
||||
}
|
||||
return hasIdentityKnowForSendingHtml(disco.getIdentities());
|
||||
}
|
||||
|
||||
private static boolean hasIdentityKnowForSendingHtml(List<ServiceDiscoveryResult.Identity> identities) {
|
||||
for (ServiceDiscoveryResult.Identity identity : identities) {
|
||||
if (identity.getName() != null) {
|
||||
if (CLIENTS_SENDING_HTML_IN_OTR.contains(identity.getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean extractChatState(Conversation c, final boolean isTypeGroupChat, final MessagePacket packet) {
|
||||
ChatState state = ChatState.parse(packet);
|
||||
if (state != null && c != null) {
|
||||
|
@ -126,6 +161,70 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
return false;
|
||||
}
|
||||
|
||||
private Message parseOtrChat(String body, Jid from, String id, Conversation conversation) {
|
||||
String presence;
|
||||
if (from.isBareJid()) {
|
||||
presence = "";
|
||||
} else {
|
||||
presence = from.getResource();
|
||||
}
|
||||
if (body.matches("^\\?OTRv\\d{1,2}\\?.*")) {
|
||||
conversation.endOtrIfNeeded();
|
||||
}
|
||||
if (!conversation.hasValidOtrSession()) {
|
||||
conversation.startOtrSession(presence, false);
|
||||
} else {
|
||||
String foreignPresence = conversation.getOtrSession().getSessionID().getUserID();
|
||||
if (!foreignPresence.equals(presence)) {
|
||||
conversation.endOtrIfNeeded();
|
||||
conversation.startOtrSession(presence, false);
|
||||
}
|
||||
}
|
||||
try {
|
||||
conversation.setLastReceivedOtrMessageId(id);
|
||||
Session otrSession = conversation.getOtrSession();
|
||||
body = otrSession.transformReceiving(body);
|
||||
SessionStatus status = otrSession.getSessionStatus();
|
||||
if (body == null && status == SessionStatus.ENCRYPTED) {
|
||||
mXmppConnectionService.onOtrSessionEstablished(conversation);
|
||||
return null;
|
||||
} else if (body == null && status == SessionStatus.FINISHED) {
|
||||
conversation.resetOtrSession();
|
||||
mXmppConnectionService.updateConversationUi();
|
||||
return null;
|
||||
} else if (body == null || (body.isEmpty())) {
|
||||
return null;
|
||||
}
|
||||
if (body.startsWith(CryptoHelper.FILETRANSFER)) {
|
||||
String key = body.substring(CryptoHelper.FILETRANSFER.length());
|
||||
conversation.setSymmetricKey(CryptoHelper.hexToBytes(key));
|
||||
return null;
|
||||
}
|
||||
if (clientMightSendHtml(conversation.getAccount(), from)) {
|
||||
Log.d(Config.LOGTAG, conversation.getAccount().getJid().asBareJid() + ": received OTR message from bad behaving client. escaping HTML…");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
body = Html.fromHtml(body, Html.FROM_HTML_MODE_LEGACY).toString();
|
||||
} else {
|
||||
body = Html.fromHtml(body).toString();
|
||||
}
|
||||
}
|
||||
|
||||
final OtrService otrService = conversation.getAccount().getOtrService();
|
||||
Message finishedMessage = new Message(conversation, body, Message.ENCRYPTION_OTR, Message.STATUS_RECEIVED);
|
||||
finishedMessage.setFingerprint(otrService.getFingerprint(otrSession.getRemotePublicKey()));
|
||||
conversation.setLastReceivedOtrMessageId(null);
|
||||
|
||||
if (body.startsWith("?OTR")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return finishedMessage;
|
||||
} catch (Exception e) {
|
||||
conversation.resetOtrSession();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Message parseAxolotlChat(Element axolotlMessage, Jid from, Conversation conversation, int status, final boolean checkedForDuplicates, boolean postpone) {
|
||||
final AxolotlService service = conversation.getAccount().getAxolotlService();
|
||||
final XmppAxolotlMessage xmppAxolotlMessage;
|
||||
|
@ -327,6 +426,11 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
final Jid from = packet.getFrom();
|
||||
final String id = packet.getId();
|
||||
if (from != null && id != null) {
|
||||
final Message message = mXmppConnectionService.markMessage(account,
|
||||
from.asBareJid(),
|
||||
packet.getId(),
|
||||
Message.STATUS_SEND_FAILED,
|
||||
extractErrorMessage(packet));
|
||||
if (id.startsWith(JingleRtpConnection.JINGLE_MESSAGE_PROPOSE_ID_PREFIX)) {
|
||||
final String sessionId = id.substring(JingleRtpConnection.JINGLE_MESSAGE_PROPOSE_ID_PREFIX.length());
|
||||
mXmppConnectionService.getJingleConnectionManager()
|
||||
|
@ -335,8 +439,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
}
|
||||
if (id.startsWith(JingleRtpConnection.JINGLE_MESSAGE_PROCEED_ID_PREFIX)) {
|
||||
final String sessionId = id.substring(JingleRtpConnection.JINGLE_MESSAGE_PROCEED_ID_PREFIX.length());
|
||||
final String message = extractErrorMessage(packet);
|
||||
mXmppConnectionService.getJingleConnectionManager().failProceed(account, from, sessionId, message);
|
||||
final String errorMessage = extractErrorMessage(packet);
|
||||
mXmppConnectionService.getJingleConnectionManager().failProceed(account, from, sessionId, errorMessage);
|
||||
return true;
|
||||
}
|
||||
mXmppConnectionService.markMessage(account,
|
||||
|
@ -355,6 +459,13 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (message != null) {
|
||||
if (message.getEncryption() == Message.ENCRYPTION_OTR) {
|
||||
Conversation conversation = (Conversation) message.getConversation();
|
||||
conversation.endOtrIfNeeded();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -368,6 +479,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
}
|
||||
final MessagePacket packet;
|
||||
Long timestamp = null;
|
||||
final boolean isForwarded;
|
||||
boolean isCarbon = false;
|
||||
String serverMsgId = null;
|
||||
final Element fin = original.findChild("fin", MessageArchiveService.Version.MAM_0.namespace);
|
||||
|
@ -385,7 +497,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
}
|
||||
timestamp = f.second;
|
||||
packet = f.first;
|
||||
isForwarded = true;
|
||||
serverMsgId = result.getAttribute("id");
|
||||
|
||||
query.incrementMessageCount();
|
||||
if (handleErrorMessage(account, packet)) {
|
||||
return;
|
||||
|
@ -403,8 +517,10 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
}
|
||||
timestamp = f != null ? f.second : null;
|
||||
isCarbon = f != null;
|
||||
isForwarded = isCarbon;
|
||||
} else {
|
||||
packet = original;
|
||||
isForwarded = false;
|
||||
}
|
||||
|
||||
if (timestamp == null) {
|
||||
|
@ -449,6 +565,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
Log.e(Config.LOGTAG, account.getJid().asBareJid() + ": received groupchat (" + from + ") message on regular MAM request. skipping");
|
||||
return;
|
||||
}
|
||||
boolean isProperlyAddressed = (to != null) && (!to.isBareJid() || account.countPresences() == 0);
|
||||
boolean isMucStatusMessage = InvalidJid.hasValidFrom(packet) && from.isBareJid() && mucUserElement != null && mucUserElement.hasChild("status");
|
||||
boolean selfAddressed;
|
||||
if (packet.fromAccount(account)) {
|
||||
|
@ -483,7 +600,10 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
|
||||
final boolean conversationIsProbablyMuc = isTypeGroupChat || mucUserElement != null || account.getXmppConnection().getMucServersWithholdAccount().contains(counterpart.getDomain().toEscapedString());
|
||||
|
||||
if (conversationIsProbablyMuc && !isTypeGroupChat) {
|
||||
final boolean isOTR = body != null && body.content.startsWith("?OTR") && Config.supportOtr();
|
||||
final boolean correctOTR = !isForwarded && !isTypeGroupChat && isProperlyAddressed;
|
||||
|
||||
if ((conversationIsProbablyMuc && !isTypeGroupChat) || (!Strings.isNullOrEmpty(counterpart.getResource()) && isOTR && correctOTR)) {
|
||||
nextCounterpart = counterpart;
|
||||
}
|
||||
|
||||
|
@ -508,10 +628,6 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
}
|
||||
}
|
||||
|
||||
if (nextCounterpart != null && mXmppConnectionService.checkIsArchived(account, counterpart.asBareJid(), nextCounterpart)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((body != null || pgpEncrypted != null || (axolotlEncrypted != null && axolotlEncrypted.hasChild("payload")) || oobUrl != null) && !isMucStatusMessage) {
|
||||
final Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.asBareJid(), null, conversationIsProbablyMuc, nextCounterpart != null, false, nextCounterpart);
|
||||
final boolean conversationMultiMode = conversation.getMode() == Conversation.MODE_MULTI;
|
||||
|
@ -551,7 +667,17 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
}
|
||||
}
|
||||
final Message message;
|
||||
if (pgpEncrypted != null && Config.supportOpenPgp()) {
|
||||
if (isOTR) {
|
||||
if (correctOTR && !conversationMultiMode) {
|
||||
message = parseOtrChat(body.content, from, remoteMsgId, conversation);
|
||||
if (message == null) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignoring OTR message from " + from + " isForwarded=" + Boolean.toString(isForwarded) + ", isProperlyAddressed=" + Boolean.valueOf(isProperlyAddressed));
|
||||
return;
|
||||
}
|
||||
} else if (pgpEncrypted != null && Config.supportOpenPgp()) {
|
||||
message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status);
|
||||
} else if (axolotlEncrypted != null && Config.supportOmemo()) {
|
||||
Jid origin;
|
||||
|
@ -800,6 +926,13 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
processMessageReceipts(account, packet, remoteMsgId, query);
|
||||
}
|
||||
|
||||
if (message.getStatus() == Message.STATUS_RECEIVED
|
||||
&& conversation.getOtrSession() != null
|
||||
&& !conversation.getOtrSession().getSessionID().getUserID()
|
||||
.equals(message.getCounterpart().getResource())) {
|
||||
conversation.endOtrIfNeeded();
|
||||
}
|
||||
|
||||
mXmppConnectionService.databaseBackend.createMessage(message);
|
||||
final HttpConnectionManager manager = this.mXmppConnectionService.getHttpConnectionManager();
|
||||
if (message.trusted() && message.treatAsDownloadable() && manager.getAutoAcceptFileSize() > 0) {
|
||||
|
|
|
@ -50,6 +50,7 @@ import eu.siacs.conversations.crypto.axolotl.SQLiteAxolotlStore;
|
|||
import eu.siacs.conversations.entities.Account;
|
||||
import eu.siacs.conversations.entities.Contact;
|
||||
import eu.siacs.conversations.entities.Conversation;
|
||||
import eu.siacs.conversations.entities.Conversational;
|
||||
import eu.siacs.conversations.entities.Message;
|
||||
import eu.siacs.conversations.entities.PresenceTemplate;
|
||||
import eu.siacs.conversations.entities.Roster;
|
||||
|
@ -887,30 +888,40 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||
String comparsionOperation = isForward ? ">?" : "<?";
|
||||
String sorting = isForward ? " ASC" : " DESC";
|
||||
if (timestamp == -1) {
|
||||
if (conversation.getNextCounterpart() == null) {
|
||||
String[] selectionArgs = {conversation.getUuid()};
|
||||
cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION
|
||||
+ "=?", selectionArgs, null, null, Message.TIME_SENT
|
||||
+ sorting, String.valueOf(limit));
|
||||
} else {
|
||||
if (conversation.getNextCounterpart() != null && conversation.hasPermanentCounterpart() && conversation.getMode() == Conversational.MODE_MULTI) {
|
||||
String[] selectionArgs = {conversation.getUuid(), String.valueOf(Message.TYPE_PRIVATE), String.valueOf(Message.TYPE_PRIVATE_FILE), conversation.getNextCounterpart().toString()};
|
||||
cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION
|
||||
+ "=? and (" + Message.TYPE + "=? or " + Message.TYPE + "=?) and " + Message.COUNTERPART + "=?" , selectionArgs, null, null, Message.TIME_SENT
|
||||
+ sorting, String.valueOf(limit));
|
||||
} else if (conversation.getNextCounterpart() != null && conversation.hasPermanentCounterpart()) {
|
||||
String[] selectionArgs = {conversation.getUuid(), String.valueOf(Message.ENCRYPTION_OTR), conversation.getNextCounterpart().toString()};
|
||||
cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION
|
||||
+ "=? and " + Message.ENCRYPTION + "=? and " + Message.COUNTERPART + "=?" , selectionArgs, null, null, Message.TIME_SENT
|
||||
+ sorting, String.valueOf(limit));
|
||||
} else {
|
||||
String[] selectionArgs = {conversation.getUuid()};
|
||||
cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION
|
||||
+ "=?", selectionArgs, null, null, Message.TIME_SENT
|
||||
+ sorting, String.valueOf(limit));
|
||||
}
|
||||
} else {
|
||||
if (conversation.getNextCounterpart() == null) {
|
||||
if (conversation.getNextCounterpart() != null && conversation.hasPermanentCounterpart() && conversation.getMode() == Conversational.MODE_MULTI) {
|
||||
String[] selectionArgs = {conversation.getUuid(), String.valueOf(Message.TYPE_PRIVATE), String.valueOf(Message.TYPE_PRIVATE_FILE), conversation.getNextCounterpart().toString(), Long.toString(timestamp)};
|
||||
cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION
|
||||
+ "=? and (" + Message.TYPE + "=? or " + Message.TYPE + "=?) and " + Message.COUNTERPART + "=? and " + Message.TIME_SENT + comparsionOperation, selectionArgs, null, null, Message.TIME_SENT
|
||||
+ sorting, String.valueOf(limit));
|
||||
} else if (conversation.getNextCounterpart() != null && conversation.hasPermanentCounterpart()) {
|
||||
String[] selectionArgs = {conversation.getUuid(), String.valueOf(Message.ENCRYPTION_OTR), conversation.getNextCounterpart().toString(), Long.toString(timestamp)};
|
||||
cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION
|
||||
+ "=? and " + Message.ENCRYPTION + "=? and " + Message.COUNTERPART + "=? and " + Message.TIME_SENT + comparsionOperation, selectionArgs, null, null, Message.TIME_SENT
|
||||
+ sorting, String.valueOf(limit));
|
||||
} else {
|
||||
String[] selectionArgs = {conversation.getUuid(),
|
||||
Long.toString(timestamp)};
|
||||
cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION
|
||||
+ "=? and " + Message.TIME_SENT + comparsionOperation, selectionArgs,
|
||||
null, null, Message.TIME_SENT + sorting,
|
||||
String.valueOf(limit));
|
||||
} else {
|
||||
String[] selectionArgs = {conversation.getUuid(), String.valueOf(Message.TYPE_PRIVATE), String.valueOf(Message.TYPE_PRIVATE_FILE), conversation.getNextCounterpart().toString(), Long.toString(timestamp)};
|
||||
cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION
|
||||
+ "=? and (" + Message.TYPE + "=? or " + Message.TYPE + "=?) and " + Message.COUNTERPART + "=? and " + Message.TIME_SENT + comparsionOperation, selectionArgs, null, null, Message.TIME_SENT
|
||||
+ sorting, String.valueOf(limit));
|
||||
}
|
||||
}
|
||||
CursorUtils.upgradeCursorWindowSize(cursor);
|
||||
|
@ -1084,7 +1095,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||
|
||||
try(final Cursor cursor = db.query(Conversation.TABLENAME, null,
|
||||
Conversation.ACCOUNT + "=? AND (" + Conversation.CONTACTJID
|
||||
+ " like ? OR " + Conversation.CONTACTJID + "=?)", selectionArgs, null, null, null)) {
|
||||
+ " like ? OR " + Conversation.CONTACTJID + "=?) AND " + Conversation.NEXT_COUNTERPART + " =NULL", selectionArgs, null, null, null)) {
|
||||
if (cursor.getCount() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1101,6 +1112,37 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean deleteConversation(final Account account, final Jid contactJid, final Jid counterpart) {
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
|
||||
if (counterpart != null) {
|
||||
String[] selectionArgs = {account.getUuid(),
|
||||
contactJid.asBareJid().toString() + "/%",
|
||||
contactJid.asBareJid().toString(),
|
||||
counterpart.toString()
|
||||
};
|
||||
|
||||
int rows = db.delete(Conversation.TABLENAME,
|
||||
Conversation.ACCOUNT + "=? AND (" + Conversation.CONTACTJID
|
||||
+ " like ? OR " + Conversation.CONTACTJID + "=?) AND " + Conversation.NEXT_COUNTERPART + "=?", selectionArgs);
|
||||
|
||||
return rows == 1;
|
||||
} else {
|
||||
String[] selectionArgs = new String[]{
|
||||
account.getUuid(),
|
||||
contactJid.asBareJid().toString() + "/%",
|
||||
contactJid.asBareJid().toString()
|
||||
};
|
||||
|
||||
int rows = db.delete(Conversation.TABLENAME,
|
||||
Conversation.ACCOUNT + "=? AND (" + Conversation.CONTACTJID
|
||||
+ " like ? OR " + Conversation.CONTACTJID + "=?) AND " + Conversation.NEXT_COUNTERPART + " =NULL", selectionArgs);
|
||||
|
||||
return rows == 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConversation(final Conversation conversation) {
|
||||
final SQLiteDatabase db = this.getWritableDatabase();
|
||||
final String[] args = {conversation.getUuid()};
|
||||
|
|
|
@ -61,6 +61,11 @@ import com.google.common.base.Objects;
|
|||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import net.java.otr4j.session.Session;
|
||||
import net.java.otr4j.session.SessionID;
|
||||
import net.java.otr4j.session.SessionImpl;
|
||||
import net.java.otr4j.session.SessionStatus;
|
||||
|
||||
import org.conscrypt.Conscrypt;
|
||||
import org.jxmpp.stringprep.libidn.LibIdnXmppStringprep;
|
||||
import org.openintents.openpgp.IOpenPgpService2;
|
||||
|
@ -171,6 +176,7 @@ import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
|
|||
import eu.siacs.conversations.xmpp.XmppConnection;
|
||||
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
||||
import eu.siacs.conversations.xmpp.forms.Data;
|
||||
import eu.siacs.conversations.xmpp.jid.OtrJidHelper;
|
||||
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
|
||||
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
|
||||
import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
|
||||
|
@ -255,9 +261,18 @@ public class XmppConnectionService extends Service {
|
|||
Conversation conversation = find(getConversations(), contact);
|
||||
if (conversation != null) {
|
||||
if (online) {
|
||||
conversation.endOtrIfNeeded();
|
||||
if (contact.getPresences().size() == 1) {
|
||||
sendUnsentMessages(conversation);
|
||||
}
|
||||
} else {
|
||||
//check if the resource we are haveing a conversation with is still online
|
||||
if (conversation.hasValidOtrSession()) {
|
||||
String otrResource = conversation.getOtrSession().getSessionID().getUserID();
|
||||
if (!(Arrays.asList(contact.getPresences().toResourceArray()).contains(otrResource))) {
|
||||
conversation.endOtrIfNeeded();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -447,6 +462,9 @@ public class XmppConnectionService extends Service {
|
|||
if (conversation.getAccount() == account
|
||||
&& !pendingJoin
|
||||
&& !inProgressJoin) {
|
||||
if (!conversation.startOtrIfNeeded()) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": couldn't start OTR with " + conversation.getContact().getJid() + " when needed");
|
||||
}
|
||||
sendUnsentMessages(conversation);
|
||||
}
|
||||
}
|
||||
|
@ -1704,6 +1722,12 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
if (!resend && message.getEncryption() != Message.ENCRYPTION_OTR) {
|
||||
conversation.endOtrIfNeeded();
|
||||
conversation.findUnsentMessagesWithEncryption(Message.ENCRYPTION_OTR,
|
||||
message1 -> markMessage(message1, Message.STATUS_SEND_FAILED));
|
||||
}
|
||||
|
||||
final boolean inProgressJoin = isJoinInProgress(conversation);
|
||||
|
||||
|
||||
|
@ -1736,6 +1760,30 @@ public class XmppConnectionService extends Service {
|
|||
packet = mMessageGenerator.generatePgpChat(message);
|
||||
}
|
||||
break;
|
||||
case Message.ENCRYPTION_OTR:
|
||||
SessionImpl otrSession = conversation.getOtrSession();
|
||||
if (otrSession != null && otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
|
||||
try {
|
||||
message.setCounterpart(OtrJidHelper.fromSessionID(otrSession.getSessionID()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
break;
|
||||
}
|
||||
if (message.needsUploading()) {
|
||||
mJingleConnectionManager.startJingleFileTransfer(message);
|
||||
} else {
|
||||
packet = mMessageGenerator.generateOtrChat(message);
|
||||
}
|
||||
} else if (otrSession == null) {
|
||||
if (message.fixCounterpart()) {
|
||||
conversation.startOtrSession(message.getCounterpart().getResource(), true);
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": could not fix counterpart for OTR message to contact " + message.getCounterpart());
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + " OTR session with " + message.getContact() + " is in wrong state: " + otrSession.getSessionStatus().toString());
|
||||
}
|
||||
break;
|
||||
case Message.ENCRYPTION_AXOLOTL:
|
||||
message.setFingerprint(account.getAxolotlService().getOwnFingerprint());
|
||||
if (message.needsUploading()) {
|
||||
|
@ -1789,6 +1837,12 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case Message.ENCRYPTION_OTR:
|
||||
if (!conversation.hasValidOtrSession() && message.getCounterpart() != null) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": create otr session without starting for " + message.getContact().getJid());
|
||||
conversation.startOtrSession(message.getCounterpart().getResource(), false);
|
||||
}
|
||||
break;
|
||||
case Message.ENCRYPTION_AXOLOTL:
|
||||
message.setFingerprint(account.getAxolotlService().getOwnFingerprint());
|
||||
break;
|
||||
|
@ -2446,7 +2500,9 @@ public class XmppConnectionService extends Service {
|
|||
query.setCallback(callback);
|
||||
callback.informUser(R.string.fetching_history_from_server);
|
||||
} else {
|
||||
callback.informUser(R.string.not_fetching_history_retention_period);
|
||||
if (conversation.getMode() != Conversational.MODE_SINGLE || !conversation.hasPermanentCounterpart()) {
|
||||
callback.informUser(R.string.not_fetching_history_retention_period);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2496,6 +2552,7 @@ public class XmppConnectionService extends Service {
|
|||
if ((account == null || conversation.getAccount() == account)
|
||||
&& (conversation.getJid().asBareJid().equals(jid.asBareJid()))
|
||||
&& Objects.equal(conversation.getNextCounterpart(), counterpart)
|
||||
&& conversation.hasPermanentCounterpart()
|
||||
) {
|
||||
return conversation;
|
||||
}
|
||||
|
@ -2504,7 +2561,7 @@ public class XmppConnectionService extends Service {
|
|||
for (final Conversation conversation : haystack) {
|
||||
if ((account == null || conversation.getAccount() == account)
|
||||
&& (conversation.getJid().asBareJid().equals(jid.asBareJid()))
|
||||
&& conversation.getNextCounterpart() == null
|
||||
&& (conversation.getNextCounterpart() == null || !conversation.hasPermanentCounterpart())
|
||||
) {
|
||||
return conversation;
|
||||
}
|
||||
|
@ -2566,6 +2623,7 @@ public class XmppConnectionService extends Service {
|
|||
if (conversation != null) {
|
||||
return conversation;
|
||||
}
|
||||
|
||||
conversation = databaseBackend.findConversation(account, jid, counterpart);
|
||||
final boolean loadMessagesFromDb;
|
||||
if (conversation != null) {
|
||||
|
@ -2647,6 +2705,18 @@ public class XmppConnectionService extends Service {
|
|||
archiveConversation(conversation, true);
|
||||
}
|
||||
|
||||
public void destroyConversation(Conversation conversation) {
|
||||
archiveConversation(conversation);
|
||||
final Runnable runnable = () -> {
|
||||
databaseBackend.deleteMessagesInConversation(conversation);
|
||||
|
||||
if (!databaseBackend.deleteConversation(conversation.getAccount(), conversation.getContactJid().asBareJid(), conversation.getNextCounterpart())) {
|
||||
Log.d(Config.LOGTAG, conversation.getJid().asBareJid() + ": unable to delete conversation");
|
||||
}
|
||||
};
|
||||
mDatabaseWriterExecutor.execute(runnable);
|
||||
}
|
||||
|
||||
private void archiveConversation(Conversation conversation, final boolean maySynchronizeWithBookmarks) {
|
||||
getNotificationService().clear(conversation);
|
||||
conversation.setStatus(Conversation.STATUS_ARCHIVED);
|
||||
|
@ -2675,6 +2745,7 @@ public class XmppConnectionService extends Service {
|
|||
stopPresenceUpdatesTo(conversation.getContact());
|
||||
}
|
||||
}
|
||||
conversation.endOtrIfNeeded();
|
||||
updateConversation(conversation);
|
||||
this.conversations.remove(conversation);
|
||||
updateConversationUi();
|
||||
|
@ -3922,6 +3993,12 @@ public class XmppConnectionService extends Service {
|
|||
if (conversation.getAccount() == account) {
|
||||
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
||||
leaveMuc(conversation, true);
|
||||
} else {
|
||||
if (conversation.endOtrIfNeeded()) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid()
|
||||
+ ": ended otr session with "
|
||||
+ conversation.getJid());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3978,6 +4055,39 @@ public class XmppConnectionService extends Service {
|
|||
pushContactToServer(contact, preAuth);
|
||||
}
|
||||
|
||||
public void onOtrSessionEstablished(Conversation conversation) {
|
||||
final Account account = conversation.getAccount();
|
||||
final Session otrSession = conversation.getOtrSession();
|
||||
Log.d(Config.LOGTAG,
|
||||
account.getJid().asBareJid() + " otr session established with "
|
||||
+ conversation.getJid() + "/"
|
||||
+ otrSession.getSessionID().getUserID());
|
||||
conversation.findUnsentMessagesWithEncryption(Message.ENCRYPTION_OTR, new Conversation.OnMessageFound() {
|
||||
|
||||
@Override
|
||||
public void onMessageFound(Message message) {
|
||||
SessionID id = otrSession.getSessionID();
|
||||
try {
|
||||
message.setCounterpart(Jid.of(id.getAccountID() + "/" + id.getUserID()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return;
|
||||
}
|
||||
if (message.needsUploading()) {
|
||||
mJingleConnectionManager.startJingleFileTransfer(message);
|
||||
} else {
|
||||
MessagePacket outPacket = mMessageGenerator.generateOtrChat(message);
|
||||
if (outPacket != null) {
|
||||
mMessageGenerator.addDelay(outPacket, message.getTimeSent());
|
||||
message.setStatus(Message.STATUS_SEND);
|
||||
databaseBackend.updateMessage(message, false);
|
||||
sendMessagePacket(account, outPacket);
|
||||
}
|
||||
}
|
||||
updateConversationUi();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void pushContactToServer(final Contact contact) {
|
||||
pushContactToServer(contact, null);
|
||||
}
|
||||
|
@ -4503,6 +4613,7 @@ public class XmppConnectionService extends Service {
|
|||
return false;
|
||||
} else {
|
||||
final Message message = conversation.findSentMessageWithUuid(uuid);
|
||||
|
||||
if (message != null) {
|
||||
if (message.getServerMsgId() == null) {
|
||||
message.setServerMsgId(serverMessageId);
|
||||
|
@ -4805,6 +4916,11 @@ public class XmppConnectionService extends Service {
|
|||
setMemorizingTrustManager(tm);
|
||||
}
|
||||
|
||||
public void syncRosterToDisk(final Account account) {
|
||||
Runnable runnable = () -> databaseBackend.writeRoster(account.getRoster());
|
||||
mDatabaseWriterExecutor.execute(runnable);
|
||||
}
|
||||
|
||||
public LruCache<String, Bitmap> getBitmapCache() {
|
||||
return this.mBitmapCache;
|
||||
}
|
||||
|
@ -5272,10 +5388,14 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
|
||||
public boolean verifyFingerprints(Contact contact, List<XmppUri.Fingerprint> fingerprints) {
|
||||
boolean needsRosterWrite = false;
|
||||
boolean performedVerification = false;
|
||||
final AxolotlService axolotlService = contact.getAccount().getAxolotlService();
|
||||
for (XmppUri.Fingerprint fp : fingerprints) {
|
||||
if (fp.type == XmppUri.FingerprintType.OMEMO) {
|
||||
if (fp.type == XmppUri.FingerprintType.OTR) {
|
||||
performedVerification |= contact.addOtrFingerprint(fp.fingerprint);
|
||||
needsRosterWrite |= performedVerification;
|
||||
} else if (fp.type == XmppUri.FingerprintType.OMEMO) {
|
||||
String fingerprint = "05" + fp.fingerprint.replaceAll("\\s", "");
|
||||
FingerprintStatus fingerprintStatus = axolotlService.getFingerprintTrust(fingerprint);
|
||||
if (fingerprintStatus != null) {
|
||||
|
@ -5288,6 +5408,11 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needsRosterWrite) {
|
||||
syncRosterToDisk(contact.getAccount());
|
||||
}
|
||||
|
||||
return performedVerification;
|
||||
}
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
|||
&& contact.getLastseen() > 0
|
||||
&& contact.getPresences().allOrNonSupport(Namespace.IDLE)) {
|
||||
binding.detailsLastseen.setVisibility(View.VISIBLE);
|
||||
binding.detailsLastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen()));
|
||||
binding.detailsLastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen(), false));
|
||||
} else {
|
||||
binding.detailsLastseen.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
|||
AvatarWorkerTask.loadAvatar(contact, binding.detailsContactBadge, R.dimen.avatar_on_details_screen_size);
|
||||
binding.detailsContactBadge.setOnClickListener(this::onBadgeClick);
|
||||
|
||||
binding.presenceIndicator.setStatus(contact.getShownStatus());
|
||||
binding.presenceIndicator.setStatus(contact);
|
||||
|
||||
binding.detailsContactKeys.removeAllViews();
|
||||
boolean hasKeys = false;
|
||||
|
|
|
@ -79,6 +79,8 @@ import androidx.viewpager.widget.PagerAdapter;
|
|||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.java.otr4j.session.SessionStatus;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -223,6 +225,14 @@ public class ConversationFragment extends XmppFragment
|
|||
private ConversationsActivity activity;
|
||||
private Vibrator vibrator;
|
||||
private boolean reInitRequiredOnStart = true;
|
||||
|
||||
protected OnClickListener clickToVerify = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activity.verifyOtrSessionDialog(conversation, v);
|
||||
}
|
||||
};
|
||||
|
||||
@ColorInt
|
||||
private int primaryColor = -1;
|
||||
|
||||
|
@ -534,6 +544,20 @@ public class ConversationFragment extends XmppFragment
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
private OnClickListener mAnswerSmpClickListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(activity, VerifyOTRActivity.class);
|
||||
intent.setAction(VerifyOTRActivity.ACTION_VERIFY_CONTACT);
|
||||
intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().asBareJid().toString());
|
||||
intent.putExtra(VerifyOTRActivity.EXTRA_ACCOUNT, conversation.getAccount().getJid().asBareJid().toString());
|
||||
intent.putExtra("mode", VerifyOTRActivity.MODE_ANSWER_QUESTION);
|
||||
startActivity(intent);
|
||||
activity.overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
|
||||
}
|
||||
};
|
||||
|
||||
protected OnClickListener clickToDecryptListener =
|
||||
new OnClickListener() {
|
||||
|
||||
|
@ -590,7 +614,7 @@ public class ConversationFragment extends XmppFragment
|
|||
public void onClick(View v) {
|
||||
stopScrolling();
|
||||
|
||||
if (previousClickedReply != null) {
|
||||
/*if (previousClickedReply != null) {
|
||||
int lastVisiblePosition = binding.messagesView.getLastVisiblePosition();
|
||||
Message lastVisibleMessage = messageListAdapter.getItem(lastVisiblePosition);
|
||||
Message jump = previousClickedReply;
|
||||
|
@ -602,7 +626,7 @@ public class ConversationFragment extends XmppFragment
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (conversation.isInHistoryPart()) {
|
||||
conversation.jumpToLatest();
|
||||
|
@ -1064,6 +1088,9 @@ public class ConversationFragment extends XmppFragment
|
|||
message.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
switch (conversation.getNextEncryption()) {
|
||||
case Message.ENCRYPTION_OTR:
|
||||
sendOtrMessage(message);
|
||||
break;
|
||||
case Message.ENCRYPTION_PGP:
|
||||
sendPgpMessage(message);
|
||||
break;
|
||||
|
@ -1380,8 +1407,16 @@ public class ConversationFragment extends XmppFragment
|
|||
final MenuItem menuVideoCall = menu.findItem(R.id.action_video_call);
|
||||
final MenuItem menuTogglePinned = menu.findItem(R.id.action_toggle_pinned);
|
||||
final MenuItem deleteCustomBg = menu.findItem(R.id.action_delete_custom_bg);
|
||||
final MenuItem startSecretChat = menu.findItem(R.id.action_start_secret_chat);
|
||||
final MenuItem destroySecretChat = menu.findItem(R.id.action_destroy_secret_chat);
|
||||
final MenuItem encryption = menu.findItem(R.id.action_security);
|
||||
|
||||
if (conversation != null) {
|
||||
boolean considerAsSecretChat = conversation.getMode() == Conversational.MODE_SINGLE &&
|
||||
conversation.getNextCounterpart() != null && conversation.hasPermanentCounterpart();
|
||||
|
||||
|
||||
destroySecretChat.setVisible(false);
|
||||
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
||||
menuContactDetails.setVisible(false);
|
||||
menuInviteContact.setVisible(conversation.getMucOptions().canInvite() && conversation.getNextCounterpart() == null);
|
||||
|
@ -1391,7 +1426,12 @@ public class ConversationFragment extends XmppFragment
|
|||
: R.string.channel_details);
|
||||
menuCall.setVisible(false);
|
||||
menuOngoingCall.setVisible(false);
|
||||
startSecretChat.setVisible(false);
|
||||
} else {
|
||||
if (considerAsSecretChat) {
|
||||
startSecretChat.setVisible(false);
|
||||
destroySecretChat.setVisible(true);
|
||||
}
|
||||
menuMucParticipants.setVisible(false);
|
||||
final XmppConnectionService service =
|
||||
activity == null ? null : activity.xmppConnectionService;
|
||||
|
@ -1432,6 +1472,10 @@ public class ConversationFragment extends XmppFragment
|
|||
menuTogglePinned.setTitle(R.string.add_to_favorites);
|
||||
}
|
||||
|
||||
if (considerAsSecretChat) {
|
||||
encryption.setVisible(false);
|
||||
}
|
||||
|
||||
deleteCustomBg.setVisible(ChatBackgroundHelper.getBgFile(activity, conversation.getUuid()).exists());
|
||||
}
|
||||
|
||||
|
@ -2022,6 +2066,12 @@ public class ConversationFragment extends XmppFragment
|
|||
case R.id.action_archive:
|
||||
activity.xmppConnectionService.archiveConversation(conversation);
|
||||
break;
|
||||
case R.id.action_start_secret_chat:
|
||||
startOtrChat();
|
||||
break;
|
||||
case R.id.action_destroy_secret_chat:
|
||||
destroySecrectChat();
|
||||
break;
|
||||
case R.id.action_contact_details:
|
||||
activity.switchToContactDetails(conversation.getContact());
|
||||
break;
|
||||
|
@ -3550,6 +3600,14 @@ public class ConversationFragment extends XmppFragment
|
|||
}
|
||||
} else if (account.hasPendingPgpIntent(conversation)) {
|
||||
showSnackbar(R.string.openpgp_messages_found, R.string.decrypt, clickToDecryptListener);
|
||||
} else if (mode == Conversation.MODE_SINGLE
|
||||
&& conversation.smpRequested()) {
|
||||
showSnackbar(R.string.smp_requested, R.string.verify, this.mAnswerSmpClickListener);
|
||||
} else if (mode == Conversation.MODE_SINGLE
|
||||
&& conversation.hasValidOtrSession()
|
||||
&& (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED)
|
||||
&& (!conversation.isOtrFingerprintVerified())) {
|
||||
showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify, clickToVerify);
|
||||
} else if (connection != null
|
||||
&& connection.getFeatures().blocking()
|
||||
&& conversation.countMessages() != 0
|
||||
|
@ -3610,7 +3668,7 @@ public class ConversationFragment extends XmppFragment
|
|||
conversation.refreshSessions();
|
||||
|
||||
|
||||
if (conversation != null && conversation.getMode() == Conversational.MODE_MULTI) {
|
||||
if (conversation != null && conversation.getMode() == Conversational.MODE_MULTI && conversation.getNextCounterpart() == null) {
|
||||
String subject = conversation.getMucOptions().getSubject();
|
||||
Boolean hidden = conversation.getMucOptions().subjectHidden();
|
||||
|
||||
|
@ -3650,6 +3708,11 @@ public class ConversationFragment extends XmppFragment
|
|||
new Handler()
|
||||
.post(
|
||||
() -> {
|
||||
if (conversation.isInHistoryPart()) {
|
||||
conversation.jumpToLatest();
|
||||
refresh(false);
|
||||
}
|
||||
|
||||
int size = messageList.size();
|
||||
this.binding.messagesView.setSelection(size - 1);
|
||||
});
|
||||
|
@ -3937,6 +4000,31 @@ public class ConversationFragment extends XmppFragment
|
|||
messageSent();
|
||||
}
|
||||
|
||||
protected void sendOtrMessage(final Message message) {
|
||||
final ConversationsActivity activity = (ConversationsActivity) getActivity();
|
||||
final XmppConnectionService xmppService = activity.xmppConnectionService;
|
||||
message.setCounterpart(conversation.getNextCounterpart());
|
||||
xmppService.sendMessage(message);
|
||||
messageSent();
|
||||
}
|
||||
|
||||
protected void startOtrChat() {
|
||||
final ConversationsActivity activity = (ConversationsActivity) getActivity();
|
||||
activity.selectPresence(conversation,
|
||||
() -> {
|
||||
Conversation c = activity.xmppConnectionService.findOrCreateConversation(conversation.getAccount(), conversation.getJid(), null, false, false, false, conversation.getNextCounterpart());
|
||||
conversation.setNextCounterpart(null);
|
||||
if (c != conversation) {
|
||||
activity.switchToConversation(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void destroySecrectChat() {
|
||||
conversation.endOtrIfNeeded();
|
||||
activity.xmppConnectionService.destroyConversation(conversation);
|
||||
}
|
||||
|
||||
protected void sendPgpMessage(final Message message) {
|
||||
final XmppConnectionService xmppService = activity.xmppConnectionService;
|
||||
final Contact contact = message.getConversation().getContact();
|
||||
|
|
|
@ -42,10 +42,14 @@ import android.app.FragmentTransaction;
|
|||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -59,9 +63,12 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import net.java.otr4j.session.SessionStatus;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.navigation.NavigationBarView;
|
||||
|
||||
|
@ -95,10 +102,13 @@ import eu.siacs.conversations.ui.util.PendingItem;
|
|||
import eu.siacs.conversations.utils.ExceptionHelper;
|
||||
import eu.siacs.conversations.utils.PhoneNumberUtilWrapper;
|
||||
import eu.siacs.conversations.utils.SignupUtils;
|
||||
import eu.siacs.conversations.utils.UIHelper;
|
||||
import eu.siacs.conversations.utils.XmppUri;
|
||||
import eu.siacs.conversations.xml.Namespace;
|
||||
import eu.siacs.conversations.xmpp.Jid;
|
||||
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
|
||||
import io.michaelrocks.libphonenumber.android.NumberParseException;
|
||||
import me.drakeet.support.toast.ToastCompat;
|
||||
|
||||
public class ConversationsActivity extends XmppActivity implements OnConversationSelected, OnConversationArchived, OnConversationsListItemUpdated, OnConversationRead, XmppConnectionService.OnAccountUpdate, XmppConnectionService.OnConversationUpdate, XmppConnectionService.OnRosterUpdate, OnUpdateBlocklist, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnAffiliationChanged {
|
||||
|
||||
|
@ -135,6 +145,10 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
private boolean mActivityPaused = true;
|
||||
private final AtomicBoolean mRedirectInProcess = new AtomicBoolean(false);
|
||||
|
||||
private final Handler handler = new Handler(Looper.getMainLooper());
|
||||
private final Runnable refreshTitleRunnable = this::invalidateActionBarTitle;
|
||||
private boolean showLastSeen = false;
|
||||
|
||||
private static boolean isViewOrShareIntent(Intent i) {
|
||||
Log.d(Config.LOGTAG, "action: " + (i == null ? null : i.getAction()));
|
||||
return i != null && VIEW_AND_SHARE_ACTIONS.contains(i.getAction()) && i.hasExtra(EXTRA_CONVERSATION);
|
||||
|
@ -660,6 +674,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
this.mSkipBackgroundBinding = false;
|
||||
}
|
||||
mRedirectInProcess.set(false);
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
this.showLastSeen = preferences.getBoolean("last_activity", false);
|
||||
|
||||
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
|
||||
bottomNavigationView.setSelectedItemId(R.id.chats);
|
||||
|
@ -735,13 +751,18 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
if (actionBar == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final FragmentManager fragmentManager = getFragmentManager();
|
||||
final Fragment mainFragment = fragmentManager.findFragmentById(R.id.main_fragment);
|
||||
if (mainFragment instanceof ConversationFragment) {
|
||||
final Conversation conversation = ((ConversationFragment) mainFragment).getConversation();
|
||||
if (conversation != null) {
|
||||
if (conversation.getNextCounterpart() != null) {
|
||||
actionBar.setTitle(getString(R.string.muc_private_conversation_title, conversation.getNextCounterpart().getResource(), conversation.getName()));
|
||||
if (conversation.getNextCounterpart() != null && conversation.hasPermanentCounterpart()) {
|
||||
if (conversation.getMode() == Conversational.MODE_MULTI) {
|
||||
actionBar.setTitle(getString(R.string.muc_private_conversation_title, conversation.getNextCounterpart().getResource(), conversation.getName()));
|
||||
} else {
|
||||
actionBar.setTitle(getString(R.string.secret_chat_title_no_resource, conversation.getName()));
|
||||
}
|
||||
} else {
|
||||
actionBar.setTitle(conversation.getName());
|
||||
}
|
||||
|
@ -750,10 +771,40 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
binding.toolbar,
|
||||
(v) -> openConversationDetails(conversation)
|
||||
);
|
||||
|
||||
if (conversation.getMode() == Conversation.MODE_MULTI && conversation.getNextCounterpart() == null) {
|
||||
int usersCount = conversation.getMucOptions().getUserCount();
|
||||
if (usersCount > 0) {
|
||||
actionBar.setSubtitle(getResources().getQuantityString(R.plurals.x_participants, conversation.getMucOptions().getUserCount(), conversation.getMucOptions().getUserCount()));
|
||||
} else {
|
||||
actionBar.setSubtitle("");
|
||||
}
|
||||
|
||||
handler.postDelayed(refreshTitleRunnable, 5000L);
|
||||
} else if (conversation.getMode() == Conversation.MODE_SINGLE) {
|
||||
Contact contact = conversation.getContact();
|
||||
List<String> statuses = contact.getPresences().getStatusMessages();
|
||||
if (conversation.getNextCounterpart() != null && conversation.hasPermanentCounterpart()) {
|
||||
actionBar.setSubtitle(conversation.getNextCounterpart().getResource());
|
||||
} else if (!statuses.isEmpty() && !statuses.get(0).isBlank()) {
|
||||
actionBar.setSubtitle(statuses.get(0));
|
||||
handler.postDelayed(refreshTitleRunnable, 5000L);
|
||||
} else {
|
||||
actionBar.setSubtitle("");
|
||||
handler.removeCallbacks(refreshTitleRunnable);
|
||||
}
|
||||
} else {
|
||||
actionBar.setSubtitle("");
|
||||
handler.removeCallbacks(refreshTitleRunnable);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
handler.removeCallbacks(refreshTitleRunnable);
|
||||
actionBar.setTitle(R.string.app_name);
|
||||
actionBar.setSubtitle("");
|
||||
actionBar.setDisplayHomeAsUpEnabled(false);
|
||||
ActionBarUtil.resetActionBarOnClickListeners(binding.toolbar);
|
||||
}
|
||||
|
@ -771,6 +822,41 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
}
|
||||
}
|
||||
|
||||
public void verifyOtrSessionDialog(final Conversation conversation, View view) {
|
||||
if (!conversation.hasValidOtrSession() || conversation.getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
|
||||
ToastCompat.makeText(this, R.string.otr_session_not_started, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
PopupMenu popup = new PopupMenu(this, view);
|
||||
popup.inflate(R.menu.verification_choices);
|
||||
popup.setOnMenuItemClickListener(menuItem -> {
|
||||
if (menuItem.getItemId() == R.id.blind_trust) {
|
||||
conversation.verifyOtrFingerprint();
|
||||
xmppConnectionService.syncRosterToDisk(conversation.getAccount());
|
||||
refreshUiReal();
|
||||
return true;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(ConversationsActivity.this, VerifyOTRActivity.class);
|
||||
intent.setAction(VerifyOTRActivity.ACTION_VERIFY_CONTACT);
|
||||
intent.putExtra("contact", conversation.getContact().getJid().asBareJid().toString());
|
||||
intent.putExtra("counterpart", conversation.getNextCounterpart().toString());
|
||||
intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().asBareJid().toString());
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.ask_question:
|
||||
intent.putExtra("mode", VerifyOTRActivity.MODE_ASK_QUESTION);
|
||||
break;
|
||||
}
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
|
||||
return true;
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConversationArchived(Conversation conversation) {
|
||||
if (performRedirectIfNecessary(conversation, false)) {
|
||||
|
|
|
@ -265,7 +265,6 @@ public class SendLogActivity extends ActionBarActivity {
|
|||
log.insert(0, mAdditonalInfo);
|
||||
}
|
||||
|
||||
android.util.Log.e("35fd", log.toString());
|
||||
writer.write(log.toString());
|
||||
}
|
||||
catch (IOException e){
|
||||
|
|
|
@ -1310,6 +1310,21 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
}
|
||||
}
|
||||
|
||||
protected void startOtrChat() {
|
||||
int position = contact_context_id;
|
||||
Contact contact = (Contact) contacts.get(position);
|
||||
|
||||
Conversation conversation = xmppConnectionService.findOrCreateConversation(contact.getAccount(), contact.getJid(), null, false, false, false, null);
|
||||
|
||||
selectPresence(conversation,
|
||||
() -> {
|
||||
Conversation c = xmppConnectionService.findOrCreateConversation(contact.getAccount(), contact.getJid(), null, false, false, false, conversation.getNextCounterpart());
|
||||
conversation.setNextCounterpart(null);
|
||||
if (c != null) {
|
||||
switchToConversation(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setRefreshing(boolean refreshing) {
|
||||
MyListFragment fragment = (MyListFragment) mListPagerAdapter.getItem(0);
|
||||
|
@ -1451,9 +1466,12 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
final MenuItem blockUnblockItem = menu.findItem(R.id.context_contact_block_unblock);
|
||||
final MenuItem showContactDetailsItem = menu.findItem(R.id.context_contact_details);
|
||||
final MenuItem deleteContactMenuItem = menu.findItem(R.id.context_delete_contact);
|
||||
final MenuItem startSecrectChat = menu.findItem(R.id.context_contact_start_secrect_chat);
|
||||
if (contact.isSelf()) {
|
||||
showContactDetailsItem.setVisible(false);
|
||||
startSecrectChat.setVisible(false);
|
||||
}
|
||||
|
||||
deleteContactMenuItem.setVisible(contact.showInRoster() && !contact.getOption(Contact.Options.SYNCED_VIA_OTHER));
|
||||
final XmppConnection xmpp = contact.getAccount().getXmppConnection();
|
||||
if (xmpp != null && xmpp.getFeatures().blocking() && !contact.isSelf()) {
|
||||
|
@ -1492,6 +1510,8 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
break;
|
||||
case R.id.context_delete_conference:
|
||||
activity.deleteConference();
|
||||
case R.id.context_contact_start_secrect_chat:
|
||||
activity.startOtrChat();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
450
src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java
Normal file
|
@ -0,0 +1,450 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import net.java.otr4j.OtrException;
|
||||
import net.java.otr4j.session.Session;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.entities.Account;
|
||||
import eu.siacs.conversations.entities.Contact;
|
||||
import eu.siacs.conversations.entities.Conversation;
|
||||
import eu.siacs.conversations.services.XmppConnectionService;
|
||||
import eu.siacs.conversations.utils.CryptoHelper;
|
||||
import eu.siacs.conversations.utils.XmppUri;
|
||||
import eu.siacs.conversations.xmpp.Jid;
|
||||
import me.drakeet.support.toast.ToastCompat;
|
||||
|
||||
public class VerifyOTRActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate {
|
||||
|
||||
public static final String ACTION_VERIFY_CONTACT = "verify_contact";
|
||||
public static final int MODE_SCAN_FINGERPRINT = -0x0502;
|
||||
public static final int MODE_ASK_QUESTION = 0x0503;
|
||||
public static final int MODE_ANSWER_QUESTION = 0x0504;
|
||||
public static final int MODE_MANUAL_VERIFICATION = 0x0505;
|
||||
|
||||
private LinearLayout mManualVerificationArea;
|
||||
private LinearLayout mSmpVerificationArea;
|
||||
private TextView mRemoteFingerprint;
|
||||
private TextView mYourFingerprint;
|
||||
private TextView mVerificationExplain;
|
||||
private TextView mStatusMessage;
|
||||
private TextView mSharedSecretHint;
|
||||
private EditText mSharedSecretHintEditable;
|
||||
private EditText mSharedSecretSecret;
|
||||
private Button mLeftButton;
|
||||
private Button mRightButton;
|
||||
private Account mAccount;
|
||||
private Conversation mConversation;
|
||||
private int mode = MODE_MANUAL_VERIFICATION;
|
||||
private XmppUri mPendingUri = null;
|
||||
|
||||
private DialogInterface.OnClickListener mVerifyFingerprintListener = new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int click) {
|
||||
mConversation.verifyOtrFingerprint();
|
||||
xmppConnectionService.syncRosterToDisk(mConversation.getAccount());
|
||||
ToastCompat.makeText(VerifyOTRActivity.this, R.string.verified, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
private View.OnClickListener mCreateSharedSecretListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
if (isAccountOnline()) {
|
||||
final String question = mSharedSecretHintEditable.getText().toString();
|
||||
final String secret = mSharedSecretSecret.getText().toString();
|
||||
if (question.trim().isEmpty()) {
|
||||
mSharedSecretHintEditable.requestFocus();
|
||||
mSharedSecretHintEditable.setError(getString(R.string.shared_secret_hint_should_not_be_empty));
|
||||
} else if (secret.trim().isEmpty()) {
|
||||
mSharedSecretSecret.requestFocus();
|
||||
mSharedSecretSecret.setError(getString(R.string.shared_secret_can_not_be_empty));
|
||||
} else {
|
||||
mSharedSecretSecret.setError(null);
|
||||
mSharedSecretHintEditable.setError(null);
|
||||
initSmp(question, secret);
|
||||
updateView();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
private View.OnClickListener mCancelSharedSecretListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (isAccountOnline()) {
|
||||
abortSmp();
|
||||
updateView();
|
||||
}
|
||||
}
|
||||
};
|
||||
private View.OnClickListener mRespondSharedSecretListener = new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (isAccountOnline()) {
|
||||
final String question = mSharedSecretHintEditable.getText().toString();
|
||||
final String secret = mSharedSecretSecret.getText().toString();
|
||||
respondSmp(question, secret);
|
||||
updateView();
|
||||
}
|
||||
}
|
||||
};
|
||||
private View.OnClickListener mRetrySharedSecretListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
mConversation.smp().status = Conversation.Smp.STATUS_NONE;
|
||||
mConversation.smp().hint = null;
|
||||
mConversation.smp().secret = null;
|
||||
updateView();
|
||||
}
|
||||
};
|
||||
private View.OnClickListener mFinishListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
mConversation.smp().status = Conversation.Smp.STATUS_NONE;
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
protected boolean initSmp(final String question, final String secret) {
|
||||
final Session session = mConversation.getOtrSession();
|
||||
if (session != null) {
|
||||
try {
|
||||
session.initSmp(question, secret);
|
||||
mConversation.smp().status = Conversation.Smp.STATUS_WE_REQUESTED;
|
||||
mConversation.smp().secret = secret;
|
||||
mConversation.smp().hint = question;
|
||||
return true;
|
||||
} catch (OtrException e) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean abortSmp() {
|
||||
final Session session = mConversation.getOtrSession();
|
||||
if (session != null) {
|
||||
try {
|
||||
session.abortSmp();
|
||||
mConversation.smp().status = Conversation.Smp.STATUS_NONE;
|
||||
mConversation.smp().hint = null;
|
||||
mConversation.smp().secret = null;
|
||||
return true;
|
||||
} catch (OtrException e) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean respondSmp(final String question, final String secret) {
|
||||
final Session session = mConversation.getOtrSession();
|
||||
if (session != null) {
|
||||
try {
|
||||
session.respondSmp(question, secret);
|
||||
return true;
|
||||
} catch (OtrException e) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean verifyWithUri(XmppUri uri) {
|
||||
Contact contact = mConversation.getContact();
|
||||
if (this.mConversation.getContact().getJid().equals(uri.getJid()) && uri.hasFingerprints()) {
|
||||
xmppConnectionService.verifyFingerprints(contact, uri.getFingerprints());
|
||||
ToastCompat.makeText(this, R.string.verified, Toast.LENGTH_SHORT).show();
|
||||
updateView();
|
||||
return true;
|
||||
} else {
|
||||
ToastCompat.makeText(this, R.string.could_not_verify_fingerprint, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isAccountOnline() {
|
||||
if (this.mAccount.getStatus() != Account.State.ONLINE) {
|
||||
ToastCompat.makeText(this, R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean handleIntent(Intent intent) {
|
||||
if (intent != null && intent.getAction().equals(ACTION_VERIFY_CONTACT)) {
|
||||
this.mAccount = extractAccount(intent);
|
||||
if (this.mAccount == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
this.mConversation = this.xmppConnectionService.find(this.mAccount, Jid.of(intent.getExtras().getString("contact")), Jid.of(intent.getExtras().getString("counterpart")));
|
||||
if (this.mConversation == null) {
|
||||
return false;
|
||||
}
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
ignored.printStackTrace();
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
this.mode = intent.getIntExtra("mode", MODE_MANUAL_VERIFICATION);
|
||||
// todo scan OTR fingerprint
|
||||
if (this.mode == MODE_SCAN_FINGERPRINT) {
|
||||
Log.d(Config.LOGTAG, "Scan OTR fingerprint is not implemented in this version");
|
||||
//new IntentIntegrator(this).initiateScan();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
// todo onActivityResult for OTR scan
|
||||
Log.d(Config.LOGTAG, "Scan OTR fingerprint result is not implemented in this version");
|
||||
/*if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
|
||||
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
|
||||
if (scanResult != null && scanResult.getFormatName() != null) {
|
||||
String data = scanResult.getContents();
|
||||
XmppUri uri = new XmppUri(data);
|
||||
if (xmppConnectionServiceBound) {
|
||||
verifyWithUri(uri);
|
||||
finish();
|
||||
} else {
|
||||
this.mPendingUri = uri;
|
||||
}
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}*/
|
||||
super.onActivityResult(requestCode, requestCode, intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBackendConnected() {
|
||||
if (handleIntent(getIntent())) {
|
||||
updateView();
|
||||
} else if (mPendingUri != null) {
|
||||
verifyWithUri(mPendingUri);
|
||||
finish();
|
||||
mPendingUri = null;
|
||||
}
|
||||
setIntent(null);
|
||||
}
|
||||
|
||||
protected void updateView() {
|
||||
if (this.mConversation != null && this.mConversation.hasValidOtrSession()) {
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
this.mVerificationExplain.setText(R.string.no_otr_session_found);
|
||||
invalidateOptionsMenu();
|
||||
switch (this.mode) {
|
||||
case MODE_ASK_QUESTION:
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.ask_question);
|
||||
}
|
||||
this.updateViewAskQuestion();
|
||||
break;
|
||||
case MODE_ANSWER_QUESTION:
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.smp_requested);
|
||||
}
|
||||
this.updateViewAnswerQuestion();
|
||||
break;
|
||||
case MODE_MANUAL_VERIFICATION:
|
||||
default:
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.manually_verify);
|
||||
}
|
||||
this.updateViewManualVerification();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this.mManualVerificationArea.setVisibility(View.GONE);
|
||||
this.mSmpVerificationArea.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateViewManualVerification() {
|
||||
this.mVerificationExplain.setText(R.string.manual_verification_explanation);
|
||||
this.mManualVerificationArea.setVisibility(View.VISIBLE);
|
||||
this.mSmpVerificationArea.setVisibility(View.GONE);
|
||||
this.mYourFingerprint.setText(CryptoHelper.prettifyFingerprint(this.mAccount.getOtrFingerprint()));
|
||||
this.mRemoteFingerprint.setText(CryptoHelper.prettifyFingerprint(this.mConversation.getOtrFingerprint()));
|
||||
if (this.mConversation.isOtrFingerprintVerified()) {
|
||||
deactivateButton(this.mRightButton, R.string.verified);
|
||||
activateButton(this.mLeftButton, R.string.cancel, this.mFinishListener);
|
||||
} else {
|
||||
activateButton(this.mLeftButton, R.string.cancel, this.mFinishListener);
|
||||
activateButton(this.mRightButton, R.string.verify, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
showManuallyVerifyDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateViewAskQuestion() {
|
||||
this.mManualVerificationArea.setVisibility(View.GONE);
|
||||
this.mSmpVerificationArea.setVisibility(View.VISIBLE);
|
||||
this.mVerificationExplain.setText(R.string.smp_explain_question);
|
||||
final int smpStatus = this.mConversation.smp().status;
|
||||
switch (smpStatus) {
|
||||
case Conversation.Smp.STATUS_WE_REQUESTED:
|
||||
this.mStatusMessage.setVisibility(View.GONE);
|
||||
this.mSharedSecretHintEditable.setVisibility(View.VISIBLE);
|
||||
this.mSharedSecretSecret.setVisibility(View.VISIBLE);
|
||||
this.mSharedSecretHintEditable.setText(this.mConversation.smp().hint);
|
||||
this.mSharedSecretSecret.setText(this.mConversation.smp().secret);
|
||||
this.activateButton(this.mLeftButton, R.string.cancel, this.mCancelSharedSecretListener);
|
||||
this.deactivateButton(this.mRightButton, R.string.in_progress);
|
||||
break;
|
||||
case Conversation.Smp.STATUS_FAILED:
|
||||
this.mStatusMessage.setVisibility(View.GONE);
|
||||
this.mSharedSecretHintEditable.setVisibility(View.VISIBLE);
|
||||
this.mSharedSecretSecret.setVisibility(View.VISIBLE);
|
||||
this.mSharedSecretSecret.requestFocus();
|
||||
this.mSharedSecretSecret.setError(getString(R.string.secrets_do_not_match));
|
||||
this.deactivateButton(this.mLeftButton, R.string.cancel);
|
||||
this.activateButton(this.mRightButton, R.string.try_again, this.mRetrySharedSecretListener);
|
||||
break;
|
||||
case Conversation.Smp.STATUS_VERIFIED:
|
||||
this.mSharedSecretHintEditable.setText("");
|
||||
this.mSharedSecretHintEditable.setVisibility(View.GONE);
|
||||
this.mSharedSecretSecret.setText("");
|
||||
this.mSharedSecretSecret.setVisibility(View.GONE);
|
||||
this.mStatusMessage.setVisibility(View.VISIBLE);
|
||||
this.deactivateButton(this.mLeftButton, R.string.cancel);
|
||||
this.activateButton(this.mRightButton, R.string.finish, this.mFinishListener);
|
||||
break;
|
||||
default:
|
||||
this.mStatusMessage.setVisibility(View.GONE);
|
||||
this.mSharedSecretHintEditable.setVisibility(View.VISIBLE);
|
||||
this.mSharedSecretSecret.setVisibility(View.VISIBLE);
|
||||
this.activateButton(this.mLeftButton, R.string.cancel, this.mFinishListener);
|
||||
this.activateButton(this.mRightButton, R.string.ask_question, this.mCreateSharedSecretListener);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateViewAnswerQuestion() {
|
||||
this.mManualVerificationArea.setVisibility(View.GONE);
|
||||
this.mSmpVerificationArea.setVisibility(View.VISIBLE);
|
||||
this.mVerificationExplain.setText(R.string.smp_explain_answer);
|
||||
this.mSharedSecretHintEditable.setVisibility(View.GONE);
|
||||
this.mSharedSecretHint.setVisibility(View.VISIBLE);
|
||||
this.deactivateButton(this.mLeftButton, R.string.cancel);
|
||||
final int smpStatus = this.mConversation.smp().status;
|
||||
switch (smpStatus) {
|
||||
case Conversation.Smp.STATUS_CONTACT_REQUESTED:
|
||||
this.mStatusMessage.setVisibility(View.GONE);
|
||||
this.mSharedSecretHint.setText(this.mConversation.smp().hint);
|
||||
this.activateButton(this.mRightButton, R.string.respond, this.mRespondSharedSecretListener);
|
||||
break;
|
||||
case Conversation.Smp.STATUS_VERIFIED:
|
||||
this.mSharedSecretHintEditable.setText("");
|
||||
this.mSharedSecretHintEditable.setVisibility(View.GONE);
|
||||
this.mSharedSecretHint.setVisibility(View.GONE);
|
||||
this.mSharedSecretSecret.setText("");
|
||||
this.mSharedSecretSecret.setVisibility(View.GONE);
|
||||
this.mStatusMessage.setVisibility(View.VISIBLE);
|
||||
this.activateButton(this.mRightButton, R.string.finish, this.mFinishListener);
|
||||
break;
|
||||
case Conversation.Smp.STATUS_FAILED:
|
||||
default:
|
||||
this.mSharedSecretSecret.requestFocus();
|
||||
this.mSharedSecretSecret.setError(getString(R.string.secrets_do_not_match));
|
||||
this.activateButton(this.mRightButton, R.string.finish, this.mFinishListener);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void activateButton(Button button, int text, View.OnClickListener listener) {
|
||||
button.setEnabled(true);
|
||||
button.setText(text);
|
||||
button.setOnClickListener(listener);
|
||||
}
|
||||
|
||||
protected void deactivateButton(Button button, int text) {
|
||||
button.setEnabled(false);
|
||||
button.setText(text);
|
||||
button.setOnClickListener(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_verify_otr);
|
||||
this.mRemoteFingerprint = findViewById(R.id.remote_fingerprint);
|
||||
this.mYourFingerprint = findViewById(R.id.your_fingerprint);
|
||||
this.mLeftButton = findViewById(R.id.left_button);
|
||||
this.mRightButton = findViewById(R.id.right_button);
|
||||
this.mVerificationExplain = findViewById(R.id.verification_explanation);
|
||||
this.mStatusMessage = findViewById(R.id.status_message);
|
||||
this.mSharedSecretSecret = findViewById(R.id.shared_secret_secret);
|
||||
this.mSharedSecretHintEditable = findViewById(R.id.shared_secret_hint_editable);
|
||||
this.mSharedSecretHint = findViewById(R.id.shared_secret_hint);
|
||||
this.mManualVerificationArea = findViewById(R.id.manual_verification_area);
|
||||
this.mSmpVerificationArea = findViewById(R.id.smp_verification_area);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
getMenuInflater().inflate(R.menu.verify_otr, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void showManuallyVerifyDialog() {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.manually_verify);
|
||||
builder.setMessage(R.string.are_you_sure_verify_fingerprint);
|
||||
builder.setNegativeButton(R.string.cancel, null);
|
||||
builder.setPositiveButton(R.string.verify, mVerifyFingerprintListener);
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getShareableUri() {
|
||||
if (mAccount != null) {
|
||||
return mAccount.getShareableUri();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void onConversationUpdate() {
|
||||
refreshUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void refreshUiReal() {
|
||||
updateView();
|
||||
}
|
||||
}
|
|
@ -56,6 +56,8 @@ import androidx.databinding.DataBindingUtil;
|
|||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import net.java.otr4j.session.SessionID;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
@ -446,7 +448,18 @@ public abstract class XmppActivity extends ActionBarActivity {
|
|||
|
||||
public void selectPresence(final Conversation conversation, final PresenceSelector.OnPresenceSelected listener) {
|
||||
final Contact contact = conversation.getContact();
|
||||
if (contact.showInRoster() || contact.isSelf()) {
|
||||
|
||||
if (conversation.hasValidOtrSession()) {
|
||||
SessionID id = conversation.getOtrSession().getSessionID();
|
||||
Jid jid;
|
||||
try {
|
||||
jid = Jid.of(id.getAccountID() + "/" + id.getUserID());
|
||||
} catch (IllegalArgumentException e) {
|
||||
jid = null;
|
||||
}
|
||||
conversation.setNextCounterpart(jid);
|
||||
listener.onPresenceSelected();
|
||||
} else if (contact.showInRoster() || contact.isSelf()) {
|
||||
final Presences presences = contact.getPresences();
|
||||
if (presences.size() == 0) {
|
||||
if (contact.isSelf()) {
|
||||
|
|
|
@ -9,6 +9,11 @@ import android.widget.ArrayAdapter;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.kizitonwose.colorpreference.ColorDialog;
|
||||
import com.kizitonwose.colorpreference.ColorPreference;
|
||||
import com.kizitonwose.colorpreference.ColorShape;
|
||||
import com.kizitonwose.colorpreference.ColorUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
|
@ -19,22 +24,29 @@ import eu.siacs.conversations.ui.XmppActivity;
|
|||
import eu.siacs.conversations.ui.util.AvatarWorkerTask;
|
||||
import eu.siacs.conversations.ui.util.StyledAttributes;
|
||||
import eu.siacs.conversations.utils.UIHelper;
|
||||
import eu.siacs.conversations.xmpp.Jid;
|
||||
|
||||
public class AccountAdapter extends ArrayAdapter<Account> {
|
||||
|
||||
private final XmppActivity activity;
|
||||
private final boolean showStateButton;
|
||||
private final boolean showColorSelector;
|
||||
|
||||
public ColorSelectorListener colorSelectorListener = null;
|
||||
|
||||
public AccountAdapter(XmppActivity activity, List<Account> objects, boolean showStateButton) {
|
||||
super(activity, 0, objects);
|
||||
this.activity = activity;
|
||||
this.showStateButton = showStateButton;
|
||||
this.showColorSelector = false;
|
||||
}
|
||||
|
||||
public AccountAdapter(XmppActivity activity, List<Account> objects) {
|
||||
public AccountAdapter(XmppActivity activity, List<Account> objects, ColorSelectorListener listener) {
|
||||
super(activity, 0, objects);
|
||||
this.activity = activity;
|
||||
this.showStateButton = true;
|
||||
this.showColorSelector = true;
|
||||
colorSelectorListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,18 +89,28 @@ public class AccountAdapter extends ArrayAdapter<Account> {
|
|||
} else {
|
||||
viewHolder.binding.tglAccountStatus.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
viewHolder.binding.tglAccountStatus.setOnCheckedChangeListener((compoundButton, b) -> {
|
||||
if (b == isDisabled && activity instanceof OnTglAccountState) {
|
||||
((OnTglAccountState) activity).onClickTglAccountState(account, b);
|
||||
}
|
||||
});
|
||||
|
||||
if (activity.xmppConnectionService.getAccounts().size() > 1) {
|
||||
viewHolder.binding.accountIndicator.setBackgroundColor(UIHelper.getColorForName(account.getJid().asBareJid().getEscapedLocal()));
|
||||
if (this.showColorSelector && activity.xmppConnectionService.getAccounts().size() > 1 &&
|
||||
activity.xmppConnectionService.getPreferences().getBoolean("show_account_indicator", activity.getResources().getBoolean(R.bool.show_account_indicator))) {
|
||||
int color = UIHelper.getAccountColor(activity, account.getJid());
|
||||
viewHolder.binding.colorView.setVisibility(View.VISIBLE);
|
||||
ColorUtils.setColorViewValue(viewHolder.binding.colorView, color, false, ColorShape.CIRCLE);
|
||||
viewHolder.binding.colorView.setOnClickListener(v -> {
|
||||
if (colorSelectorListener != null) {
|
||||
colorSelectorListener.onColorPickerRequested(account.getJid(), color);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
viewHolder.binding.accountIndicator.setBackgroundColor(Color.TRANSPARENT);
|
||||
viewHolder.binding.colorView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -106,4 +128,7 @@ public class AccountAdapter extends ArrayAdapter<Account> {
|
|||
void onClickTglAccountState(Account account, boolean state);
|
||||
}
|
||||
|
||||
public interface ColorSelectorListener {
|
||||
void onColorPickerRequested(Jid accountJid, int currentColor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -338,8 +338,12 @@ public class ConversationAdapter
|
|||
}
|
||||
|
||||
CharSequence name = conversation.getName();
|
||||
if (conversation.getNextCounterpart() != null) {
|
||||
name = viewHolder.binding.getRoot().getResources().getString(R.string.muc_private_conversation_title, conversation.getNextCounterpart().getResource(), conversation.getName());
|
||||
if (conversation.getNextCounterpart() != null && conversation.hasPermanentCounterpart()) {
|
||||
if (conversation.getMode() == Conversational.MODE_MULTI) {
|
||||
name = viewHolder.binding.getRoot().getResources().getString(R.string.muc_private_conversation_title, conversation.getNextCounterpart().getResource(), conversation.getName());
|
||||
} else {
|
||||
name = viewHolder.binding.getRoot().getResources().getString(R.string.secret_chat_title, conversation.getName(), conversation.getNextCounterpart().getResource());
|
||||
}
|
||||
}
|
||||
|
||||
if (conversation.withSelf()) {
|
||||
|
@ -386,6 +390,10 @@ public class ConversationAdapter
|
|||
int drId = activity.getThemeResource(R.attr.ic_group_16, R.drawable.ic_group_selected_black_16);
|
||||
Drawable dr = AppCompatResources.getDrawable(activity, drId);
|
||||
viewHolder.binding.conversationName.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, dr, null);
|
||||
} else if (conversation.getMode() == Conversation.MODE_SINGLE && conversation.hasPermanentCounterpart()) {
|
||||
int drId = activity.getThemeResource(R.attr.ic_secret_chat_16, R.drawable.ic_secret_chat_16dp_black);
|
||||
Drawable dr = AppCompatResources.getDrawable(activity, drId);
|
||||
viewHolder.binding.conversationName.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, dr, null);
|
||||
} else {
|
||||
viewHolder.binding.conversationName.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, null, null);
|
||||
}
|
||||
|
@ -393,7 +401,7 @@ public class ConversationAdapter
|
|||
Contact contact = conversation.getContact();
|
||||
|
||||
if (contact != null) {
|
||||
viewHolder.binding.presenceIndicator.setStatus(contact.getShownStatus());
|
||||
viewHolder.binding.presenceIndicator.setStatus(contact);
|
||||
} else {
|
||||
viewHolder.binding.presenceIndicator.setStatus(null);
|
||||
}
|
||||
|
@ -401,7 +409,7 @@ public class ConversationAdapter
|
|||
Account account = conversation.getAccount();
|
||||
|
||||
if (account != null && activity.xmppConnectionService.getAccounts().size() > 1) {
|
||||
viewHolder.binding.accountIndicator.setBackgroundColor(UIHelper.getColorForName(account.getJid().asBareJid().getEscapedLocal()));
|
||||
viewHolder.binding.accountIndicator.setBackgroundColor(UIHelper.getAccountColor(activity, account.getJid()));
|
||||
} else {
|
||||
viewHolder.binding.accountIndicator.setBackgroundColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
|
|||
AvatarWorkerTask.loadAvatar(item, viewHolder.avatar, R.dimen.avatar);
|
||||
|
||||
if (item instanceof Contact) {
|
||||
viewHolder.presenceIndicator.setStatus(((Contact) item).getShownStatus());
|
||||
viewHolder.presenceIndicator.setStatus(((Contact) item));
|
||||
} else {
|
||||
viewHolder.presenceIndicator.setStatus(null);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
|
|||
}
|
||||
|
||||
if (account != null && activity.xmppConnectionService.getAccounts().size() > 1) {
|
||||
viewHolder.accountIndicator.setBackgroundColor(UIHelper.getColorForName(account.getJid().asBareJid().getEscapedLocal()));
|
||||
viewHolder.accountIndicator.setBackgroundColor(UIHelper.getAccountColor(activity, account.getJid()));
|
||||
} else {
|
||||
viewHolder.accountIndicator.setBackgroundColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class UserAdapter extends ListAdapter<MucOptions.User, UserAdapter.ViewHo
|
|||
} else {
|
||||
viewHolder.binding.contactJid.setText(ConferenceDetailsActivity.getStatus(viewHolder.binding.getRoot().getContext(), user, advancedMode));
|
||||
}
|
||||
viewHolder.binding.presenceIndicator.setStatus(contact.getShownStatus());
|
||||
viewHolder.binding.presenceIndicator.setStatus(contact);
|
||||
} else {
|
||||
viewHolder.binding.contactDisplayName.setText(name == null ? "" : name);
|
||||
viewHolder.binding.contactJid.setText(ConferenceDetailsActivity.getStatus(viewHolder.binding.getRoot().getContext(), user, advancedMode));
|
||||
|
|
|
@ -38,7 +38,7 @@ public class UserPreviewAdapter extends ListAdapter<MucOptions.User, UserPreview
|
|||
AvatarWorkerTask.loadAvatar(user, viewHolder.binding.avatar, R.dimen.media_size);
|
||||
Contact contact = user.getContact();
|
||||
if (contact != null) {
|
||||
viewHolder.binding.presenceIndicator.setStatus(user.getContact().getShownStatus());
|
||||
viewHolder.binding.presenceIndicator.setStatus(user.getContact());
|
||||
} else {
|
||||
viewHolder.binding.presenceIndicator.setStatus(null);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package eu.siacs.conversations.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import eu.siacs.conversations.R
|
||||
import eu.siacs.conversations.ui.XmppActivity
|
||||
|
||||
class AccountIndicator : View {
|
||||
constructor(context: Context?) : super(context)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet?,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val enabled = (context as? XmppActivity)
|
||||
?.xmppConnectionService?.preferences
|
||||
?.getBoolean("show_account_indicator", context.resources.getBoolean(R.bool.show_account_indicator)) ?: false
|
||||
|
||||
visibility = if (enabled) {
|
||||
VISIBLE
|
||||
} else {
|
||||
INVISIBLE
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,9 +8,13 @@ import android.graphics.Paint
|
|||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewOutlineProvider
|
||||
import eu.siacs.conversations.R
|
||||
import eu.siacs.conversations.entities.Contact
|
||||
import eu.siacs.conversations.entities.Presence
|
||||
import eu.siacs.conversations.ui.XmppActivity
|
||||
import eu.siacs.conversations.ui.util.StyledAttributes
|
||||
import eu.siacs.conversations.utils.UIHelper
|
||||
import eu.siacs.conversations.xml.Namespace
|
||||
|
||||
class PresenceIndicator : View {
|
||||
private var paint: Paint = Paint().also {
|
||||
|
@ -19,13 +23,9 @@ class PresenceIndicator : View {
|
|||
it.strokeWidth = 1 * Resources.getSystem().displayMetrics.density
|
||||
}
|
||||
|
||||
var status: Presence.Status? = null
|
||||
set(value) {
|
||||
if (field != value) {
|
||||
field = value
|
||||
invalidate()
|
||||
}
|
||||
}
|
||||
private var status: Presence.Status? = null
|
||||
|
||||
private var enabled = false
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
|
@ -51,7 +51,28 @@ class PresenceIndicator : View {
|
|||
}
|
||||
}
|
||||
|
||||
fun setStatus(contact: Contact?) {
|
||||
val status = contact?.shownStatus?.takeIf {
|
||||
contact.account?.isOnlineAndConnected == true
|
||||
}
|
||||
if (status != this.status) {
|
||||
this.status = status
|
||||
invalidate()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
enabled = (context as? XmppActivity)
|
||||
?.xmppConnectionService?.preferences
|
||||
?.getBoolean("show_contact_status", context.resources.getBoolean(R.bool.show_contact_status)) ?: false
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
if (!enabled) {
|
||||
return
|
||||
}
|
||||
|
||||
super.onDraw(canvas)
|
||||
|
||||
val color: Int? = UIHelper.getColorForStatus(status);
|
||||
|
|
|
@ -41,6 +41,7 @@ public final class CryptoHelper {
|
|||
private static final int PW_LENGTH = 12;
|
||||
private static final char[] VOWELS = "aeiou".toCharArray();
|
||||
private static final char[] CONSONANTS = "bcfghjklmnpqrstvwxyz".toCharArray();
|
||||
public static final String FILETRANSFER = "?FILETRANSFERv1:";
|
||||
private final static char[] hexArray = "0123456789abcdef".toCharArray();
|
||||
|
||||
public static String bytesToHex(byte[] bytes) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.siacs.conversations.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.format.DateFormat;
|
||||
import android.text.format.DateUtils;
|
||||
|
@ -204,26 +205,60 @@ public class UIHelper {
|
|||
.get(Calendar.DAY_OF_YEAR);
|
||||
}
|
||||
|
||||
public static String lastseen(Context context, boolean active, long time) {
|
||||
public static String lastseen(Context context, boolean active, long time, boolean shortText) {
|
||||
long difference = (System.currentTimeMillis() - time) / 1000;
|
||||
if (active) {
|
||||
return context.getString(R.string.online_right_now);
|
||||
if (shortText) {
|
||||
return context.getString(R.string.online_right_now_short);
|
||||
} else {
|
||||
return context.getString(R.string.online_right_now);
|
||||
}
|
||||
} else if (difference < 60) {
|
||||
return context.getString(R.string.last_seen_now);
|
||||
if (shortText) {
|
||||
return context.getString(R.string.last_seen_now_short);
|
||||
} else {
|
||||
return context.getString(R.string.last_seen_now);
|
||||
}
|
||||
} else if (difference < 60 * 2) {
|
||||
return context.getString(R.string.last_seen_min);
|
||||
if (shortText) {
|
||||
return context.getString(R.string.last_seen_min_short);
|
||||
} else {
|
||||
return context.getString(R.string.last_seen_min);
|
||||
}
|
||||
} else if (difference < 60 * 60) {
|
||||
return context.getString(R.string.last_seen_mins, Math.round(difference / 60.0));
|
||||
if (shortText) {
|
||||
return context.getString(R.string.last_seen_mins_short, Math.round(difference / 60.0));
|
||||
} else {
|
||||
return context.getString(R.string.last_seen_mins, Math.round(difference / 60.0));
|
||||
}
|
||||
} else if (difference < 60 * 60 * 2) {
|
||||
return context.getString(R.string.last_seen_hour);
|
||||
if (shortText) {
|
||||
return context.getString(R.string.last_seen_hour_short);
|
||||
} else {
|
||||
return context.getString(R.string.last_seen_hour);
|
||||
}
|
||||
} else if (difference < 60 * 60 * 24) {
|
||||
return context.getString(R.string.last_seen_hours,
|
||||
Math.round(difference / (60.0 * 60.0)));
|
||||
if (shortText) {
|
||||
return context.getString(R.string.last_seen_hours_short,
|
||||
Math.round(difference / (60.0 * 60.0)));
|
||||
} else {
|
||||
return context.getString(R.string.last_seen_hours,
|
||||
Math.round(difference / (60.0 * 60.0)));
|
||||
}
|
||||
} else if (difference < 60 * 60 * 48) {
|
||||
return context.getString(R.string.last_seen_day);
|
||||
if (shortText) {
|
||||
return context.getString(R.string.last_seen_day_short);
|
||||
} else {
|
||||
return context.getString(R.string.last_seen_day);
|
||||
}
|
||||
} else {
|
||||
return context.getString(R.string.last_seen_days,
|
||||
Math.round(difference / (60.0 * 60.0 * 24.0)));
|
||||
if (shortText) {
|
||||
return context.getString(R.string.last_seen_days_short,
|
||||
Math.round(difference / (60.0 * 60.0 * 24.0)));
|
||||
} else {
|
||||
return context.getString(R.string.last_seen_days,
|
||||
Math.round(difference / (60.0 * 60.0 * 24.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,6 +266,23 @@ public class UIHelper {
|
|||
return getColorForName(name, false);
|
||||
}
|
||||
|
||||
public static int getAccountColor(Context context, Jid accountJid) {
|
||||
SharedPreferences prefs = context.getSharedPreferences("accountColorsPrefs", Context.MODE_PRIVATE);
|
||||
String name = accountJid.asBareJid().toEscapedString();
|
||||
int overrideColor = prefs.getInt(name, -1);
|
||||
|
||||
if (overrideColor != -1) {
|
||||
return overrideColor;
|
||||
} else {
|
||||
return getColorForName(name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void overrideAccountColor(Context context, String accountName, int color) {
|
||||
SharedPreferences prefs = context.getSharedPreferences("accountColorsPrefs", Context.MODE_PRIVATE);
|
||||
prefs.edit().putInt(accountName, color).apply();
|
||||
}
|
||||
|
||||
public static int getColorForName(String name, boolean safe) {
|
||||
if (Config.XEP_0392) {
|
||||
return XEP0392Helper.rgbFromNick(name);
|
||||
|
@ -292,6 +344,8 @@ public class UIHelper {
|
|||
return new Pair<>(context.getString(R.string.file_deleted), true);
|
||||
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) {
|
||||
return new Pair<>(context.getString(R.string.pgp_message), true);
|
||||
} else if (message.getEncryption() == Message.ENCRYPTION_OTR) {
|
||||
return new Pair<>(context.getString(R.string.otr_message), true);
|
||||
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
|
||||
return new Pair<>(context.getString(R.string.decryption_failed), true);
|
||||
} else if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL_NOT_FOR_THIS_DEVICE) {
|
||||
|
@ -557,6 +611,8 @@ public class UIHelper {
|
|||
} else {
|
||||
return context.getString(R.string.send_message_to_x, conversation.getName());
|
||||
}
|
||||
case Message.ENCRYPTION_OTR:
|
||||
return context.getString(R.string.send_otr_message);
|
||||
case Message.ENCRYPTION_AXOLOTL:
|
||||
AxolotlService axolotlService = conversation.getAccount().getAxolotlService();
|
||||
if (axolotlService != null && axolotlService.trustedSessionVerified(conversation)) {
|
||||
|
|