1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-14 13:05:02 -05:00
Commit Graph

197 Commits

Author SHA1 Message Date
Steven Luo
bce2523f98 Fix auto-reconnect
The current auto-reconnection implementation will only try reconnecting
once, immediately after the server is disconnected.  This will of course
almost always fail if the network is down or otherwise unavailable, so
as it stands, enabling auto-reconnect isn't particularly useful.

This patch implements multiple retries for auto-reconnect, with the
frequency of retries controlled by a preference.  The Android alarm
infrastructure is used to schedule reconnection attempts; if the phone
misses a scheduled attempt while it's asleep, the reconnection will be
attempted the next time the phone wakes up.
2011-06-29 20:34:55 +02:00
Steven Luo
e7651315df Make reconnections actually work
At the moment, the reconnect feature is somewhat glitchy, popping up
multiple reconnect prompts even if a reconnection succeeds, and
occasionally causing crashes.  A successful reconnection results in the
conversation history being cleared, which is an annoying outcome when
connected over an unreliable network.

This patch does the following:

* Keep track of whether a reconnect dialog is active, to prevent
  multiple dialogs from opening.
* Introduce a new field to the Server object, mayReconnect, which is
  used to keep track of whether a reconnection should be attempted in
  the event of a disconnection.  It's set to "true" when we connect to a
  server, and "false" if the user asks for a disconnection.
* Prevent the clearing of active conversations and conversation history
  on disconnect, unless the user specifically asked for the disconnect.
* Keep the IRCService running even when no servers are connected, unless
  the user has disconnected from all servers herself.  This is needed
  for reliable auto-reconnects (see next patch), but has the side effect
  of keeping conversation history around even if the activity isn't open
  when a disconnect happens.
2011-06-29 20:34:52 +02:00
Steven Luo
a69fafc4dd PircBot: Gracefully handle disposing of the PircBot before I/O threads are started 2011-06-29 20:34:50 +02:00
Sebastian Kaspari
ae871f8a1f AddChannelActivity: Always set cursor at the end of the input field 2011-06-13 22:48:25 +02:00
remram44
8fea644007 French translation updated 2011-06-11 13:58:33 +02:00
remram44
938577128d Internationalization of Authentication GUI 2011-06-11 13:56:42 +02:00
Sebastian Kaspari
6e48a29b34 Display message at the beginning and end of the server login 2011-06-10 22:29:17 +02:00
Sebastian Kaspari
2f19eb8032 (Authentication) Implementation of authentication via SASL on connect 2011-06-10 22:03:19 +02:00
Sebastian Kaspari
4739d292c5 Add Base64 helper class (Written by Robert Harder) - Needed for SASL implementation 2011-06-10 21:42:06 +02:00
Sebastian Kaspari
d9d1c4aba8 (Authentication) Implementation of authentication via NickServ on connect 2011-06-10 21:36:14 +02:00
Sebastian Kaspari
2fde7559e3 (Authentication) GUI for NickServ and SASL 2011-06-10 21:35:23 +02:00
Jonas Häggqvist
d4e22f3846 Ignore status characters in front of nicks for the purpose of nick completion 2011-06-09 20:33:35 +02:00
Sebastian Kaspari
7c7ce7cc41 channeladd.xml view: Replace tabs with white spaces 2011-06-09 00:02:34 +02:00
Sebastian Kaspari
5fa92b9cf4 ConversationClickListener: Remove unused imports 2011-06-08 23:17:59 +02:00
Sebastian Kaspari
14ed6f7f2b IRCService: Code cleanup and suppress warnings 2011-06-08 23:17:31 +02:00
Sebastian Kaspari
2350e9743a DeckAdapter: Remove unused imports 2011-06-08 23:16:49 +02:00
Sebastian Kaspari
1a820d9609 ConversationActivity: Code cleanup, remove unused imports and unused code 2011-06-08 23:16:27 +02:00
Steven Luo
aaf3f3e332 Prevent race between IRCConnection dispose() and onDisconnect() when quitting
When the user asks for a disconnect from the ConversationActivity, there
is a race between the IRCConnection, which is waiting for the server to
acknowledge the QUIT before calling onDisconnect(), and the IRCService,
which will invoke dispose() on the IRCConnection when
checkServiceStatus() is called during the activity shutdown.  If the
dispose() wins, the thread running the onDisconnect() is terminated,
leading to the cleanup being unfinished.  This causes the disconnect
notification to be unreliable, and can result in the list of servers in
the ongoing notification to be out of sync with reality.

To fix this, introduce a new field isQuitting to the IRCConnection,
which is set to true when quitServer() is called and cleared once
onDisconnect() has finished.  If dispose() is called while isQuitting is
set, it sets disposeRequested instead of doing the dispose itself, and
onDisconnect() will call through to super.dispose() once it's finished.

Note that this requires a change to PircBot to allow the overriding of
quitServer(String message), which is declared final upstream.
2011-06-08 23:11:29 +02:00
Steven Luo
a9621b66b4 Bugfix nick completion / autocorrect
Use clearComposingText() when inserting nick completion to ensure
that autocorrect doesn't try to replace the completed nick on the next
keypress; thanks Thomas Martitz for pointing out the bug
2011-06-08 23:11:28 +02:00
Steven Luo
dc95472aaf Fix broadcast on topic change 2011-06-08 23:11:28 +02:00
Steven Luo
06e0849c17 Bugfix notification system
* If there's a new message notification, keep showing the "New messages
   in" content text, even after a disconnect notification.
 * Handle the case of a channel/query name duplicated between two or more
   connections more gracefully in new message notifications
 * Fix a race in updating notifications
2011-06-08 23:11:28 +02:00
Steven Luo
35609e5529 IME behavior changes for the ConversationActivity
(1) Let full-screen IMEs wrap the text into multiple lines instead of
making the text scroll off the screen.

(2) Provide a preference to let the user choose whether or not to enable
autocorrection of typed text.

(3) Provide a preference to let the user choose whether or not to enable
autocapitalization of sentences.  Note that even when this is enabled,
autocapitalization will only happen if the option is also enabled in the
IME.

(4) In landscape mode only, don't replace the Enter key with a Send
button, to make it harder to accidentally send a message.  (We can't do
this in portrait, because we would be left without any send button at
all -- perhaps the input line should be changed to be similar to the
text message application, which has a send button next to the input
line?)
2011-06-08 23:11:28 +02:00
Steven Luo
aa355c4283 Rewrite onKey handling for the ConversationActivity input line
The current method of supplying an onKey handler for the input line
(having the activity implement OnKeyListener) is somewhat unusual -- the
documentation recommends creating an anonymous inner class to pass to
setOnKeyListener().  Do this, while refactoring the code to make it
somewhat more readable and removing some instances of code duplication.
2011-06-08 23:11:28 +02:00
Steven Luo
91d211c51d Make the conversation history size a configurable preference 2011-06-08 23:11:28 +02:00
Steven Luo
61960c9add Overhaul notifications system
Features:
* Now displays the number of mentions that the user has not seen in the
  notification.
* When no mentions are outstanding, display which servers the user is
  connected to, not the last message.
* When more than one mention is outstanding, display the names of the
  conversations with new mentions, not just the last message received.
* Notifications of mentions are suppressed if you're in the conversation
  at the time of the mention.
* Notifications of mentions automatically clear when you bring up the
  conversation.
* Vibrate notifications now generate the user's chosen default vibrate
  pattern, not a hard-coded one.
* Add ticker text to the notification that's displayed when the IRCService
  goes into the foreground, instead of displaying a blank ticker.

To allow for all of this, the implementation moves most of the details
of generating the notification text into the IRCService, which now
exposes addNewMention() and notifyConnected()/notifyDisconnected()
methods instead of the lower-level updateNotification().
2011-06-08 23:11:28 +02:00
Steven Luo
09fedc6975 Include channel topic in the displayed conversation title 2011-06-08 23:11:28 +02:00
Steven Luo
9a8bf44d63 Do something sane for private messages where the sender is our nick
As of now, private messages where the sender is our nick end up in
a query window targeted at us.  Show these messages in the query window
of the target instead, which is probably what we want.

This is useful for use with irssi proxy, which will send messages sent
by another client attached to the proxy to us in this way.

(Note that this patch makes a change to PircBot to pass the target of a
private message to the onPrivateMessage handler.)
2011-06-08 23:11:28 +02:00
Steven Luo
159cb8195d Remember switched conversations across screen orientation changes
As of now, the activity does not remember whether a conversation is
switched across configuration changes (such as screen rotations).  Fix
this by adding onSaveInstanceState() and onRestoreInstanceState()
callbacks in the activity to pass this information to the new instance.

To make the implementation of this simpler, all code to configure the
MessageListView, which was duplicated in several places in the codebase,
has been moved to the MessageListView's constructor.

While we're at it, make the padding setting independent of screen
density instead of specifying in fixed pixels (equivalent to specifying
the value in dp instead of px), and increase the padding for switched
views.  This ensures that message text isn't obscured by the gradient at
the edges of the ConversationGallery, which started happening when we
began caching MessageListViews in the DeckAdapter.
2011-06-08 23:11:28 +02:00
Steven Luo
c9ed28767d Actually deliver actions to existing private message windows 2011-06-08 23:11:28 +02:00
Steven Luo
ae1b574997 Dispose of IRCConnections properly to avoid leaking IRCService objects
Each IRCConnection starts an input thread and an output thread when
created; if not stopped, these threads continue to hold the IRCService,
resulting in a leak when the service is stopped.  Fix this by using
PircBot's dispose() to stop the threads when disposing of the
IRCConnection.
2011-06-08 23:11:28 +02:00
Steven Luo
ffe73b7c9f Hold MessageListAdapters and MessageListViews in DeckAdapter to avoid leaks
There are at least two significant memory leaks in Yaaic, which cause
the client to force close after a few hours with an
OutOfMemoryException:

(1) The IRCService holds Conversation objects, which contain a
MessageListAdapter, which have references to the ConversationActivity
context.  This causes Activity contexts to outlast the Activity, causing
a significant memory leak over time.

Fix this by holding the MessageListAdapter in the ConversationActivity's
DeckAdapter instead of in the Conversation objects.  The DeckAdapter's
lifecycle matches that of the Activity, so this prevents the leak.

(2) Every call to DeckAdapter.getView()/renderConversation() creates a
new MessageListView and adds it to the deck.  But adding the view to
the deck causes the deck to take a reference to the view, leaking the
MessageListView until the Activity is finished.  (This has the effect of
exacerbating the first leak, since the Activity context holds a
reference to the deck.)

Fix this leak by caching MessageListViews in the DeckAdapter, and
returning an existing MessageListView for a Conversation in getView() if
one already exists.
2011-06-08 23:11:28 +02:00
Steven Luo
c4504be725 Notify the user on receipt of all private messages, not just ones with nick mentions
You'd rarely use someone's nick in a privmsg with them, and this matches
the behavior of other clients.
2011-06-08 23:11:28 +02:00
Steven Luo
464430ee74 Add FLAG_ACTIVITY_NEW_TASK to notification intents
According to
http://developer.android.com/reference/android/app/Notification.html#contentIntent
we should do this.  Suppresses a log message when tapping on our status
bar notification.
2011-06-08 23:11:27 +02:00
Steven Luo
caf3272f71 Ensure privmsg with mention of user's nick opens new query when appropriate
If a private message that should open a new query window contains a
mention of the user's nick, the expected new window fails to open
because the isMentioned() path tries to use
server.getConversation().setStatus(), and server.getConversation() is
null in this case.  Fix this by moving the attempt to highlight the
window to a point where a conversation is guaranteed to exist.
2011-06-08 23:11:27 +02:00
Steven Luo
f1b57c9e25 Don't scroll to a conversation in onCreate() unless it was previously selected
This has two advantages:
(1) The activity remembers which conversation was last selected if it's
    destroyed (e.g. via the Back button) and then recreated with the connection
    still running.
(2) It prevents onCreate() from clearing all the mentioned notifications for
    the conversations in that activity.
2011-06-08 23:11:27 +02:00
Sebastian Kaspari
b4493b81a4 Add danish translation (By rasher) 2011-05-06 17:18:20 +02:00
Matt Mastracci
ac4fa4a104 Add _ to ident chars, update comment 2011-04-24 20:53:40 -06:00
remram44
322c4e0ac8 French translation updated 2011-04-17 05:36:37 +08:00
Sebastian Kaspari
c20cd695e6 Updated version number: Yaaic 0.8 2011-04-15 22:00:55 +02:00
Sebastian Kaspari
1e5f016012 DeckAdapter: getView(): If no conversation is available (anymore) for the requested position, return an empty TextView. Fixes #56. 2011-04-15 20:39:33 +02:00
Sebastian Kaspari
50a6047edd On own nick change: Display message in server info window (Your are now known as ...). Fixes #51. 2011-04-15 20:30:46 +02:00
Sebastian Kaspari
c6dbe8cc18 Remove color codes if the mirc colors option is off. Fixes #57 2011-04-14 22:53:38 +02:00
Sebastian Kaspari
86e0812741 Ooops, fix @author javadoc tag in classes: MircColors, Smilies 2011-04-13 00:14:40 +02:00
Sebastian Kaspari
4e266e1bb7 ConversationActivity: onCreate(): Check if server is returned by getServerById() - Fixes #55 2011-04-12 23:44:39 +02:00
Sebastian Kaspari
9387a02068 ConversationActivity: onStatusUpdate(): Check if service is already connected and initialized - Fixes #54 2011-04-12 23:37:11 +02:00
Sebastian Kaspari
ded6485f6b Database: isTitleUsed(): Escape server title (SQLiteException) - Fixes #53 2011-04-12 23:30:00 +02:00
Sebastian Kaspari
b3fd4157dc JoinActivity: Set cursor position 2011-04-12 23:05:09 +02:00
Sebastian Kaspari
dd07bd358a Bugfix: Only automatically change nickname on server code 433 if not already registered with server 2011-04-12 22:23:51 +02:00
Sebastian Kaspari
aa5a081c02 Bugfix: Remember new nickname on auto nickname change (433: Nickname is already in use) 2011-04-12 22:07:09 +02:00
José Antonio Pérez Sánchez
2b3ce5132a fixed missing angle in closing tag 2011-03-30 16:07:37 +02:00
Sebastian Kaspari
dbf7983eec Updated turkish translation 2011-03-27 22:23:39 +02:00
Sebastian Kaspari
b798d4dacb Setting mIRC colors off by default 2011-03-27 20:02:42 +02:00
Sebastian Kaspari
591dc8f763 MircColors/Smilies: Code formatting and documentation 2011-03-27 20:02:06 +02:00
Sebastian Kaspari
673598ad31 Added licence header to new files 2011-03-27 19:53:05 +02:00
liato
ac1a07894f Add support for graphical smilies in chat. 2011-03-27 19:51:47 +02:00
liato
92a1e93bc1 Use TextUtils.concat to concatenate 2011-03-27 19:43:51 +02:00
liato
7490cdb38c Change settings text for mirc colors. 2011-03-27 19:43:34 +02:00
liato
eea82e506f Rename Colors class and methods. 2011-03-27 19:42:47 +02:00
liato
2189d2c05f Remove tagsoup dependency. Improve mIRC color code parsing speed. 2011-03-27 19:42:05 +02:00
liato
7c4abe0c9c Render colors correctly in topics and other foreground colored places. 2011-03-27 19:41:13 +02:00
liato
59c70a750d Fix mirc color bug by changing the tagsoup schema and making the font tag restartable. 2011-03-27 19:40:47 +02:00
liato
624f8c5014 Add support for mIRC colors. 2011-03-27 19:40:26 +02:00
liato
e612d3b09c Render html in messages to spannables. 2011-03-27 19:37:35 +02:00
Sebastian Kaspari
bd19398d65 Added turkish translation (Thanks to Hasan Kiran) 2011-03-27 18:21:22 +02:00
Sebastian Kaspari
ba9f6c6544 Increment version number (0.7) 2011-03-27 17:28:22 +02:00
liato
1f9c8efcca Fix nullpointerexception. 2011-03-27 17:16:38 +02:00
liato
1ebea8f7d6 Use integer division to calculate gallert item width. 2011-03-27 17:13:09 +02:00
liato
b49ead73ad Fix width issues in gallery. 2011-03-27 17:10:54 +02:00
Sebastian Kaspari
7563437343 Server: Fix typo in addConversation() 2011-03-15 23:59:49 +01:00
Sebastian Kaspari
78a47ca17b dp/sp: More adjustments 2011-03-15 22:11:55 +01:00
Sebastian Kaspari
214a786175 useritem.xml: Use dp for padding and sp for fonts 2011-03-15 21:31:53 +01:00
Sebastian Kaspari
f44aea0d5e channelitem.xml: Use dp for padding and sp for fonts 2011-03-15 21:31:53 +01:00
Sebastian Kaspari
23ed9c3343 aliasitem.xml: Use dp for padding and sp for fonts 2011-03-15 21:31:53 +01:00
Sebastian Kaspari
4713c22655 useritem.xml: Replace px by sp/dp 2011-03-15 21:31:53 +01:00
Sebastian Kaspari
7e559f288e user.xml: Replace px by sp/dp 2011-03-15 21:31:53 +01:00
Sebastian Kaspari
f71e89e1ee serveritem.xml: Replace px by sp/dp 2011-03-15 21:31:53 +01:00
Sebastian Kaspari
3e188a0445 serveradd.xml: Replace px by sp/dp 2011-03-15 21:31:52 +01:00
Sebastian Kaspari
7d4194a1ea rounded.xml: Identation 2011-03-15 21:31:52 +01:00
Sebastian Kaspari
f46887d9ee message.xml: Replace px by sp/dp 2011-03-15 21:31:52 +01:00
Sebastian Kaspari
f5b29ef01a join.xml: Replace px by sp/dp 2011-03-15 21:31:52 +01:00
Sebastian Kaspari
22fb895ad3 conversations.xml: Replace px by sp/dp 2011-03-15 21:31:52 +01:00
Sebastian Kaspari
c06b6b7296 commanditem.xml: Replace px by sp/dp 2011-03-15 21:31:52 +01:00
Sebastian Kaspari
533a8ec97b commandadd.xml: Replace px by sp/dp 2011-03-15 21:31:52 +01:00
Sebastian Kaspari
acb7f0d100 channelitem.xml: Replace px by sp/dp 2011-03-15 21:31:51 +01:00
Sebastian Kaspari
59755b376c channeldialog.xml: Replace px by sp/dp 2011-03-15 21:31:51 +01:00
Sebastian Kaspari
3156e3b704 channeladd.xml: Replace px by sp/dp 2011-03-15 21:31:51 +01:00
Sebastian Kaspari
836e9ee6cd aliasitem.xml: Replace px by sp/dp 2011-03-15 21:31:51 +01:00
Sebastian Kaspari
7ba3303892 aliasadd.xml: Replace px by sp/dp 2011-03-15 21:31:51 +01:00
Sebastian Kaspari
e486d34189 Modify dp settings in about.xml 2011-03-15 21:31:51 +01:00
Sebastian Kaspari
1b5f8ef0e9 addserveritem.xml: Replace px by sp/dp 2011-03-15 21:31:51 +01:00
Sebastian Kaspari
ff6abb7828 actionitem.xml: Replace px by sp/dp 2011-03-15 21:31:50 +01:00
Sebastian Kaspari
0dc194cefc about.xml: Replace px by sp/dp 2011-03-15 21:31:50 +01:00
Sebastian Kaspari
4262cbcd15 New Setting: Show notices in server window. Closes #47. 2011-03-15 20:53:47 +01:00
Sebastian Kaspari
b855b7ea92 Hide join/part setting now hides quit messages too 2011-03-15 20:42:35 +01:00
Sebastian Kaspari
49f067cd67 IRCConnection: Formatting 2011-03-15 20:12:12 +01:00
Sebastian Kaspari
488924546f Fix unit test MessageTest after refactoring 2011-03-14 22:32:28 +01:00
Sebastian Kaspari
95f3c4b255 Some more simple refactorings 2011-03-14 22:15:13 +01:00
Sebastian Kaspari
1c8076ec53 Refactoring of Message class 2011-03-11 22:07:39 +01:00
liato
a3ebf8d5d0 Handle auto joins after the user has registered with the server. 2011-03-09 08:54:28 +01:00
Sebastian Kaspari
84d45c5f5c Refactor ConversationSwitcher: onDraw() - May throw ConcurrentModificationException 2011-03-06 14:21:58 +01:00