comparison src/protocols/oscar/service.c @ 8225:9790cda80d52

[gaim-migrate @ 8948] Various bits o' chat code cleanup for oscar. Mostly I just wanted to re-use some code for incoming i18n chat messages. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 11 Feb 2004 04:06:16 +0000
parents 5b83ed21f070
children 92cbf9713795
comparison
equal deleted inserted replaced
8224:ad524b8c9c71 8225:9790cda80d52
93 93
94 /* Subtype 0x0004 - Service request */ 94 /* Subtype 0x0004 - Service request */
95 faim_export int aim_reqservice(aim_session_t *sess, aim_conn_t *conn, fu16_t serviceid) 95 faim_export int aim_reqservice(aim_session_t *sess, aim_conn_t *conn, fu16_t serviceid)
96 { 96 {
97 return aim_genericreq_s(sess, conn, 0x0001, 0x0004, &serviceid); 97 return aim_genericreq_s(sess, conn, 0x0001, 0x0004, &serviceid);
98 }
99
100 /*
101 * Join a room of name roomname. This is the first step to joining an
102 * already created room. It's basically a Service Request for
103 * family 0x000e, with a little added on to specify the exchange and room
104 * name.
105 */
106 faim_export int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance)
107 {
108 aim_frame_t *fr;
109 aim_snacid_t snacid;
110 aim_tlvlist_t *tl = NULL;
111 struct chatsnacinfo csi;
112
113 if (!sess || !conn || !roomname || !strlen(roomname))
114 return -EINVAL;
115
116 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512)))
117 return -ENOMEM;
118
119 memset(&csi, 0, sizeof(csi));
120 csi.exchange = exchange;
121 strncpy(csi.name, roomname, sizeof(csi.name));
122 csi.instance = instance;
123
124 snacid = aim_cachesnac(sess, 0x0001, 0x0004, 0x0000, &csi, sizeof(csi));
125 aim_putsnac(&fr->data, 0x0001, 0x0004, 0x0000, snacid);
126
127 /*
128 * Requesting service chat (0x000e)
129 */
130 aimbs_put16(&fr->data, 0x000e);
131
132 aim_tlvlist_add_chatroom(&tl, 0x0001, exchange, roomname, instance);
133 aim_tlvlist_write(&fr->data, &tl);
134 aim_tlvlist_free(&tl);
135
136 aim_tx_enqueue(sess, fr);
137
138 return 0;
98 } 139 }
99 140
100 /* Subtype 0x0005 - Redirect */ 141 /* Subtype 0x0005 - Redirect */
101 static int redirect(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 142 static int redirect(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
102 { 143 {