Bug 72263 - Add Ubuntu Online Accounts support
Summary: Add Ubuntu Online Accounts support
Alias: None
Product: SyncEvolution
Classification: Unclassified
Component: SyncEvolution (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Patrick Ohly
QA Contact:
Depends on:
Reported: 2013-12-03 12:53 UTC by Alberto Mardegan
Modified: 2014-01-08 14:53 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Patch for UOA support (14.68 KB, text/plain)
2013-12-03 12:53 UTC, Alberto Mardegan

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Mardegan 2013-12-03 12:53:19 UTC
Created attachment 90152 [details]
Patch for UOA support

Here's a patch which adds support to Ubuntu Online Accounts.

Please notice the change at line 170 in signon.cpp: without that, I couldn't get the code to build. Let me know if that is fine, or if I should remove that chunk or if you prefer to have it submitted as a separate patch.
Comment 1 Patrick Ohly 2013-12-04 07:10:32 UTC
(In reply to comment #0)
> Please notice the change at line 170 in signon.cpp: without that, I couldn't
> get the code to build. Let me know if that is fine, or if I should remove
> that chunk or if you prefer to have it submitted as a separate patch.

I'll submit it separately. It'll potentially pass NULL for the %s which printf tends to catch, I usually just don't want to rely on that.

What kind of compiler error did you get with the old code?

The rest of the patch looks good, thanks.
Comment 2 Patrick Ohly 2013-12-04 07:23:04 UTC
One question: do the instructions in the README apply also to UOA?

At least one detail would be different: username has to use "uoa:" instead of "gsso:". I wonder whether we should let both backends use the same "signon:" prefix and never allow both of them to be active at the same time (as it is now anyway), to minimize confusion for users.
Comment 3 Patrick Ohly 2013-12-04 09:08:56 UTC
Which version of libsignon-glib and libaccounts-glib are needed by the code?

I tried compiling on Ubuntu Quantal, my current build platform for SyncEvolution binaries for EDS >= 3.6. That passed configure, but then compilation failed due to missing methods (signon_auth_session_process_async/finish, ag_account_set_variant, ...).
Comment 4 Alberto Mardegan 2013-12-04 10:22:19 UTC
Right, I should probably have added the versions to the pkg-config check. Here they are:

  libaccounts-glib 1.7
  libsignon-glib 1.8

As for the build error, here's what I get:
In file included from /media/mardy/Data/src/git/freedesktop/syncevolution/src/syncevo/util.h:25:0,
                 from /media/mardy/Data/src/git/freedesktop/syncevolution/src/syncevo/IdentityProvider.h:22,
                 from src/backends/signon/signon.cpp:22:
src/backends/signon/signon.cpp: In member function 'virtual std::string SyncEvo::SignonAuthProvider::getOAuth2Bearer(int) const':
src/backends/signon/signon.cpp:177:46: error: conversion from 'SyncEvo::PlainGStr' to 'bool' is ambiguous
                      buffer ? buffer.get() : "<<null>>",
/media/mardy/Data/src/git/freedesktop/syncevolution/src/syncevo/Logging.h:454:43: note: in definition of macro 'SE_LOG'
src/backends/signon/signon.cpp:176:9: note: in expansion of macro 'SE_LOG_DEBUG'
         SE_LOG_DEBUG(NULL, "OAuth2 token result: %s, %s",
src/backends/signon/signon.cpp:166:19: note: candidates are:
         PlainGStr buffer(g_variant_print(sessionDataVar, true));
In file included from src/backends/signon/signon.cpp:40:0:
/media/mardy/Data/src/git/freedesktop/syncevolution/src/syncevo/GLibSupport.h:624:9: note: SyncEvo::PlainGStr::operator const gchar*() const
         operator const gchar *() const { return &**this; }
In file included from /usr/include/boost/smart_ptr/shared_ptr.hpp:672:0,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /media/mardy/Data/src/git/freedesktop/syncevolution/src/syncevo/ThreadSupport.h:33,
                 from /media/mardy/Data/src/git/freedesktop/syncevolution/src/syncevo/Logging.h:36,
                 from /media/mardy/Data/src/git/freedesktop/syncevolution/src/syncevo/util.h:25,
                 from /media/mardy/Data/src/git/freedesktop/syncevolution/src/syncevo/IdentityProvider.h:22,
                 from src/backends/signon/signon.cpp:22:
/usr/include/boost/smart_ptr/detail/operator_bool.hpp:52:5: note: boost::shared_ptr<T>::operator boost::shared_ptr<T>::unspecified_bool_type() const [with T = char; boost::shared_ptr<T>::unspecified_bool_type = char* boost::shared_ptr<char>::*; boost::shared_ptr<T>::element_type = char]
     operator unspecified_bool_type() const BOOST_NOEXCEPT
Comment 5 Patrick Ohly 2013-12-04 13:27:59 UTC
I've pushed a "uoa" branch which contains the patch with separate fixes for the "buffer" compile problem, a compile problem when neither gSSO nor UOA were enabled, and the configure version check. Alberto, can you double-check that this still works?

I'm probably not going to include it in because throroughly testing that would delay even further, but can merge shortly afterwards.
Comment 6 Patrick Ohly 2014-01-08 14:53:11 UTC
Alberto confirmed that the "uoa" branch worked for him, so I merged into master and pushed that.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.