1 /* liblivejournal - a client library for LiveJournal.
2 * Copyright (C) 2003-2004 Evan Martin <martine@danga.com>
4 * vim: tabstop=4 shiftwidth=4 noexpandtab :
8 #include <stdlib.h> /* atoi */
10 #include "liblj/getchallenge.h"
13 parse_result(LJVerb
*verb
) {
14 LJGetChallenge
*getchallenge
= (LJGetChallenge
*)verb
;
17 authscheme
= lj_result_get(verb
->result
, "auth_scheme");
19 getchallenge
->authscheme
= LJ_AUTH_SCHEME_NONE
;
23 if (g_ascii_strcasecmp(authscheme
, "c0") == 0) {
24 getchallenge
->authscheme
= LJ_AUTH_SCHEME_C0
;
25 getchallenge
->challenge
= g_strdup(
26 lj_result_get(verb
->result
, "challenge"));
28 getchallenge
->authscheme
= LJ_AUTH_SCHEME_OTHER
;
29 getchallenge
->authschemestr
= g_strdup(authscheme
);
34 lj_getchallenge_new(LJUser
*user
) {
35 LJGetChallenge
*getchallenge
= g_new0(LJGetChallenge
, 1);
36 lj_verb_init((LJVerb
*)getchallenge
, user
, "getchallenge", TRUE
, parse_result
);
41 lj_getchallenge_free(LJGetChallenge
*getchallenge
) {
42 lj_verb_free_contents((LJVerb
*)getchallenge
);
43 g_free(getchallenge
->authschemestr
);
44 g_free(getchallenge
->challenge
);