Changeset 608f8cf
- Timestamp:
- 2007-11-24T18:02:39Z (17 years ago)
- Branches:
- master
- Children:
- 221a273
- Parents:
- 3a80471
- Location:
- protocols/jabber
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/iq.c
r3a80471 r608f8cf 50 50 51 51 if( ( s = xt_find_attr( node, "id" ) ) == NULL || 52 strncmp( s, JABBER_CACHED_ID, strlen( JABBER_CACHED_ID) ) != 0 )52 strncmp( s, jd->cached_id_prefix, strlen( jd->cached_id_prefix ) ) != 0 ) 53 53 { 54 54 /* Silently ignore it, without an ID (or a non-cache -
protocols/jabber/jabber.c
r3a80471 r608f8cf 32 32 #include "bitlbee.h" 33 33 #include "jabber.h" 34 #include "md5.h" 35 #include "base64.h" 34 36 35 37 static void jabber_init( account_t *acc ) … … 59 61 s->flags |= ACC_SET_OFFLINE_ONLY; 60 62 } 63 64 static void jabber_generate_id_hash( struct jabber_data *jd ); 61 65 62 66 static void jabber_login( account_t *acc ) … … 200 204 imcb_add_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL ); 201 205 } 206 207 jabber_generate_id_hash( jd ); 208 } 209 210 static void jabber_generate_id_hash( struct jabber_data *jd ) 211 { 212 md5_state_t id_hash; 213 md5_byte_t binbuf[16]; 214 char *s; 215 216 md5_init( &id_hash ); 217 md5_append( &id_hash, (unsigned char *) jd->username, strlen( jd->username ) ); 218 md5_append( &id_hash, (unsigned char *) jd->server, strlen( jd->server ) ); 219 s = set_getstr( &jd->ic->acc->set, "resource" ); 220 md5_append( &id_hash, (unsigned char *) s, strlen( s ) ); 221 random_bytes( binbuf, 16 ); 222 md5_append( &id_hash, binbuf, 16 ); 223 md5_finish( &id_hash, binbuf ); 224 225 s = base64_encode( binbuf, 9 ); 226 jd->cached_id_prefix = g_strdup_printf( "%s%s", JABBER_CACHED_ID, s ); 227 g_free( s ); 228 229 printf( "%s\n", jd->cached_id_prefix ); 202 230 } 203 231 -
protocols/jabber/jabber.h
r3a80471 r608f8cf 78 78 char *away_message; 79 79 80 char *cached_id_prefix; 80 81 GHashTable *node_cache; 81 82 GHashTable *buddies; … … 132 133 first one should be used, but when storing a packet in the cache, a 133 134 "special" kind of ID is assigned to make it easier later to figure out 134 if we have to do call an event handler for the response packet. */ 135 if we have to do call an event handler for the response packet. Also 136 we'll append a hash to make sure we won't trigger on cached packets from 137 other BitlBee users. :-) */ 135 138 #define JABBER_PACKET_ID "BeeP" 136 139 #define JABBER_CACHED_ID "BeeC" -
protocols/jabber/jabber_util.c
r3a80471 r608f8cf 133 133 { 134 134 struct jabber_data *jd = ic->proto_data; 135 char *id = g_strdup_printf( "%s%05x", JABBER_CACHED_ID, ( next_id++ ) & 0xfffff );136 135 struct jabber_cache_entry *entry = g_new0( struct jabber_cache_entry, 1 ); 137 136 char *id; 137 138 id = g_strdup_printf( "%s%05x", jd->cached_id_prefix, ( next_id++ ) & 0xfffff ); 138 139 xt_add_attr( node, "id", id ); 139 140 g_free( id );
Note: See TracChangeset
for help on using the changeset viewer.