Mercurial > pidgin
comparison src/protocols/oscar/msgcookie.c @ 13239:f260d319bbbc
[gaim-migrate @ 15605]
Renaming a bunch of structs and typedefs to use the same naming
scheme as the rest of Gaim
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 12 Feb 2006 16:02:05 +0000 |
parents | f2431a7e33aa |
children | 6519aeb66b31 |
comparison
equal
deleted
inserted
replaced
13238:1e855032d7bc | 13239:f260d319bbbc |
---|---|
43 * @param sess session to add to | 43 * @param sess session to add to |
44 * @param cookie pointer to struct to append | 44 * @param cookie pointer to struct to append |
45 * @return returns -1 on error, 0 on append, 1 on update. the cookie you pass | 45 * @return returns -1 on error, 0 on append, 1 on update. the cookie you pass |
46 * in may be free'd, so don't count on its value after calling this! | 46 * in may be free'd, so don't count on its value after calling this! |
47 */ | 47 */ |
48 faim_internal int aim_cachecookie(aim_session_t *sess, aim_msgcookie_t *cookie) | 48 faim_internal int aim_cachecookie(OscarSession *sess, IcbmCookie *cookie) |
49 { | 49 { |
50 aim_msgcookie_t *newcook; | 50 IcbmCookie *newcook; |
51 | 51 |
52 if (!sess || !cookie) | 52 if (!sess || !cookie) |
53 return -EINVAL; | 53 return -EINVAL; |
54 | 54 |
55 newcook = aim_checkcookie(sess, cookie->cookie, cookie->type); | 55 newcook = aim_checkcookie(sess, cookie->cookie, cookie->type); |
76 * @param sess session to grab cookie from | 76 * @param sess session to grab cookie from |
77 * @param cookie cookie string to look for | 77 * @param cookie cookie string to look for |
78 * @param type cookie type to look for | 78 * @param type cookie type to look for |
79 * @return if found, returns the struct; if none found (or on error), returns NULL: | 79 * @return if found, returns the struct; if none found (or on error), returns NULL: |
80 */ | 80 */ |
81 faim_internal aim_msgcookie_t *aim_uncachecookie(aim_session_t *sess, guint8 *cookie, int type) | 81 faim_internal IcbmCookie *aim_uncachecookie(OscarSession *sess, guint8 *cookie, int type) |
82 { | 82 { |
83 aim_msgcookie_t *cur, **prev; | 83 IcbmCookie *cur, **prev; |
84 | 84 |
85 if (!cookie || !sess->msgcookies) | 85 if (!cookie || !sess->msgcookies) |
86 return NULL; | 86 return NULL; |
87 | 87 |
88 for (prev = &sess->msgcookies; (cur = *prev); ) { | 88 for (prev = &sess->msgcookies; (cur = *prev); ) { |
96 | 96 |
97 return NULL; | 97 return NULL; |
98 } | 98 } |
99 | 99 |
100 /** | 100 /** |
101 * aim_mkcookie - generate an aim_msgcookie_t *struct from a cookie string, a type, and a data pointer. | 101 * aim_mkcookie - generate an IcbmCookie *struct from a cookie string, a type, and a data pointer. |
102 * | 102 * |
103 * @param c pointer to the cookie string array | 103 * @param c pointer to the cookie string array |
104 * @param type cookie type to use | 104 * @param type cookie type to use |
105 * @param data data to be cached with the cookie | 105 * @param data data to be cached with the cookie |
106 * @return returns NULL on error, a pointer to the newly-allocated | 106 * @return returns NULL on error, a pointer to the newly-allocated |
107 * cookie on success. | 107 * cookie on success. |
108 */ | 108 */ |
109 faim_internal aim_msgcookie_t *aim_mkcookie(guint8 *c, int type, void *data) | 109 faim_internal IcbmCookie *aim_mkcookie(guint8 *c, int type, void *data) |
110 { | 110 { |
111 aim_msgcookie_t *cookie; | 111 IcbmCookie *cookie; |
112 | 112 |
113 if (!c) | 113 if (!c) |
114 return NULL; | 114 return NULL; |
115 | 115 |
116 if (!(cookie = calloc(1, sizeof(aim_msgcookie_t)))) | 116 if (!(cookie = calloc(1, sizeof(IcbmCookie)))) |
117 return NULL; | 117 return NULL; |
118 | 118 |
119 cookie->data = data; | 119 cookie->data = data; |
120 cookie->type = type; | 120 cookie->type = type; |
121 memcpy(cookie->cookie, c, 8); | 121 memcpy(cookie->cookie, c, 8); |
131 * @param type type of the cookie to look for | 131 * @param type type of the cookie to look for |
132 * @return returns a pointer to the cookie struct (still in the list) | 132 * @return returns a pointer to the cookie struct (still in the list) |
133 * on success; returns NULL on error/not found | 133 * on success; returns NULL on error/not found |
134 */ | 134 */ |
135 | 135 |
136 faim_internal aim_msgcookie_t *aim_checkcookie(aim_session_t *sess, const guint8 *cookie, int type) | 136 faim_internal IcbmCookie *aim_checkcookie(OscarSession *sess, const guint8 *cookie, int type) |
137 { | 137 { |
138 aim_msgcookie_t *cur; | 138 IcbmCookie *cur; |
139 | 139 |
140 for (cur = sess->msgcookies; cur; cur = cur->next) { | 140 for (cur = sess->msgcookies; cur; cur = cur->next) { |
141 if ((cur->type == type) && | 141 if ((cur->type == type) && |
142 (memcmp(cur->cookie, cookie, 8) == 0)) | 142 (memcmp(cur->cookie, cookie, 8) == 0)) |
143 return cur; | 143 return cur; |
145 | 145 |
146 return NULL; | 146 return NULL; |
147 } | 147 } |
148 | 148 |
149 /** | 149 /** |
150 * aim_cookie_free - free an aim_msgcookie_t struct | 150 * aim_cookie_free - free an IcbmCookie struct |
151 * | 151 * |
152 * this function removes the cookie *cookie from the list of cookies | 152 * this function removes the cookie *cookie from the list of cookies |
153 * in sess, and then frees all memory associated with it. including | 153 * in sess, and then frees all memory associated with it. including |
154 * its data! if you want to use the private data after calling this, | 154 * its data! if you want to use the private data after calling this, |
155 * make sure you copy it first. | 155 * make sure you copy it first. |
157 * @param sess session to remove the cookie from | 157 * @param sess session to remove the cookie from |
158 * @param cookie the address of a pointer to the cookie struct to remove | 158 * @param cookie the address of a pointer to the cookie struct to remove |
159 * @return returns -1 on error, 0 on success. | 159 * @return returns -1 on error, 0 on success. |
160 * | 160 * |
161 */ | 161 */ |
162 faim_internal int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie) | 162 faim_internal int aim_cookie_free(OscarSession *sess, IcbmCookie *cookie) |
163 { | 163 { |
164 aim_msgcookie_t *cur, **prev; | 164 IcbmCookie *cur, **prev; |
165 | 165 |
166 if (!sess || !cookie) | 166 if (!sess || !cookie) |
167 return -EINVAL; | 167 return -EINVAL; |
168 | 168 |
169 for (prev = &sess->msgcookies; (cur = *prev); ) { | 169 for (prev = &sess->msgcookies; (cur = *prev); ) { |