| 26 | } |
| 27 | |
| 28 | void OAuthTokenizer::tokenize(QString decoded) { |
| 29 | QStringList tokens; |
| 30 | for (;decoded.length()>0;) { |
| 31 | int i=decoded.indexOf("&"); |
| 32 | if (i != -1) { |
| 33 | tokens.append(decoded.left(i)); |
| 34 | decoded=decoded.right(decoded.length()-i-1); |
| 35 | } else { |
| 36 | tokens.append(decoded); |
| 37 | decoded=""; |
| 38 | } |
| 39 | } |
| 40 | QString oauth_tokenString = "oauth_token="; |
| 41 | QString edam_shardString = "edam_shard="; |
| 42 | QString edam_userIdString = "edam_userid="; |
| 43 | QString edam_expiresString = "edam_expires="; |
| 44 | QString edam_noteStoreUrlString ="edam_notestoreurl="; |
| 45 | QString edam_webApiUrlPrefixString = "edam_webapiurlprefix="; |
| 46 | oauth_token = ""; |
| 47 | edam_shard = ""; |
| 48 | edam_userId = ""; |
| 49 | edam_expires = ""; |
| 50 | edam_noteStoreUrl = ""; |
| 51 | edam_webApiUrlPrefix = ""; |
| 52 | |
| 53 | for (int i=0; i<tokens.size(); i++) { |
| 54 | QString token = tokens[i]; |
| 55 | token = token.toLower(); |
| 56 | if (token.startsWith(oauth_tokenString)) |
| 57 | oauth_token = tokens[i].right(token.length()-oauth_tokenString.length()); |
| 58 | if (token.startsWith(edam_shardString)) |
| 59 | edam_shard = tokens[i].right(token.length()-edam_shardString.length()); |
| 60 | if (token.startsWith(edam_userIdString)) |
| 61 | edam_userId = tokens[i].right(token.length()-edam_userIdString.length()); |
| 62 | if (token.startsWith(edam_expiresString)) |
| 63 | edam_expires = tokens[i].right(token.length()-edam_expiresString.length()); |
| 64 | if (token.startsWith(edam_noteStoreUrlString)) |
| 65 | edam_noteStoreUrl = tokens[i].right(token.length()-edam_noteStoreUrlString.length()); |
| 66 | if (token.startsWith(edam_webApiUrlPrefixString)) |
| 67 | edam_webApiUrlPrefix=tokens[i].right(token.length()-edam_webApiUrlPrefixString.length()); |
| 68 | |
| 69 | } |
| 70 | |
| 71 | } |