fix /msg command
This commit is contained in:
		
							parent
							
								
									d43d008cb8
								
							
						
					
					
						commit
						85d6134d33
					
				| @ -284,10 +284,16 @@ void dc_channel_add_recipient(dc_channel_t c, dc_account_t a) | ||||
| 
 | ||||
| bool dc_channel_has_recipient(dc_channel_t c, dc_account_t a) | ||||
| { | ||||
|     size_t i = 0; | ||||
|     return_if_true(c == NULL || a == NULL, false); | ||||
|     return g_ptr_array_find_with_equal_func( | ||||
|         c->recipients, a, (GEqualFunc)dc_account_equal, NULL | ||||
|         ); | ||||
| 
 | ||||
|     for (i = 0; i < c->recipients->len; i++) { | ||||
|         if (dc_account_equal(g_ptr_array_index(c->recipients, i), a)) { | ||||
|             return true; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     return false; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -339,19 +339,23 @@ dc_channel_t dc_session_channel_recipients(dc_session_t s, | ||||
| 
 | ||||
|     GHashTableIter iter; | ||||
|     gpointer key, value; | ||||
|     size_t i = 0, j = 0; | ||||
|     size_t i = 0; | ||||
| 
 | ||||
|     g_hash_table_iter_init(&iter, s->channels); | ||||
|     while (g_hash_table_iter_next(&iter, &key, &value)) { | ||||
|         dc_channel_t chan = (dc_channel_t)value; | ||||
|         bool found = true; | ||||
| 
 | ||||
|         if (dc_channel_recipients(chan) == 0) { | ||||
|             continue; | ||||
|         } | ||||
| 
 | ||||
|         if (dc_channel_recipients(chan) != sz) { | ||||
|             continue; | ||||
|         } | ||||
| 
 | ||||
|         for (i = 0; i < sz; i++) { | ||||
|             if (!dc_channel_has_recipient(chan, r[j])) { | ||||
|             if (!dc_channel_has_recipient(chan, r[i])) { | ||||
|                 found = false; | ||||
|                 break; | ||||
|             } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user