Mercurial > pidgin.yaz
comparison src/protocols/oscar/service.c @ 2821:9467e4ee81be
[gaim-migrate @ 2834]
new libfaim stuff.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 01 Dec 2001 00:56:31 +0000 |
parents | 9fc65bb80596 |
children | 6d62d4520460 |
comparison
equal
deleted
inserted
replaced
2820:b917845dad3c | 2821:9467e4ee81be |
---|---|
98 } | 98 } |
99 | 99 |
100 /* Redirect (group 1, type 5) */ | 100 /* Redirect (group 1, type 5) */ |
101 static int redirect(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | 101 static int redirect(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
102 { | 102 { |
103 int serviceid; | 103 struct aim_redirect_data redir; |
104 fu8_t *cookie; | |
105 char *ip; | |
106 aim_rxcallback_t userfunc; | 104 aim_rxcallback_t userfunc; |
107 aim_tlvlist_t *tlvlist; | 105 aim_tlvlist_t *tlvlist; |
108 char *chathack = NULL; | 106 aim_snac_t *origsnac = NULL; |
109 int chathackex = 0; | |
110 int ret = 0; | 107 int ret = 0; |
108 | |
109 memset(&redir, 0, sizeof(redir)); | |
111 | 110 |
112 tlvlist = aim_readtlvchain(bs); | 111 tlvlist = aim_readtlvchain(bs); |
113 | 112 |
114 if (!aim_gettlv(tlvlist, 0x000d, 1) || | 113 if (!aim_gettlv(tlvlist, 0x000d, 1) || |
115 !aim_gettlv(tlvlist, 0x0005, 1) || | 114 !aim_gettlv(tlvlist, 0x0005, 1) || |
116 !aim_gettlv(tlvlist, 0x0006, 1)) { | 115 !aim_gettlv(tlvlist, 0x0006, 1)) { |
117 aim_freetlvchain(&tlvlist); | 116 aim_freetlvchain(&tlvlist); |
118 return 0; | 117 return 0; |
119 } | 118 } |
120 | 119 |
121 serviceid = aim_gettlv16(tlvlist, 0x000d, 1); | 120 redir.group = aim_gettlv16(tlvlist, 0x000d, 1); |
122 ip = aim_gettlv_str(tlvlist, 0x0005, 1); | 121 redir.ip = aim_gettlv_str(tlvlist, 0x0005, 1); |
123 cookie = aim_gettlv_str(tlvlist, 0x0006, 1); | 122 redir.cookie = aim_gettlv_str(tlvlist, 0x0006, 1); |
124 | 123 |
125 /* | 124 /* Fetch original SNAC so we can get csi if needed */ |
126 * Chat hack. | 125 origsnac = aim_remsnac(sess, snac->id); |
127 */ | 126 |
128 if ((serviceid == AIM_CONN_TYPE_CHAT) && sess->pendingjoin) { | 127 if ((redir.group == AIM_CONN_TYPE_CHAT) && origsnac) { |
129 chathack = sess->pendingjoin; | 128 struct chatsnacinfo *csi = (struct chatsnacinfo *)origsnac->data; |
130 chathackex = sess->pendingjoinexchange; | 129 |
131 sess->pendingjoin = NULL; | 130 redir.chat.exchange = csi->exchange; |
132 sess->pendingjoinexchange = 0; | 131 redir.chat.room = csi->name; |
132 redir.chat.instance = csi->instance; | |
133 } | 133 } |
134 | 134 |
135 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) | 135 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
136 ret = userfunc(sess, rx, serviceid, ip, cookie, chathack, chathackex); | 136 ret = userfunc(sess, rx, &redir); |
137 | 137 |
138 free(ip); | 138 free((void *)redir.ip); |
139 free(cookie); | 139 free((void *)redir.cookie); |
140 free(chathack); | 140 |
141 if (origsnac) | |
142 free(origsnac->data); | |
143 free(origsnac); | |
141 | 144 |
142 aim_freetlvchain(&tlvlist); | 145 aim_freetlvchain(&tlvlist); |
143 | 146 |
144 return ret; | 147 return ret; |
145 } | 148 } |