Changes in protocols/jabber/jabber_util.c [43462708:979cfb4]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber_util.c
r43462708 r979cfb4 142 142 entry->node = node; 143 143 entry->func = func; 144 entry->saved_at = time( NULL ); 144 145 g_hash_table_insert( jd->node_cache, xt_find_attr( node, "id" ), entry ); 145 146 } … … 163 164 { 164 165 struct jabber_data *jd = ic->proto_data; 165 166 g_hash_table_foreach_remove( jd->node_cache, jabber_cache_clean_entry, NULL ); 167 } 168 169 gboolean jabber_cache_clean_entry( gpointer key, gpointer entry_, gpointer nullpointer ) 166 time_t threshold = time( NULL ) - JABBER_CACHE_MAX_AGE; 167 168 g_hash_table_foreach_remove( jd->node_cache, jabber_cache_clean_entry, &threshold ); 169 } 170 171 gboolean jabber_cache_clean_entry( gpointer key, gpointer entry_, gpointer threshold_ ) 170 172 { 171 173 struct jabber_cache_entry *entry = entry_; 172 struct xt_node *node = entry->node; 173 174 if( node->flags & XT_SEEN ) 175 return TRUE; 176 else 177 { 178 node->flags |= XT_SEEN; 179 return FALSE; 180 } 174 time_t *threshold = threshold_; 175 176 return entry->saved_at < *threshold; 181 177 } 182 178 … … 392 388 if( ( bud = g_hash_table_lookup( jd->buddies, jid ) ) ) 393 389 { 390 /* Just return the first one for this bare JID. */ 391 if( flags & GET_BUDDY_FIRST ) 392 { 393 *s = '/'; 394 g_free( jid ); 395 return bud; 396 } 397 394 398 /* Is this one of those no-resource buddies? */ 395 399 if( bud->resource == NULL ) 396 400 { 401 *s = '/'; 397 402 g_free( jid ); 398 403 return NULL; 399 404 } 400 else 401 { 402 /* See if there's an exact match. */ 403 for( ; bud; bud = bud->next ) 404 if( g_strcasecmp( bud->resource, s + 1 ) == 0 ) 405 break; 406 } 405 406 /* See if there's an exact match. */ 407 for( ; bud; bud = bud->next ) 408 if( g_strcasecmp( bud->resource, s + 1 ) == 0 ) 409 break; 407 410 } 408 411 else … … 413 416 is done to handle conferences properly. */ 414 417 none_found = 1; 418 /* TODO(wilmer): Find out what I was thinking when I 419 wrote this??? And then fix it. This makes me sad... */ 415 420 } 416 421 … … 442 447 else if( ( bud->resource == NULL || bud->next == NULL ) ) 443 448 /* No need for selection if there's only one option. */ 449 return bud; 450 else if( flags & GET_BUDDY_FIRST ) 451 /* Looks like the caller doesn't care about details. */ 444 452 return bud; 445 453
Note: See TracChangeset
for help on using the changeset viewer.