~ubuntu-branches/debian/sid/flickcurl/sid

« back to all changes in this revision

Viewing changes to src/groups-api.c

  • Committer: Package Import Robot
  • Author(s): Kumar Appaiah
  • Date: 2014-01-12 08:20:42 UTC
  • mfrom: (1.4.2)
  • Revision ID: package-import@ubuntu.com-20140112082042-7p31zl22mw4ohbcd
Tags: 1.25-1
* New upstream release
* Standards version is now 3.9.5 (no changes needed)
* Multiarch conversion
  + Switch to dh based rules file
  + Add ${misc:Pre-Depends} and Multi-Arch: same for libflickcurl0
  + Alter install files to accommodate the multiarch path

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
  flickcurl_category* category = NULL;
62
62
  char cat_id_str[10];
63
63
  
64
 
  flickcurl_init_params(fc);
 
64
  flickcurl_init_params(fc, 0);
65
65
 
66
66
  if(cat_id >= 0) {
67
67
    sprintf(cat_id_str, "%d", cat_id);
122
122
  flickcurl_group **groups = NULL;
123
123
  flickcurl_group *group = NULL;
124
124
  
125
 
  flickcurl_init_params(fc);
 
125
  flickcurl_init_params(fc, 0);
126
126
 
127
127
  if(!group_id)
128
128
    return NULL;
169
169
 
170
170
 
171
171
/**
 
172
 * flickcurl_groups_join:
 
173
 * @fc: flickcurl context
 
174
 * @group_id: The NSID of the Group in question
 
175
 * @accept_rules: If the group has rules, they must be displayed to the user prior to joining. Passing a true value for this argument specifies that the application has displayed the group rules to the user, and that the user has agreed to them. (See flickr.groups.getInfo). Probably takes a '1' or '0' value (or NULL)
 
176
 * 
 
177
 * Join a public group as a member.
 
178
 *
 
179
 * Implements flickr.groups.join (1.25)
 
180
 * 
 
181
 * Return value: non-0 on failure
 
182
 **/
 
183
int
 
184
flickcurl_groups_join(flickcurl* fc, const char* group_id,
 
185
                      const char* accept_rules)
 
186
{
 
187
  xmlDocPtr doc = NULL;
 
188
  int result = 1;
 
189
 
 
190
  flickcurl_init_params(fc, 0);
 
191
 
 
192
  if(!group_id)
 
193
    return 1;
 
194
 
 
195
  flickcurl_add_param(fc, "group_id", group_id);
 
196
  if(accept_rules)
 
197
    flickcurl_add_param(fc, "accept_rules", accept_rules);
 
198
 
 
199
  flickcurl_end_params(fc);
 
200
 
 
201
  if(flickcurl_prepare(fc, "flickr.groups.join"))
 
202
    goto tidy;
 
203
 
 
204
  doc = flickcurl_invoke(fc);
 
205
  if(!doc)
 
206
    goto tidy;
 
207
 
 
208
  result = 0;
 
209
 
 
210
  tidy:
 
211
 
 
212
  if(fc->failed)
 
213
    result = 1;
 
214
 
 
215
  return result;
 
216
}
 
217
 
 
218
 
 
219
/**
 
220
 * flickcurl_groups_joinRequest:
 
221
 * @fc: flickcurl context
 
222
 * @group_id: The NSID of the group to request joining.
 
223
 * @message: Message to the administrators.
 
224
 * @accept_rules: If the group has rules, they must be displayed to the user prior to joining. Passing a true value for this argument specifies that the application has displayed the group rules to the user, and that the user has agreed to them. (See flickr.groups.getInfo).  Probably takes a '1' or '0' value.
 
225
 * 
 
226
 * Request to join a group that is invitation-only.
 
227
 *
 
228
 * Implements flickr.groups.joinRequest (1.25)
 
229
 * 
 
230
 * Return value: non-0 on failure
 
231
 **/
 
232
int
 
233
flickcurl_groups_joinRequest(flickcurl* fc, const char* group_id,
 
234
                             const char* message, const char* accept_rules)
 
235
{
 
236
  xmlDocPtr doc = NULL;
 
237
  int result = 1;
 
238
 
 
239
  flickcurl_init_params(fc, 0);
 
240
 
 
241
  if(!group_id || !message || !accept_rules)
 
242
    return 1;
 
243
 
 
244
  flickcurl_add_param(fc, "group_id", group_id);
 
245
  flickcurl_add_param(fc, "message", message);
 
246
  flickcurl_add_param(fc, "accept_rules", accept_rules);
 
247
 
 
248
  flickcurl_end_params(fc);
 
249
 
 
250
  if(flickcurl_prepare(fc, "flickr.groups.joinRequest"))
 
251
    goto tidy;
 
252
 
 
253
  doc = flickcurl_invoke(fc);
 
254
  if(!doc)
 
255
    goto tidy;
 
256
 
 
257
  result = 0;
 
258
 
 
259
  tidy:
 
260
  if(fc->failed)
 
261
    result = 1;
 
262
 
 
263
  return result;
 
264
}
 
265
 
 
266
 
 
267
/**
 
268
 * flickcurl_groups_leave:
 
269
 * @fc: flickcurl context
 
270
 * @group_id: The NSID of the Group to leave
 
271
 * @delete_photos: Delete all photos by this user from the group.  Probably takes a '1' or '0' value (or NULL)
 
272
 * 
 
273
 * Leave a group.
 
274
 *
 
275
 * If the user is the only administrator left, and there are other
 
276
 * members, the oldest member will be promoted to administrator.
 
277
 * 
 
278
 * If the user is the last person in the group, the group will be deleted.
 
279
 *
 
280
 * Implements flickr.groups.leave (1.25)
 
281
 * 
 
282
 * Return value: non-0 on failure
 
283
 **/
 
284
int
 
285
flickcurl_groups_leave(flickcurl* fc, const char* group_id,
 
286
                       const char* delete_photos)
 
287
{
 
288
  xmlDocPtr doc = NULL;
 
289
  int result = 1;
 
290
 
 
291
  flickcurl_init_params(fc, 0);
 
292
 
 
293
  if(!group_id)
 
294
    return 1;
 
295
 
 
296
  flickcurl_add_param(fc, "group_id", group_id);
 
297
  if(delete_photos)
 
298
    flickcurl_add_param(fc, "delete_photos", delete_photos);
 
299
 
 
300
  flickcurl_end_params(fc);
 
301
 
 
302
  if(flickcurl_prepare(fc, "flickr.groups.leave"))
 
303
    goto tidy;
 
304
 
 
305
  doc = flickcurl_invoke(fc);
 
306
  if(!doc)
 
307
    goto tidy;
 
308
 
 
309
  result = 0;
 
310
 
 
311
  tidy:
 
312
  if(fc->failed)
 
313
    result = 1;
 
314
 
 
315
  return result;
 
316
}
 
317
 
 
318
 
 
319
/**
172
320
 * flickcurl_groups_search:
173
321
 * @fc: flickcurl context
174
322
 * @text: The text to search for.
191
339
  char per_page_s[10];
192
340
  char page_s[10];
193
341
  
194
 
  flickcurl_init_params(fc);
 
342
  flickcurl_init_params(fc, 0);
195
343
 
196
344
  if(!text)
197
345
    return NULL;