~mardy/account-plugins/sip-icon

« back to all changes in this revision

Viewing changes to src/sohu.vala

  • Committer: David King
  • Date: 2012-06-27 11:57:35 UTC
  • mfrom: (42.1.2 sina-sohu)
  • Revision ID: david.king@canonical.com-20120627115735-l51n1oxy7xibwtab
Add Sina and Soho plugins

* Add Sina plugin
* Add Sohu plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 Canonical, Inc
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 
17
 * USA.
 
18
 *
 
19
 * Authors:
 
20
 *      David King <david.king@canonical.com>
 
21
 */
 
22
 
 
23
public class SohuPlugin : Ap.OAuthPlugin {
 
24
    public SohuPlugin (Ag.Account account) {
 
25
        Object (account: account);
 
26
    }
 
27
 
 
28
    construct
 
29
    {
 
30
        var oauth_params = new HashTable<string, GLib.Value?> (str_hash, null);
 
31
        oauth_params.insert ("RequestEndpoint",
 
32
                             "http://api.t.sohu.com/oauth/request_token");
 
33
        oauth_params.insert ("TokenEndpoint",
 
34
                             "http://api.t.sohu.com/oauth/access_token");
 
35
        oauth_params.insert ("AuthorizationEndpoint",
 
36
                             "http://api.t.sohu.com/oauth/authorize");
 
37
        oauth_params.insert ("ConsumerKey", Config.SOHU_CONSUMER_KEY);
 
38
        oauth_params.insert ("ConsumerSecret", Config.SOHU_CONSUMER_SECRET);
 
39
        oauth_params.insert ("Callback", "http://www.ubuntu.com/");
 
40
        set_oauth_parameters (oauth_params);
 
41
 
 
42
        set_mechanism (Ap.OAuthMechanism.HMAC_SHA1);
 
43
    }
 
44
}
 
45
 
 
46
public GLib.Type ap_module_get_object_type ()
 
47
{
 
48
    return typeof (SohuPlugin);
 
49
}