From d79e81a0697617b5552917c2fe169b30433c54f6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Sep 2015 18:44:40 -0700 Subject: import and sync chatrooms --- mod/chat.php | 4 +++- mod/import.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/chat.php b/mod/chat.php index c2c11d0ab..633ecae22 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -62,11 +62,13 @@ function chat_post(&$a) { chatroom_create($channel,$arr); - $x = q("select cr_id from chatroom where cr_name = '%s' and cr_uid = %d limit 1", + $x = q("select * from chatroom where cr_name = '%s' and cr_uid = %d limit 1", dbesc($room), intval(local_channel()) ); + create_sync_packet(0, array['chatroom'] => $x); + if($x) goaway(z_root() . '/chat/' . $channel['channel_address'] . '/' . $x[0]['cr_id']); diff --git a/mod/import.php b/mod/import.php index 391461687..1d1799e00 100644 --- a/mod/import.php +++ b/mod/import.php @@ -435,6 +435,9 @@ function import_post(&$a) { if(is_array($data['app'])) import_apps($channel,$data['app']); + if(is_array($data['chatroom'])) + import_chatrooms($channel,$data['chatroom']); + $saved_notification_flags = notifications_off($channel['channel_id']); if($import_posts && array_key_exists('item',$data) && $data['item']) { -- cgit v1.2.3