Changeset 2c2df7d for protocols/jabber
- Timestamp:
- 2007-11-28T21:07:30Z (17 years ago)
- Branches:
- master
- Children:
- 2ff2076, fa30fa5
- Parents:
- 221a273
- Location:
- protocols/jabber
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/Makefile
r221a273 r2c2df7d 10 10 11 11 # [SH] Program variables 12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o xmltree.o 12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o xmltree.o si.o stream.o 13 13 14 14 CFLAGS += -Wall -
protocols/jabber/iq.c
r221a273 r2c2df7d 104 104 XMLNS_CHATSTATES, 105 105 XMLNS_MUC, 106 XMLNS_SI, 107 XMLNS_BYTESTREAMS, 108 XMLNS_FILETRANSFER, 106 109 NULL }; 107 110 const char **f; … … 123 126 { 124 127 xt_free_node( reply ); 125 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );128 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL ); 126 129 pack = 0; 127 130 } … … 129 132 else if( strcmp( type, "set" ) == 0 ) 130 133 { 131 if( !( c = xt_find_node( node->children, "query" ) ) || 134 if( ( c = xt_find_node( node->children, "si" ) ) && 135 ( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_SI ) == 0 ) ) 136 { 137 return jabber_si_handle_request( ic, node, c ); 138 } else if( !( c = xt_find_node( node->children, "query" ) ) || 132 139 !( s = xt_find_attr( c, "xmlns" ) ) ) 133 140 { 134 141 imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); 135 142 return XT_HANDLED; 136 } 137 143 } else if( strcmp( s, XMLNS_ROSTER ) == 0 ) 144 { 138 145 /* This is a roster push. XMPP servers send this when someone 139 146 was added to (or removed from) the buddy list. AFAIK they're 140 147 sent even if we added this buddy in our own session. */ 141 if( strcmp( s, XMLNS_ROSTER ) == 0 )142 {143 148 int bare_len = strlen( ic->acc->user ); 144 149 … … 157 162 158 163 xt_free_node( reply ); 159 reply = jabber_make_error_packet( node, "not-allowed", "cancel" );164 reply = jabber_make_error_packet( node, "not-allowed", "cancel", NULL ); 160 165 pack = 0; 161 166 } 162 } 163 else 167 } else if( strcmp( s, XMLNS_BYTESTREAMS ) == 0 ) 168 { 169 /* Bytestream Request (stage 2 of file transfer) */ 170 return jabber_bs_request( ic, node, c ); 171 } else 164 172 { 165 173 xt_free_node( reply ); 166 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );174 reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL ); 167 175 pack = 0; 168 176 } -
protocols/jabber/jabber.h
r221a273 r2c2df7d 81 81 GHashTable *node_cache; 82 82 GHashTable *buddies; 83 84 GSList *filetransfers; 83 85 }; 84 86 … … 122 124 char *my_full_jid; /* Separate copy because of case sensitivity. */ 123 125 struct jabber_buddy *me; 126 }; 127 128 struct jabber_transfer 129 { 130 /* bitlbee's handle for this transfer */ 131 file_transfer_t *ft; 132 133 /* the stream's private handle */ 134 gpointer streamhandle; 135 136 struct im_connection *ic; 137 138 int watch_in; 139 int watch_out; 140 141 char *ini_jid; 142 char *tgt_jid; 143 char *iq_id; 144 char *sid; 145 int accepted; 146 147 size_t bytesread, byteswritten; 148 int receiver_overflow; 149 int fd; 124 150 }; 125 151 … … 149 175 150 176 /* Some supported extensions/legacy stuff */ 151 #define XMLNS_AUTH "jabber:iq:auth" /* XEP-0078 */ 152 #define XMLNS_VERSION "jabber:iq:version" /* XEP-0092 */ 153 #define XMLNS_TIME "jabber:iq:time" /* XEP-0090 */ 154 #define XMLNS_VCARD "vcard-temp" /* XEP-0054 */ 155 #define XMLNS_DELAY "jabber:x:delay" /* XEP-0091 */ 156 #define XMLNS_CHATSTATES "http://jabber.org/protocol/chatstates" /* 0085 */ 157 #define XMLNS_DISCOVER "http://jabber.org/protocol/disco#info" /* 0030 */ 158 #define XMLNS_MUC "http://jabber.org/protocol/muc" /* XEP-0045 */ 159 #define XMLNS_MUC_USER "http://jabber.org/protocol/muc#user"/* XEP-0045 */ 177 #define XMLNS_AUTH "jabber:iq:auth" /* XEP-0078 */ 178 #define XMLNS_VERSION "jabber:iq:version" /* XEP-0092 */ 179 #define XMLNS_TIME "jabber:iq:time" /* XEP-0090 */ 180 #define XMLNS_VCARD "vcard-temp" /* XEP-0054 */ 181 #define XMLNS_DELAY "jabber:x:delay" /* XEP-0091 */ 182 #define XMLNS_XDATA "jabber:x:data" /* XEP-0004 */ 183 #define XMLNS_CHATSTATES "http://jabber.org/protocol/chatstates" /* XEP-0085 */ 184 #define XMLNS_DISCOVER "http://jabber.org/protocol/disco#info" /* XEP-0030 */ 185 #define XMLNS_MUC "http://jabber.org/protocol/muc" /* XEP-0045 */ 186 #define XMLNS_MUC_USER "http://jabber.org/protocol/muc#user" /* XEP-0045 */ 187 #define XMLNS_FEATURE "http://jabber.org/protocol/feature-neg" /* XEP-0020 */ 188 #define XMLNS_SI "http://jabber.org/protocol/si" /* XEP-0095 */ 189 #define XMLNS_FILETRANSFER "http://jabber.org/protocol/si/profile/file-transfer" /* XEP-0096 */ 190 #define XMLNS_BYTESTREAMS "http://jabber.org/protocol/bytestreams" /* XEP-0065 */ 191 #define XMLNS_IBB "http://jabber.org/protocol/ibb" /* XEP-0047 */ 160 192 161 193 /* iq.c */ … … 168 200 int jabber_remove_from_roster( struct im_connection *ic, char *handle ); 169 201 202 /* si.c */ 203 int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, struct xt_node *sinode); 204 205 /* stream.c */ 206 int jabber_bs_request( struct im_connection *ic, struct xt_node *node, struct xt_node *qnode); 207 170 208 /* message.c */ 171 209 xt_status jabber_pkt_message( struct xt_node *node, gpointer data ); … … 180 218 char *set_eval_tls( set_t *set, char *value ); 181 219 struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children ); 182 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type );220 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code ); 183 221 void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func ); 184 222 struct xt_node *jabber_cache_get( struct im_connection *ic, char *id ); -
protocols/jabber/jabber_util.c
r221a273 r2c2df7d 97 97 } 98 98 99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type )99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code ) 100 100 { 101 101 struct xt_node *node, *c; … … 109 109 c = xt_new_node( "error", NULL, c ); 110 110 xt_add_attr( c, "type", err_type ); 111 112 /* Add the error code, if present */ 113 if (err_code) 114 xt_add_attr( c, "code", err_code ); 111 115 112 116 /* To make the actual error packet, we copy the original packet and
Note: See TracChangeset
for help on using the changeset viewer.