1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2025-01-08 04:08:19 -05:00

Bugfix: Do not try to connect on resume

This commit is contained in:
Sebastian Kaspari 2010-03-21 15:26:11 +01:00
parent 9fa17f6a35
commit 8bfe1d1a75
4 changed files with 6 additions and 2 deletions

View File

@ -296,6 +296,7 @@ public class Server
return R.drawable.connected;
case Status.DISCONNECTED:
return R.drawable.disconnected;
case Status.PRE_CONNECTING:
case Status.CONNECTING:
return R.drawable.connecting;
}

View File

@ -29,4 +29,5 @@ public class Status {
public static final int DISCONNECTED = 0;
public static final int CONNECTING = 1;
public static final int CONNECTED = 2;
public static final int PRE_CONNECTING = 3;
}

View File

@ -59,6 +59,7 @@ import org.yaaic.model.Broadcast;
import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import org.yaaic.model.Server;
import org.yaaic.model.Status;
import org.yaaic.receiver.ConversationReceiver;
import org.yaaic.receiver.ServerReceiver;
@ -170,7 +171,8 @@ public class ConversationActivity extends Activity implements ServiceConnection,
this.binder = (IRCBinder) service;
// connect to irc server if connect has been requested
if (!server.isConnected() && getIntent().hasExtra("connect")) {
if (server.getStatus() == Status.PRE_CONNECTING && getIntent().hasExtra("connect")) {
server.setStatus(Status.CONNECTING);
binder.connect(server);
}
}

View File

@ -137,7 +137,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
Intent intent = new Intent(this, ConversationActivity.class);
if (server.getStatus() == Status.DISCONNECTED) {
server.setStatus(Status.CONNECTING);
server.setStatus(Status.PRE_CONNECTING);
intent.putExtra("connect", true);
}