Changes in / [5ca1416:b1dc403]
- Files:
-
- 5 added
- 4 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
r5ca1416 rb1dc403 32 32 jabber="default-on" 33 33 oscar="default-on" 34 rpc="rpc-on" 34 35 yahoo="default-on" 35 36 … … 118 119 --purple=0/1 Disable/enable libpurple support $purple 119 120 (automatically disables other protocol modules) 121 --rpc=0/1 Disable/enable RPC interface $rpc 120 122 121 123 --doc=0/1 Disable/enable help.txt generation $doc … … 815 817 protocols=$protocols'twitter ' 816 818 protoobjs=$protoobjs'twitter_mod.o ' 819 fi 820 821 if [ "$rpc" = 0 ]; then 822 echo '#undef WITH_RPC' >> config.h 823 else 824 echo '#define WITH_RPC' >> config.h 825 protocols=$protocols'rpc ' 826 protoobjs=$protoobjs'rpc_mod.o ' 817 827 fi 818 828 -
lib/Makefile
r5ca1416 rb1dc403 13 13 14 14 # [SH] Program variables 15 objects = arc.o base64.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o json.o json_util.o md5.o misc.o oauth.o oauth2.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o ns_parse.o15 objects = arc.o base64.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o oauth2.o parson.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o ns_parse.o 16 16 17 17 LFLAGS += -r -
lib/oauth2.c
r5ca1416 rb1dc403 42 42 #include "oauth2.h" 43 43 #include "oauth.h" 44 #include "json.h" 45 #include "json_util.h" 44 #include "parson.h" 46 45 #include "url.h" 46 47 #define JSON_O_FOREACH(o, k, v) \ 48 const char *k; const JSON_Value *v; int __i; \ 49 for (__i = 0; json_object_get_tuple(o, __i, &k, &v); __i++) 47 50 48 51 char *oauth2_url(const struct oauth2_service *sp) … … 113 116 } 114 117 115 static char* oauth2_parse_error( json_value *e)118 static char* oauth2_parse_error(const JSON_Value *e) 116 119 { 117 120 /* This does a reasonable job with some of the flavours of error 118 121 responses I've seen. Because apparently it's not standardised. */ 119 122 120 if ( e->type == json_object) {123 if (json_type(e) == JSONObject) { 121 124 /* Facebook style */ 122 const char *msg = json_o _str(e, "message");123 const char *type = json_o _str(e, "type");124 json_value *code_o = json_o_get(e, "code");125 const char *msg = json_object_get_string(json_object(e), "message"); 126 const char *type = json_object_get_string(json_object(e), "type"); 127 JSON_Value *code_o = json_object_get_value(json_object(e), "code"); 125 128 int code = 0; 126 129 127 if ( code_o && code_o->type == json_integer) {128 code = code_o->u.integer;130 if (json_type(code_o) == JSONNumber) { 131 code = json_value_get_number(code_o); 129 132 } 130 133 131 134 return g_strdup_printf("Error %d: %s", code, msg ? msg : type ? type : "Unknown error"); 132 } else if ( e->type == json_string) {133 return g_strdup( e->u.string.ptr);135 } else if (json_type(e) == JSONString) { 136 return g_strdup(json_string(e)); 134 137 } 135 138 return NULL; … … 150 153 if (content_type && (strstr(content_type, "application/json") || 151 154 strstr(content_type, "text/javascript"))) { 152 json_value *js = json_parse(req->reply_body, req->body_size);153 if (js && js ->type == json_object) {154 JSON_O_FOREACH(js , k, v){155 JSON_Value *js = json_parse_string(req->reply_body); 156 if (js && json_type(js) == JSONObject) { 157 JSON_O_FOREACH(json_object(js), k, v){ 155 158 if (strcmp(k, "error") == 0) { 156 159 error = oauth2_parse_error(v); 157 160 } 158 if ( v->type != json_string) {161 if (json_type(v) != JSONString) { 159 162 continue; 160 163 } 161 164 if (strcmp(k, "access_token") == 0) { 162 atoken = g_strdup( v->u.string.ptr);165 atoken = g_strdup(json_string(v)); 163 166 } 164 167 if (strcmp(k, "refresh_token") == 0) { 165 rtoken = g_strdup( v->u.string.ptr);168 rtoken = g_strdup(json_string(v)); 166 169 } 167 170 } -
protocols/nogaim.c
r5ca1416 rb1dc403 132 132 extern void twitter_initmodule(); 133 133 extern void purple_initmodule(); 134 extern void rpc_initmodule(); 134 135 135 136 #ifdef WITH_MSN … … 155 156 #ifdef WITH_PURPLE 156 157 purple_initmodule(); 158 #endif 159 160 #ifdef WITH_RPC 161 rpc_initmodule(); 157 162 #endif 158 163
Note: See TracChangeset
for help on using the changeset viewer.