Skip to content

Commit af1e490

Browse files
committed
VENOM-443: Prepare for persistent groupchats
* Prepare for TokTok/c-toxcore#1156 to be merged * Restore known groupchats from chatlist
1 parent f141de3 commit af1e490

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/testing/mocks/MockToxSession.vala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ namespace Mock {
198198
.create();
199199
return mock().actual_call(this, "conference_get_title", args).get_string();
200200
}
201+
public Gee.Iterable<uint32> conference_get_chatlist() {
202+
return (Gee.Iterable<uint32>) mock().actual_call(this, "conference_get_chatlist").get_object();
203+
}
201204
public void file_control(uint32 friend_number, uint32 file_number, ToxCore.FileControl control) throws ToxError {
202205
var args = Arguments.builder()
203206
.uint(friend_number)

src/tox/ToxAdapterConferenceListener.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ namespace Venom {
5050
this.session = session;
5151
session.set_conference_listener(this);
5252
friends = session.get_friends();
53+
var chatlist = session.conference_get_chatlist();
54+
foreach (var conference_number in chatlist) {
55+
on_conference_new(conference_number, "");
56+
}
5357
}
5458

5559
public virtual void on_remove_conference(IContact c) throws Error {

src/tox/ToxSession.vala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ namespace Venom {
8484
public abstract void conference_delete(uint32 conference_number) throws ToxError;
8585
public abstract void conference_invite(uint32 friend_number, uint32 conference_number) throws ToxError;
8686
public abstract void conference_join(uint32 friend_number, ConferenceType type, uint8[] cookie) throws ToxError;
87+
public abstract Gee.Iterable<uint32> conference_get_chatlist();
8788

8889
public abstract void conference_send_message(uint32 conference_number, string message) throws ToxError;
8990
public abstract void conference_set_title(uint32 conference_number, string title) throws ToxError;
@@ -838,6 +839,15 @@ namespace Venom {
838839
}
839840
}
840841

842+
public Gee.Iterable<uint32> conference_get_chatlist() {
843+
var chatlist = handle.conference_get_chatlist();
844+
var list = new Gee.ArrayList<uint32>();
845+
foreach (var c in chatlist) {
846+
list.add(c);
847+
}
848+
return list;
849+
}
850+
841851
public void @lock() {
842852
mutex.@lock();
843853
}

0 commit comments

Comments
 (0)