Skip to content

Commit

Permalink
[sociald] Add Google Signon sync adaptor. Contributes to JB#16337
Browse files Browse the repository at this point in the history
This commit adds a sync adapter which periodically forces a refresh
of the Google account credentials, to avoid the situation where
user interaction (via webview) is required to be able to continue
to use the account.

Contributes to JB#16337
  • Loading branch information
Chris Adams committed Apr 16, 2014
1 parent 4edb44a commit f5b8da1
Show file tree
Hide file tree
Showing 10 changed files with 485 additions and 1 deletion.
23 changes: 23 additions & 0 deletions rpm/sociald.spec
Expand Up @@ -262,6 +262,29 @@ rm -f /home/nemo/.cache/msyncd/sync/google.Contacts.xml
systemctl-user restart msyncd.service || :


%package google-signon
Summary: Provides signon credentials refreshing with Google
License: TBD
Group: System/Libraries
BuildRequires: qt5-qttools-linguist
Requires: %{name} = %{version}-%{release}

%description google-signon
Provides signon credentials refreshing with Google

%files google-signon
/usr/lib/buteo-plugins-qt5/libgoogle-signon-client.so
%config %{_sysconfdir}/buteo/profiles/client/google-signon.xml
%config %{_sysconfdir}/buteo/profiles/sync/google.Signon.xml

%pre google-signon
rm -f /home/nemo/.cache/msyncd/sync/client/google-signon.xml
rm -f /home/nemo/.cache/msyncd/sync/google.Signon.xml

%post google-signon
systemctl-user restart msyncd.service || :



%package twitter-notifications
Summary: Provides notification synchronisation with Twitter
Expand Down
4 changes: 4 additions & 0 deletions src/google/google-signon/google-signon.pri
@@ -0,0 +1,4 @@
SOURCES += $$PWD/googlesignonsyncadaptor.cpp
HEADERS += $$PWD/googlesignonsyncadaptor.h
INCLUDEPATH += $$PWD

27 changes: 27 additions & 0 deletions src/google/google-signon/google-signon.pro
@@ -0,0 +1,27 @@
TEMPLATE = lib

TARGET = google-signon-client
VERSION = 0.0.1
CONFIG += plugin

include($$PWD/../../common.pri)
include($$PWD/../google-common.pri)
include($$PWD/google-signon.pri)

target.path += /usr/lib/buteo-plugins-qt5
google_signon_sync_profile.path = /etc/buteo/profiles/sync
google_signon_sync_profile.files = $$PWD/google.Signon.xml
google_signon_client_plugin_xml.path = /etc/buteo/profiles/client
google_signon_client_plugin_xml.files = $$PWD/google-signon.xml

HEADERS += googlesignonplugin.h
SOURCES += googlesignonplugin.cpp

OTHER_FILES += \
google_signon_sync_profile.files \
google_signon_client_plugin_xml.files

INSTALLS += \
target \
google_signon_sync_profile \
google_signon_client_plugin_xml
4 changes: 4 additions & 0 deletions src/google/google-signon/google-signon.xml
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<profile name="google-signon" type="client" >
<field name="Sync Direction" />
</profile>
15 changes: 15 additions & 0 deletions src/google/google-signon/google.Signon.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<profile name="google.Signon" type="sync" >
<key name="category" value="signon" />
<key name="enabled" value="true" />
<key name="use_accounts" value="false" />
<key name="destinationtype" value="online" />
<key name="hidden" value="true" />
<key name="displayname" value="Google Signon"/>

<schedule enabled="false" interval="90" days="1,2,3,4,5,6,7" syncconfiguredtime="" time="" />

<profile name="google-signon" type="client" >
<key name="Sync Direction" value="from-remote" />
</profile>
</profile>
40 changes: 40 additions & 0 deletions src/google/google-signon/googlesignonplugin.cpp
@@ -0,0 +1,40 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Chris Adams <chris.adams@jolla.com>
**
****************************************************************************/

#include "googlesignonplugin.h"
#include "googlesignonsyncadaptor.h"
#include "socialnetworksyncadaptor.h"

extern "C" GoogleSignonPlugin* createPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *callbackInterface)
{
return new GoogleSignonPlugin(pluginName, profile, callbackInterface);
}

extern "C" void destroyPlugin(GoogleSignonPlugin* plugin)
{
delete plugin;
}

GoogleSignonPlugin::GoogleSignonPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *callbackInterface)
: SocialdButeoPlugin(pluginName, profile, callbackInterface,
QStringLiteral("google"),
SocialNetworkSyncAdaptor::dataTypeName(SocialNetworkSyncAdaptor::Signon))
{
}

GoogleSignonPlugin::~GoogleSignonPlugin()
{
}

SocialNetworkSyncAdaptor *GoogleSignonPlugin::createSocialNetworkSyncAdaptor()
{
return new GoogleSignonSyncAdaptor(this);
}
34 changes: 34 additions & 0 deletions src/google/google-signon/googlesignonplugin.h
@@ -0,0 +1,34 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Chris Adams <chris.adams@jolla.com>
**
****************************************************************************/

#ifndef GOOGLESIGNONPLUGIN_H
#define GOOGLESIGNONPLUGIN_H

#include "socialdbuteoplugin.h"
#include <ClientPlugin.h>

class GoogleSignonPlugin : public SocialdButeoPlugin
{
Q_OBJECT

public:
GoogleSignonPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *cbInterface);
~GoogleSignonPlugin();

protected:
SocialNetworkSyncAdaptor *createSocialNetworkSyncAdaptor();
};

extern "C" GoogleSignonPlugin* createPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *cbInterface);

extern "C" void destroyPlugin(GoogleSignonPlugin* client);

#endif // GOOGLESIGNONPLUGIN_H

0 comments on commit f5b8da1

Please sign in to comment.