~ubuntu-branches/ubuntu/vivid/liferea/vivid-proposed

« back to all changes in this revision

Viewing changes to src/fl_sources/ttrss_source.h

  • Committer: Package Import Robot
  • Author(s): bojo42
  • Date: 2012-03-29 14:17:21 UTC
  • mfrom: (1.3.9) (3.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20120329141721-tbfopcrc5797wxt7
Tags: 1.8.3-0.1ubuntu1
* New upstream release (LP: #290666, #371754, #741543, #716688)
* Merge from Debian unstable (LP: #935147), remaining changes:
* debian/patches:
  - drop gtk-status-icon.patch & notification-append as in upstream
  - drop fix_systray_behavior as mostly upstreamed and rest seems unused
  - 01_ubuntu_feedlists: update & rename, move planets to "Open Source"  
  - add_X-Ubuntu-Gettext-Domain: rebase
  - libunity.patch: rebase, apply before indicator patch (liferea_shell.c)
  - libindicate_increase_version.patch: exclude from libindicate.patch
  - deactivate libindicate.patch, seems partly upstreamed and needs rework
* debian/control: libindicate-dev, libindicate-gtk-dev & libunity-dev
* debian/liferea.indicate & liferea.install: ship indicator desktop file
* debian/rules: enable libindicate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @file ttrss_source.h tt-rss feed list source support
 
3
 * 
 
4
 * Copyright (C) 2010-2011 Lars Lindner <lars.lindner@gmail.com>
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version. 
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
 */
 
20
 
 
21
#ifndef _TTRSS_SOURCE_H
 
22
#define _TTRSS_SOURCE_H
 
23
 
 
24
#include "fl_sources/node_source.h"
 
25
 
 
26
/**
 
27
 * A nodeSource specific for tt-rss
 
28
 */
 
29
typedef struct ttrssSource {
 
30
        nodePtr         root;           /**< the root node in the feed list */
 
31
        gchar           *session_id;    /**< the tt-rss session id */
 
32
        GQueue          *actionQueue;
 
33
        gint            loginState;     /**< The current login state */
 
34
        gboolean        selfUpdating;   /**< True if remote updating daemon is running */
 
35
} *ttrssSourcePtr;
 
36
 
 
37
enum { 
 
38
        TTRSS_SOURCE_STATE_NONE = 0,
 
39
        TTRSS_SOURCE_STATE_IN_PROGRESS,
 
40
        TTRSS_SOURCE_STATE_ACTIVE
 
41
};
 
42
 
 
43
enum  { 
 
44
        /**
 
45
         * Update only the subscription list, and not each node underneath it.
 
46
         * Note: Uses higher 16 bits to avoid conflict.
 
47
         */
 
48
        TTRSS_SOURCE_UPDATE_ONLY_LIST = (1<<16),
 
49
        /**
 
50
         * Only login, do not do any updates. 
 
51
         */
 
52
        TTRSS_SOURCE_UPDATE_ONLY_LOGIN = (1<<17)
 
53
};
 
54
 
 
55
/**
 
56
 * tt-rss API URL's
 
57
 *
 
58
 * http://tt-rss.org/redmine/wiki/tt-rss/JsonApiReference
 
59
 */
 
60
 
 
61
/**
 
62
 * Tiny Tiny RSS Login API
 
63
 *
 
64
 * @param user          The tt-rss account id
 
65
 * @param passwd        The tt-rss account password
 
66
 *
 
67
 * @returns {"session_id":"xxx"} or {"error":"xxx"}
 
68
 */ 
 
69
#define TTRSS_LOGIN_URL "%s/api/?op=login&user=%s&password=%s" 
 
70
 
 
71
/**
 
72
 * Fetch tt-rss feed list.
 
73
 *
 
74
 * @param sid   session id
 
75
 *
 
76
 * @returns JSON feed list
 
77
 */
 
78
#define TTRSS_SUBSCRIPTION_LIST_URL "%s/api/?op=getFeeds&sid=%s&cat_id=-3"
 
79
 
 
80
/**
 
81
 * Fetch tt-rss headlines for a given feed.
 
82
 *
 
83
 * @param sid           session id
 
84
 * @param feed_id       tt-rss feed id
 
85
 * @param limit         feed cache size
 
86
 *
 
87
 * @returns JSON feed list
 
88
 */
 
89
#define TTRSS_HEADLINES_URL "%s/api/?op=getHeadlines&sid=%s&feed_id=%s&limit=%d&show_content=true&view_mode=all_articles"
 
90
 
 
91
/**
 
92
 * Toggle item flag state.
 
93
 *
 
94
 * @param sid           session id
 
95
 * @param item_id       tt-rss item id
 
96
 * @param mode          0 = unflagged, 1 = flagged
 
97
 */
 
98
#define TTRSS_UPDATE_ITEM_FLAG "%s/api/?op=updateArticle&sid=%s&article_ids=%s&mode=%d&field=0"
 
99
 
 
100
/**
 
101
 * Toggle item read state.
 
102
 *
 
103
 * @param sid           session id
 
104
 * @param item_id       tt-rss item id
 
105
 * @param mode          0 = read, 1 = unread
 
106
 */
 
107
#define TTRSS_UPDATE_ITEM_UNREAD "%s/api/?op=updateArticle&sid=%s&article_ids=%s&mode=%d&field=2"
 
108
 
 
109
/**
 
110
 * Determine server settings.
 
111
 *
 
112
 * @param sid           session id
 
113
 */
 
114
#define TTRSS_GET_CONFIG "%s/api/?op=getConfig&sid=%s"
 
115
 
 
116
/**
 
117
 * Returns ttss source type implementation info.
 
118
 */
 
119
nodeSourceTypePtr ttrss_source_get_type (void);
 
120
 
 
121
void ttrss_source_login (ttrssSourcePtr source, guint32 flags);
 
122
 
 
123
extern struct subscriptionType ttrssSourceFeedSubscriptionType;
 
124
extern struct subscriptionType ttrssSourceSubscriptionType;
 
125
 
 
126
#endif