fixed some clang warnings
[k8lowj.git] / src / network.h
blob29e36bcf7d32c325aa9fcd5eac6c853a82ecacc7
1 /* logjam - a GTK client for LiveJournal.
2 * Copyright (C) 2000-2004 Evan Martin <martine@danga.com>
3 */
4 #ifndef __LOGJAM_NETWORK_H__
5 #define __LOGJAM_NETWORK_H__
7 #include "liblj/livejournal.h"
8 #include "liblj/verb.h"
11 /* network -- medium-level interface to lj protocol.
12 * takes a hash of request values, returns hash of lj
13 * response, optionally with a "progress" dialog that
14 * can be cancelled.
17 extern GQuark net_error_quark (void);
18 #define NET_ERROR net_error_quark()
21 /* CANCELLED is used so we don't pop up a dialog saying "cancelled"
22 * when they click cancel.
23 * PROTOCOL is for protocol-level errors; if getchallenge fails at a lower
24 * level, subsequent requests won't work either.
26 typedef enum {
27 NET_ERROR_GENERIC,
28 NET_ERROR_PROTOCOL,
29 NET_ERROR_CANCELLED
30 } NetErrorCode;
33 typedef struct _NetContext NetContext;
34 /* the internals of netcontext shouldn't be used by casual callers. */
35 struct _NetContext {
36 void (*title) (NetContext *ctx, const char *title);
37 void (*progress_str) (NetContext *ctx, const char *text);
38 void (*progress_int) (NetContext *ctx, int cur, int max);
39 void (*error) (NetContext *ctx, GError *err);
40 GString *(*http) (NetContext *ctx, const char *url, GSList *headers, GString *post, GError **err);
44 extern NetContext *network_ctx_cmdline;
45 extern NetContext *network_ctx_silent;
47 extern gboolean net_run_verb_ctx (LJVerb *verb, NetContext *ctx, GError **err);
49 #ifdef HAVE_GTK
50 #include <gtk/gtkwindow.h>
51 extern NetContext *net_ctx_gtk_new (GtkWindow *parent, const char *title);
52 extern void net_ctx_gtk_free (NetContext *ctx);
53 #endif
55 #ifdef HAVE_GTK
56 /* lower-level window-based network interface.
57 * used by syncitems to have a custom progress dialog. */
58 #include "progress.h"
60 extern gboolean net_window_run_verb (ProgressWindow *pw, LJVerb *verb);
61 extern gboolean net_window_run_post (ProgressWindow *pw, const char *url, GSList *headers, GString *request, GString *response, GError **err);
62 extern GString *net_get_run (const char *title, GtkWindow *parent, const char *url);
63 #endif
66 #endif