After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705969 - [RFC] [WIP] VKontakte provider
[RFC] [WIP] VKontakte provider
Status: RESOLVED OBSOLETE
Product: gnome-online-accounts
Classification: Core
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: GNOME Online Accounts maintainer(s)
GNOME Online Accounts maintainer(s)
: 744256 779375 (view as bug list)
Depends on:
Blocks: 744238 751981
 
 
Reported: 2013-08-14 08:38 UTC by Igor Gnatenko
Modified: 2021-07-05 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Header file for VKontakte provider (1.63 KB, text/x-chdr)
2013-08-14 08:42 UTC, Igor Gnatenko
  Details
goavkontakteprovider.c (15.68 KB, text/x-csrc)
2013-08-14 08:43 UTC, Igor Gnatenko
  Details
vk goa provider (25.38 KB, patch)
2015-02-18 16:41 UTC, Morse
none Details | Review
goa music patch (6.17 KB, patch)
2015-05-23 10:52 UTC, Morse
none Details | Review
goa vk patch (52.33 KB, patch)
2015-05-23 10:54 UTC, Morse
none Details | Review
CAPTCHA solving window (69.07 KB, image/png)
2015-05-23 10:58 UTC, Morse
  Details
CAPTCHA solving window (69.98 KB, image/png)
2015-05-26 17:42 UTC, Morse
  Details
goa_vk_patch (51.74 KB, patch)
2015-05-27 14:40 UTC, Morse
none Details | Review
goa_vk_patch (51.67 KB, patch)
2015-05-28 13:03 UTC, Morse
none Details | Review
goa_vk_patch (54.47 KB, patch)
2015-06-14 17:25 UTC, Morse
none Details | Review
goa_vk_patch (55.07 KB, patch)
2015-08-02 10:18 UTC, Morse
none Details | Review
goa vk patch (53.66 KB, patch)
2015-08-04 18:25 UTC, Morse
none Details | Review
goa music patch (6.73 KB, patch)
2015-08-04 18:29 UTC, Morse
committed Details | Review
Introduce org.gnome.OnlineAccounts.Music (6.78 KB, patch)
2015-08-05 14:03 UTC, Debarshi Ray
committed Details | Review
goa_vk_patch (52.91 KB, patch)
2015-08-05 14:19 UTC, Morse
none Details | Review

Description Igor Gnatenko 2013-08-14 08:38:07 UTC
Today I starts work with support VKontakte API in g-o-a.
Documentation: http://vk.com/dev
Planned features:
* Chats
* Contacts
* Documents
Here I will attach files/patches for new provider and I need helping with developing. If you can help me feel free to comment.
Comment 1 Igor Gnatenko 2013-08-14 08:42:59 UTC
Created attachment 251579 [details]
Header file for VKontakte provider
Comment 2 Igor Gnatenko 2013-08-14 08:43:48 UTC
Created attachment 251580 [details]
goavkontakteprovider.c
Comment 3 Debarshi Ray 2013-08-14 09:30:20 UTC
I can see that it uses OAuth 2.0 (http://vk.com/dev/auth_mobile) for authentication. What protocols or APIs are used for chat, contacts and documents?
Comment 4 Aleksandr Stepanov 2013-09-26 08:35:38 UTC
(In reply to comment #3)
> I can see that it uses OAuth 2.0 (http://vk.com/dev/auth_mobile) for
> authentication. What protocols or APIs are used for chat, contacts and
> documents?

I implemented chat for telepathy stack.

Chat uses long polling HTTP requests.
All is based on HTTP json\xml API.

For accesing it needed only access_token from OAuth.
Comment 5 Aleksandr Stepanov 2013-09-26 08:38:46 UTC
(In reply to comment #0)
> Today I starts work with support VKontakte API in g-o-a.
> Documentation: http://vk.com/dev
> Planned features:
> * Chats
> * Contacts
> * Documents
> Here I will attach files/patches for new provider and I need helping with
> developing. If you can help me feel free to comment.

Напиши мне vk.com/alex_eri
Comment 6 Jura 2014-04-25 07:49:10 UTC
It would be great
Comment 7 Jura 2014-06-12 22:32:30 UTC
Any news?
Comment 8 Igor Gnatenko 2014-06-12 22:59:04 UTC
We should write telepathy CM first. I wrote some things (login, set online/offline status)[0], but I have no time now. Patches are welcome (c)

[0]https://github.com/ignatenkobrain/telepathy-durka
Comment 9 Debarshi Ray 2015-02-18 16:03:01 UTC
*** Bug 744256 has been marked as a duplicate of this bug. ***
Comment 10 Morse 2015-02-18 16:41:20 UTC
Created attachment 297111 [details] [review]
vk goa provider

vk goa provider. provides only "chat" as of now, which should be switched to "music" at some point.
Comment 11 Morse 2015-05-23 10:52:54 UTC
Created attachment 303845 [details] [review]
goa music patch

Add support for "music" providers
Comment 12 Morse 2015-05-23 10:54:14 UTC
Created attachment 303846 [details] [review]
goa vk patch

Add support for the GOA VK provider. It relies on the music interface.
Comment 13 Morse 2015-05-23 10:58:21 UTC
Created attachment 303847 [details]
CAPTCHA solving window

This is how the CAPTCHA solving is looking right now. The only thing that might be missing is a flashy warning sign "the CAPTCHA you entered was incorrect" or "the CAPTCHA text is empty". Right now in both of these situations the window just silently reloads the CAPTCHA image without any warnings.
Comment 14 Morse 2015-05-26 17:42:48 UTC
Created attachment 304034 [details]
CAPTCHA solving window

New iteration of the custom dialog.
Comment 15 Morse 2015-05-27 14:40:36 UTC
Created attachment 304079 [details] [review]
goa_vk_patch

A new iteration of the patch.
- Massive rework of the captcha dialog.
- Captcha image load now asynchronous.
- code style fixes.
Comment 16 Morse 2015-05-28 13:03:00 UTC
Created attachment 304156 [details] [review]
goa_vk_patch

Quick fix:
- fix two objects being double initialized in load_captcha_image ()
- reintroduce the status_code check which didn't work because of the previous error
Comment 17 Morse 2015-06-14 17:25:05 UTC
Created attachment 305248 [details] [review]
goa_vk_patch

- MORE async! Now it's as async as one can get.
- New simple dialog with a spinner is shown while goa connects to the server
- The captcha dialog also shows spinner when connecting. GUI people should be satisfied.
Comment 18 Jura 2015-06-17 17:29:17 UTC
I try apply 2 patch goa_vk_patch and goa_music_patch and compile gnome-obline-accounts-3.16-3.

Chat provider not support for me:
http://i.imgur.com/s0fhPyU.png
Comment 19 Morse 2015-06-17 17:53:46 UTC
Chat support is not supposed to be there. Not until the TP provider is finished. It's only music for now, and to check it working you need to also rebuild grilo and grilo-plugins with patches from #744238

But what bothers me is why the VK icon is not shown. Are you sure you applied the patch correctly? Do you have the goa-account-vk.png files in your source data folder?
Comment 20 Jura 2015-06-17 18:00:51 UTC
Yes, goa-account-vk.png files exists
http://i.imgur.com/HjhVl8n.png
Comment 21 Jura 2015-06-17 18:04:08 UTC
In source directory: http://i.imgur.com/ql3EJuT.png
Comment 22 Vadim Rutkovsky 2015-07-21 15:31:52 UTC
(In reply to Morse from comment #11)
> Created attachment 303845 [details] [review] [review]
> goa music patch
> 
> Add support for "music" providers

As both this patch and bug 728621 add 'music' feature can we rename this to something like 'VkMusic' instead?
Comment 23 Morse 2015-08-02 10:18:11 UTC
Created attachment 308630 [details] [review]
goa_vk_patch

Add support for PHOTOS. The patch for rudimentary support for grilo is ready.
Comment 24 Debarshi Ray 2015-08-04 11:03:17 UTC
Review of attachment 303845 [details] [review]:

Thanks for the patch, George. The patch looks good apart from a few minor issues. The commit message can be polished a bit (see commit bb9575cd95cf2 for an example) and the URL of this bug should be added to it.

::: data/dbus-interfaces.xml
@@ +187,3 @@
     <property name="MapsDisabled" type="b" access="readwrite"/>
 
+    <!-- MusicDisabled:

Please add the version:
@since: 3.18.0

@@ +656,2 @@
   <!--
+      org.gnome.OnlineAccounts.Music:

Ditto.
Comment 25 Debarshi Ray 2015-08-04 11:45:09 UTC
Review of attachment 308630 [details] [review]:

Please add the URL to this bug in the commit message.

A few quick comments:

::: configure.ac
@@ +297,3 @@
+AC_ARG_ENABLE([vk], [AS_HELP_STRING([--enable-vk],
+                                          [Enable VK provider])],
+                                          [],

Would be nice to align these.

@@ +298,3 @@
+                                          [Enable VK provider])],
+                                          [],
+                                          [enable_vk=yes])

We shouldn't turn it on by default (enable_vk=no) until all the relevant patches are in place. Are photos supported now?

::: data/icons/16x16/Makefile.am
@@ +10,3 @@
 	goa-account-owncloud.png	\
 	goa-account-pocket.png		\
+	goa-account-vk.png	\

Should be aligned.

::: data/icons/22x22/Makefile.am
@@ +10,3 @@
 	goa-account-owncloud.png	\
 	goa-account-pocket.png		\
+	goa-account-vk.png	\

Ditto.

::: data/icons/24x24/Makefile.am
@@ +9,3 @@
 	goa-account-owncloud.png	\
 	goa-account-pocket.png		\
+	goa-account-vk.png	\

Ditto.

::: data/icons/32x32/Makefile.am
@@ +10,3 @@
 	goa-account-owncloud.png	\
 	goa-account-pocket.png		\
+	goa-account-vk.png	\

Ditto.

::: data/icons/48x48/Makefile.am
@@ +9,3 @@
 	goa-account-owncloud.png	\
 	goa-account-pocket.png		\
+	goa-account-vk.png	\

Ditto.

::: src/goabackend/goavkprovider.c
@@ +1,2 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*

This file is missing copyright information.

@@ +102,3 @@
+                   GoaObject   *object)
+{
+  return g_strdup (_("VK"));

Don't you think the full name (ie. VKontakte) will look better in the UI?

@@ +115,3 @@
+{
+  return GOA_PROVIDER_FEATURE_BRANDED |
+         /* GOA_PROVIDER_FEATURE_CHAT | */

What is the status of chat? My impression is that it is not going to usable in the next few weeks. In that case, please remove the commented line. We can add it later when it is ready.

@@ +159,3 @@
+{
+  return
+    /* "messages," */ /* to use the chat */

Ditto.

@@ +160,3 @@
+  return
+    /* "messages," */ /* to use the chat */
+    "friends,"  /* to see the list of friends (contact list) */

Do we need "friends" without chat?

@@ +162,3 @@
+    "friends,"  /* to see the list of friends (contact list) */
+    "audio,"    /* to play the music */
+    "offline";  /* to be able to use API even when user is not logged into the website */

Doesn't photos need some scope(s)?

@@ +169,3 @@
+{
+  return 1;
+}

You don't need to implement it. The default implementation will return 0 which should be OK until you change the scopes.

::: src/goabackend/goavkprovider.h
@@ +1,2 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*

This file is missing copyright information.
Comment 26 Debarshi Ray 2015-08-04 14:29:03 UTC
Review of attachment 308630 [details] [review]:

Some more comments:

::: src/goabackend/goavkprovider.c
@@ +36,3 @@
+ *
+ * The #GoaVkProvider structure contains only private data and should
+ * only be accessed using the provided API.

Typo: GoaVKProvider, not GoaVkProvider. :)

@@ +57,3 @@
+  VK_TOKEN_CAPTCHA_NEEDED,
+  VK_TOKEN_INVALID
+} VKTokenResult;

How about calling it VKTokenStatus? Like SoupStatus.

@@ +139,3 @@
+                          escaped_redirect_uri,
+                          escaped_client_id,
+                          escaped_scope);

Broken alignment.

@@ +215,3 @@
+  gchar *debug_str;
+
+  if (!JSON_NODE_HOLDS_OBJECT(error_node)) {

We put the opening brace in the next line. See some of the other files for examples.

@@ +230,3 @@
+  case 14: /* captcha required */
+    if (json_object_has_member (error_obj, "captcha_img") && json_object_has_member (error_obj, "captcha_sid")) {
+      if (vk_captcha != NULL) {

Ditto.

@@ +247,3 @@
+  case 5:  /* token access revoked */
+  case 7:  /* wrong app priveleges */
+  case 17: /* validation needed */

How about using an enumerated type for all the error codes? That would be inherently readable you won't have to add a comment every time one of the integers are used.

@@ +269,3 @@
+    if (request_params) {
+      /* As tokens are private, we should remove it from the list of parameters before printing */
+      for (int i = 0; i < json_array_get_length (request_params); i++) {

Please move the 'int i' to the beginning of the block.

@@ +401,3 @@
+  presentation_identity = g_strdup_printf ("%s %s",
+                                             json_object_get_string_member (json_object, "first_name"),
+                                             json_object_get_string_member (json_object, "last_name"));

Broken alignment.

@@ +606,3 @@
+                                 GoaObject    *object,
+                                 GtkWindow    *parent,
+                                 GError      **error)

None of the other virtual function implementations use the goa_vk_provider prefix. Why not just call it refresh account?

@@ +608,3 @@
+                                 GError      **error)
+{
+  GoaVKProvider *vk_provider = GOA_VK_PROVIDER (provider);

It should be 'self', not 'vk_provider'.

@@ +999,3 @@
+              GtkGrid             *grid,
+              G_GNUC_UNUSED GtkGrid *dummy)
+{

With the changes in bug 752941 now in master, you don't need to implement this function anymore.
Comment 27 Debarshi Ray 2015-08-04 14:32:28 UTC
Adding ui-review because the CAPTCHA dialog (attachment 304034 [details]) needs design input.
Comment 28 Debarshi Ray 2015-08-04 14:38:11 UTC
Comment on attachment 251579 [details]
Header file for VKontakte provider

Obsoleted by the new patches from George.
Comment 29 Debarshi Ray 2015-08-04 14:38:33 UTC
Comment on attachment 251580 [details]
goavkontakteprovider.c

Obsoleted by the new patches from George.
Comment 30 Debarshi Ray 2015-08-04 14:41:33 UTC
Review of attachment 303845 [details] [review]:

You also need to update the show_account_items array in goaprovider.c. I prefer adding a music entry just before photos.
Comment 31 Morse 2015-08-04 18:25:58 UTC
Created attachment 308750 [details] [review]
goa vk patch

>Please add the version:
>@since: 3.18.0
Done
>Would be nice to align these.
>We shouldn't turn it on by default (enable_vk=no) until all the relevant patches are in place.
Done and done.
>Are photos supported now?
I wrote the rudimentary support for grilo: the "browse" function shows all of the photos of the user. Tested it with grilo-test-ui, and it worked, but I didn't find any real-life apps to test it with. Unfortunately it needs some patches for lua-factory first (same with music).
>Should be aligned.
Tabs don't make it easy. I hope it's done (my tabs are set to 2 spaces).
>This file is missing copyright information.
Done
>Don't you think the full name (ie. VKontakte) will look better in the UI?
"VK" _is_ it's full name. In english. In russian it's "ВКонтакте", but that's for translators to care.
>What is the status of chat?
Uncertain. Removed.
>Do we need "friends" without chat?
I use the list of friends to show their music, and plan to do the same with photos. I read some feedback on my VK Music plugin for rhythmbox and found out that that was a requested feature.
>Doesn't photos need some scope(s)?
Hm, strange thing it worked without it. Done.
>You don't need to implement it.
Removed.
>This file is missing copyright information.
Done
>Typo: GoaVKProvider, not GoaVkProvider. :)
Done
>How about calling it VKTokenStatus? Like SoupStatus.
Done
>Broken alignment.
These tabs again. Done.
>We put the opening brace in the next line. See some of the other files for examples.
I did actually. I stole most of the code from facebook to begin with. grep ") {" shows 28 results throughout GOA :). Anyway, done.
>How about using an enumerated type for all the error codes? That would be inherently readable you won't have to add a comment every time one of the integers are used.
Actually, they are used just once. I specifically made this error-handling function to not use the numbers anywhere else. So I don't really see how the enum will be easier. VK API has ~100 different errors. I only picked the ones I care about. Making the enum, I should add them all. I really do not want to do it.
>Please move the 'int i' to the beginning of the block.
Done. It's a shame glib json arrays do not have some handy next() mechanism.
>Broken alignment.
No tabs this time. Strange. Done.
>None of the other virtual function implementations use the goa_vk_provider prefix. Why not just call it refresh account?
Done.
>It should be 'self', not 'vk_provider'.
glib so much wants to be C++ :). Done.
>With the changes in bug 752941 now in master, you don't need to implement this function anymore.
Done. Not tested though (I'll be able to fire up my build machine only on weekend).
Comment 32 Morse 2015-08-04 18:29:10 UTC
Created attachment 308751 [details] [review]
goa music patch

>The commit message can be polished a bit (see commit bb9575cd95cf2 for an example) and the URL of this bug should be added to it.
Done.
>You also need to update the show_account_items array in goaprovider.c. I prefer adding a music entry just before photos.
Done.
Comment 33 Morse 2015-08-04 18:42:35 UTC
>Adding ui-review because the CAPTCHA dialog (attachment 304034 [details]) needs design input.
I modified it a little since that screenshot: I added the label "Enter the text from the image below" on top (as it was suggested on #gnome-design).
Comment 34 Debarshi Ray 2015-08-05 13:59:51 UTC
Review of attachment 308750 [details] [review]:

::: data/dbus-interfaces.xml
@@ +189,2 @@
     <!-- MusicDisabled:
+         @since: 3.18.0

This should be in the other patch.

@@ +658,3 @@
   <!--
       org.gnome.OnlineAccounts.Music:
+      @since: 3.18.0

Ditto.
Comment 35 Debarshi Ray 2015-08-05 14:02:49 UTC
Review of attachment 308751 [details] [review]:

Still missing the version information.
Comment 36 Debarshi Ray 2015-08-05 14:03:48 UTC
Created attachment 308791 [details] [review]
Introduce org.gnome.OnlineAccounts.Music

I took the liberty to fix it up because bug 728621 depends on it.
Comment 37 Morse 2015-08-05 14:19:59 UTC
Created attachment 308792 [details] [review]
goa_vk_patch

Since you already fixed the first patch, I'll only upload the second.
Comment 38 Debarshi Ray 2017-02-28 18:21:09 UTC
*** Bug 779375 has been marked as a duplicate of this bug. ***
Comment 39 GNOME Infrastructure Team 2021-07-05 10:59:45 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/issues/

Thank you for your understanding and your help.