| 273 * @param creator The nickname of the room's creator / invitor |
273 * @param creator The nickname of the room's creator / invitor |
| 274 */ |
274 */ |
| 275 void multimx_invite(struct MXitSession* session, struct contact* contact, const char* creator) |
275 void multimx_invite(struct MXitSession* session, struct contact* contact, const char* creator) |
| 276 { |
276 { |
| 277 GHashTable *components; |
277 GHashTable *components; |
| 278 struct multimx* multimx = NULL; |
|
| 279 |
278 |
| 280 purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s' (roomid='%s') by '%s'\n", contact->alias, contact->username, creator); |
279 purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s' (roomid='%s') by '%s'\n", contact->alias, contact->username, creator); |
| 281 |
280 |
| 282 /* Check if the room already exists (ie, already joined or invite pending) */ |
281 /* Check if the room already exists (ie, already joined or invite pending) */ |
| 283 if (find_room_by_username(session, contact->username) != NULL) |
282 if (find_room_by_username(session, contact->username) != NULL) |
| 284 return; |
283 return; |
| 285 |
284 |
| 286 /* Create a new room */ |
285 /* Create a new room */ |
| 287 multimx = room_create(session, contact->username, contact->alias, STATE_INVITED); |
286 room_create(session, contact->username, contact->alias, STATE_INVITED); |
| 288 |
287 |
| 289 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
288 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
| 290 g_hash_table_insert(components, g_strdup("room"), g_strdup(contact->alias)); |
289 g_hash_table_insert(components, g_strdup("room"), g_strdup(contact->alias)); |
| 291 |
290 |
| 292 /* Call libpurple - will trigger either 'mxit_chat_join' or 'mxit_chat_reject' */ |
291 /* Call libpurple - will trigger either 'mxit_chat_join' or 'mxit_chat_reject' */ |