2 * Copyright (C) 2010 Felix Bechstein
4 * This file is part of WebSMS.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free Software
8 * Foundation; either version 3 of the License, or (at your option) any later
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License along with
17 * this program; If not, see <http://www.gnu.org/licenses/>.
19 package de
.ub0r
.android
.websms
.connector
.gmx
;
21 import android
.content
.Context
;
22 import android
.content
.Intent
;
23 import android
.content
.SharedPreferences
;
24 import android
.preference
.PreferenceManager
;
25 import android
.util
.Log
;
26 import de
.ub0r
.android
.andGMXsms
.R
;
27 import de
.ub0r
.android
.websms
.connector
.common
.CommandReceiver
;
28 import de
.ub0r
.android
.websms
.connector
.common
.ConnectorSpec
;
29 import de
.ub0r
.android
.websms
.connector
.common
.WebSMSException
;
30 import de
.ub0r
.android
.websms
.connector
.common
.ConnectorSpec
.SubConnectorSpec
;
33 * Receives commands coming as broadcast from WebSMS.
37 public class CommandReceiverGMX
extends CommandReceiver
{
38 /** Tag for debug output. */
39 private static final String TAG
= "WebSMS.GMX";
41 /** Preferences intent action. */
42 private static final String PREFS_INTENT_ACTION
= "de.ub0r.android."
43 + "websms.connectors.gmx.PREFS";
49 public final ConnectorSpec
initSpec(final Context context
) {
50 final String name
= context
.getString(R
.string
.connector_gmx_name
);
51 ConnectorSpec c
= new ConnectorSpec(TAG
, name
);
53 context
.getString(R
.string
.connector_gmx_author
));
55 c
.setPrefsIntent(PREFS_INTENT_ACTION
);
56 c
.setPrefsTitle(context
.getString(R
.string
.connector_gmx_preferences
));
57 c
.setCapabilities(ConnectorSpec
.CAPABILITIES_BOOSTRAP
58 | ConnectorSpec
.CAPABILITIES_UPDATE
59 | ConnectorSpec
.CAPABILITIES_SEND
);
60 c
.addSubConnector(TAG
, c
.getName(),
61 SubConnectorSpec
.FEATURE_MULTIRECIPIENTS
62 | SubConnectorSpec
.FEATURE_CUSTOMSENDER
63 | SubConnectorSpec
.FEATURE_SENDLATER
);
71 public final ConnectorSpec
updateSpec(final Context context
,
72 final ConnectorSpec connectorSpec
) {
73 final SharedPreferences p
= PreferenceManager
74 .getDefaultSharedPreferences(context
);
75 if (p
.getBoolean(Preferences
.PREFS_ENABLED
, false)) {
76 if (p
.getString(Preferences
.PREFS_MAIL
, "").length() > 0
77 && p
.getString(Preferences
.PREFS_PASSWORD
, "") // .
79 connectorSpec
.setReady();
81 connectorSpec
.setStatus(ConnectorSpec
.STATUS_ENABLED
);
84 connectorSpec
.setStatus(ConnectorSpec
.STATUS_INACTIVE
);
93 protected final void doBootstrap(final Intent intent
)
94 throws WebSMSException
{
95 // do nothing by default
96 Log
.d(TAG
, "bootstrap");
103 protected final void doUpdate(final Intent intent
) throws WebSMSException
{
104 // do nothing by default
105 Log
.d(TAG
, "update");
112 protected final void doSend(final Intent intent
) throws WebSMSException
{
113 // do nothing by default