Changeset 7869e48 for libfaim/msgcookie.c
- Timestamp:
- Jan 12, 2013, 1:43:13 PM (12 years ago)
- Children:
- e3a0d71, 4485285
- Parents:
- 4626016
- git-author:
- Jason Gross <jgross@mit.edu> (01/12/13 13:13:18)
- git-committer:
- Jason Gross <jgross@mit.edu> (01/12/13 13:43:13)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfaim/msgcookie.c
re374dee r7869e48 2 2 * Cookie Caching stuff. Adam wrote this, apparently just some 3 3 * derivatives of n's SNAC work. I cleaned it up, added comments. 4 * 4 * 5 5 */ 6 6 … … 26 26 * returns -1 on error, 0 on append, 1 on update. the cookie you pass 27 27 * in may be free'd, so don't count on its value after calling this! 28 * 28 * 29 29 */ 30 30 faim_internal int aim_cachecookie(aim_session_t *sess, aim_msgcookie_t *cookie) … … 36 36 37 37 newcook = aim_checkcookie(sess, cookie->cookie, cookie->type); 38 38 39 39 if (newcook == cookie) { 40 40 newcook->addtime = time(NULL); … … 43 43 aim_cookie_free(sess, newcook); 44 44 45 cookie->addtime = time(NULL); 45 cookie->addtime = time(NULL); 46 46 47 47 cookie->next = sess->msgcookies; … … 69 69 70 70 for (prev = &sess->msgcookies; (cur = *prev); ) { 71 if ((cur->type == type) && 71 if ((cur->type == type) && 72 72 (memcmp(cur->cookie, cookie, 8) == 0)) { 73 73 *prev = cur->next; … … 90 90 * 91 91 */ 92 faim_internal aim_msgcookie_t *aim_mkcookie(fu8_t *c, int type, void *data) 92 faim_internal aim_msgcookie_t *aim_mkcookie(fu8_t *c, int type, void *data) 93 93 { 94 94 aim_msgcookie_t *cookie; … … 123 123 124 124 for (cur = sess->msgcookies; cur; cur = cur->next) { 125 if ((cur->type == type) && 125 if ((cur->type == type) && 126 126 (memcmp(cur->cookie, cookie, 8) == 0)) 127 return cur; 127 return cur; 128 128 } 129 129 … … 132 132 133 133 #if 0 /* debugging feature */ 134 faim_internal int aim_dumpcookie(aim_session_t *sess, aim_msgcookie_t *cookie) 134 faim_internal int aim_dumpcookie(aim_session_t *sess, aim_msgcookie_t *cookie) 135 135 { 136 136 … … 138 138 return -EINVAL; 139 139 140 faimdprintf(sess, 0, "\tCookie at %p: %d/%s with %p, next %p\n", cookie, 140 faimdprintf(sess, 0, "\tCookie at %p: %d/%s with %p, next %p\n", cookie, 141 141 cookie->type, cookie->cookie, cookie->data, cookie->next); 142 142 … … 158 158 * 159 159 */ 160 faim_internal int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie) 160 faim_internal int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie) 161 161 { 162 162 aim_msgcookie_t *cur, **prev; … … 176 176 177 177 return 0; 178 } 178 } 179 179 180 180 /* XXX I hate switch */ 181 faim_internal int aim_msgcookie_gettype(int reqclass) 181 faim_internal int aim_msgcookie_gettype(int reqclass) 182 182 { 183 183 /* XXX: hokey-assed. needs fixed. */ … … 190 190 case AIM_CAPS_SENDFILE: return AIM_COOKIETYPE_OFTSEND; 191 191 default: return AIM_COOKIETYPE_UNKNOWN; 192 } 192 } 193 193 }
Note: See TracChangeset
for help on using the changeset viewer.