diff --git a/application/ChatOMatic.rdef b/application/ChatOMatic.rdef index 8f55a60..9b252a9 100644 --- a/application/ChatOMatic.rdef +++ b/application/ChatOMatic.rdef @@ -16,3 +16,18 @@ resource app_flags B_SINGLE_LAUNCH; resource file_types message; +resource vector_icon { + $"6E636966040500020106033D835C3C19B2BA8B0B3C20794769624A510E00FFFF" + $"FFB4FFE405FFFFA405020106023D835C3C19B2BA8B0B3C20794769624A510E00" + $"FFE405FFFFA405020106033D429E3C5148BB5ADA3C5C1B4A23AA46EC1800FFFF" + $"FFB47FE583FF04B10C0902093F404644383C273F2E3A244122482245224D2755" + $"245126572256245725582A5828592C5A315C2F5B345D3C5E385E425E4957475C" + $"4D4E02043F4044433D3FBC95BE953B3D333D3D493844424E4A5148534A4A0403" + $"3B2F4E2F4E2D4E2A4D2F532D522F530003334F334F364F345337533755325636" + $"59325602085645C8FEC3AFCA30C0E55E3A5E405EBA4D52B58359B71B4AB38537" + $"B51D3EB31FBA16B69933353130363E4A4641444D475346C657C27B554BCB01C6" + $"35584F5A4F080239BA0539BA6B0802BD1CBC1DBD2FBCA908023E37423904032E" + $"4535473C4739473F4540070A000100123FFFFE2FDACEAFDACE3FFFFE3AB6A5B8" + $"4CC101178400040A010100000A020101000A000202031001178210040A000104" + $"1001178400040A030104000A000407050608100117821004" +}; diff --git a/application/windows/MainWindow.cpp b/application/windows/MainWindow.cpp index 02e1149..ab41e8e 100644 --- a/application/windows/MainWindow.cpp +++ b/application/windows/MainWindow.cpp @@ -23,6 +23,8 @@ #include #include +#include + #include "AccountDialog.h" #include "AccountsWindow.h" #include "AppMessages.h" @@ -683,7 +685,12 @@ ConversationItem* MainWindow::_EnsureConversationItem(BMessage* msg) { BString chat_id = msg->FindString("chat_id"); - Conversation* chat = Server::Get()->ConversationById(chat_id, msg->FindInt64("instance")); + int64 conversation_id = msg->FindInt64("instance"); + Conversation* chat = Server::Get()->ConversationById(chat_id, conversation_id); + if (chat == NULL) { + printf("error: Conversation %" B_PRId64 " in '%s' not found!\n", conversation_id, chat_id); + return NULL; + } _EnsureConversationView(chat); diff --git a/data/icons/AppIcon b/data/icons/AppIcon index 5e6c414..88531c4 100644 Binary files a/data/icons/AppIcon and b/data/icons/AppIcon differ diff --git a/data/icons/AppIcon.png b/data/icons/AppIcon.png index 4c634e2..b4d7524 100644 Binary files a/data/icons/AppIcon.png and b/data/icons/AppIcon.png differ diff --git a/data/icons/AppIcon.rdef b/data/icons/AppIcon.rdef index 50337a7..e488731 100644 --- a/data/icons/AppIcon.rdef +++ b/data/icons/AppIcon.rdef @@ -1,19 +1,16 @@ resource vector_icon array { - $"6E6369660E05000200060237E670B8880E39469D39AE144A52234B0D2500C6D7" - $"F5FF6B94DD03EC6666020006023B2B47BB18653D0FA53D225148297046CA1900" - $"FFEC4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FFFF" - $"FFFFFFF289020006023C71E33A0C78BA15E43C7D2149055549455700E3EDFFFF" - $"9EC2FF03FFACAC020006023A1DA6393F04BBB5BC3C6B074AEA3648091100F99B" - $"05FFFCB23D03003CB00200060230B31E3A09B9BB024238A12F4BAB534AFF0B00" - $"A3043CFFFFDCE603CD4D4D030D296402000602BD498B3E1159BF219BBE7D2F4B" - $"E71F4AB31300C13E3EFFE27A7A0401740D0A06322E323E42464C3C4C2C3D260A" - $"04322E323E424642350A04322E42354C2C3D260A04423542464C3C4C2C0A0338" - $"423C4D3C440A08335C395C41544F5C555C6051594D3E510A0422422252325A32" - $"490A04224232493C402D3A0A043249325A3C503C400A043E42C35DC27AC751BE" - $"F3493A0A04C35DC27A4E495840C751BEF30A05424BC08BC7B74E5A4E49C35DC2" - $"7A0A053E423E52C08BC7B7424BC35DC27A100A0D0105000A0001003010340117" - $"8400040A0101012010340A0801032010340A0B01042020210A010107000A0001" - $"00302C3401178400040A02010B000A0A010C000A090103202C340A06010A000A" - $"0C0109000A0001001001178400040A030101000A040102000A07010300" + $"6E636966040500020106033D835C3C19B2BA8B0B3C20794769624A510E00FFFF" + $"FFB4FFE405FFFFA405020106023D835C3C19B2BA8B0B3C20794769624A510E00" + $"FFE405FFFFA405020106033D429E3C5148BB5ADA3C5C1B4A23AA46EC1800FFFF" + $"FFB47FE583FF04B10C0902093F404644383C273F2E3A244122482245224D2755" + $"245126572256245725582A5828592C5A315C2F5B345D3C5E385E425E4957475C" + $"4D4E02043F4044433D3FBC95BE953B3D333D3D493844424E4A5148534A4A0403" + $"3B2F4E2F4E2D4E2A4D2F532D522F530003334F334F364F345337533755325636" + $"59325602085645C8FEC3AFCA30C0E55E3A5E405EBA4D52B58359B71B4AB38537" + $"B51D3EB31FBA16B69933353130363E4A4641444D475346C657C27B554BCB01C6" + $"35584F5A4F080239BA0539BA6B0802BD1CBC1DBD2FBCA908023E37423904032E" + $"4535473C4739473F4540070A000100123FFFFE2FDACEAFDACE3FFFFE3AB6A5B8" + $"4CC101178400040A010100000A020101000A000202031001178210040A000104" + $"1001178400040A030104000A000407050608100117821004" }; diff --git a/protocols/matrix/Makefile b/protocols/matrix/Makefile index 31506a7..78c6dc0 100644 --- a/protocols/matrix/Makefile +++ b/protocols/matrix/Makefile @@ -65,7 +65,7 @@ RSRCS = # - if your library does not follow the standard library naming scheme, # you need to specify the path to the library and it's name. # (e.g. for mylib.a, specify "mylib.a" or "path/mylib.a") -LIBS = be bnetapi localestub interface matrix_client network $(STDCPPLIBS) +LIBS = be bnetapi localestub interface matrix_client spdlog network $(STDCPPLIBS) # Specify additional paths to directories following the standard libXXX.so @@ -116,7 +116,7 @@ SYMBOLS := DEBUGGER := # Specify any additional compiler flags to be used. -COMPILER_FLAGS = -std=c++17 +COMPILER_FLAGS = -std=c++20 `pkg-config --cflags spdlog` # Specify any additional linker flags to be used. LINKER_FLAGS = diff --git a/protocols/matrix/MatrixApp.cpp b/protocols/matrix/MatrixApp.cpp index 94bca1a..d44a0d4 100644 --- a/protocols/matrix/MatrixApp.cpp +++ b/protocols/matrix/MatrixApp.cpp @@ -153,6 +153,12 @@ MatrixApp::StartLoop() status.AddInt32("status", (int32)STATUS_ONLINE); SendMessage(status); + BMessage syncStatus(IM_MESSAGE); + syncStatus.AddInt32("im_what", IM_MESSAGE_RECEIVED); + syncStatus.AddString("user_name", APP_NAME); + syncStatus.AddString("body", B_TRANSLATE("Synchronizing with Matrix server. Please wait...")); + SendMessage(syncStatus); + mtx::http::SyncOpts opts; opts.timeout = 0; client->sync(opts, &initial_sync_handler); @@ -276,6 +282,20 @@ room_sync(mtx::responses::Rooms rooms) app->fRoomList.Add(BString(chat_id)); } + // Grab the latest room metadata + BMessage metadataMsg(IM_MESSAGE); + metadataMsg.AddInt32("im_what", IM_ROOM_METADATA); + metadataMsg.AddString("chat_id", chat_id); + for (const auto &e : room.state.events) { + auto ev = std::get_if>(&e); + if (ev != nullptr) { + metadataMsg.AddString("chat_name", ev->content.name.c_str()); + break; + } + } + ((MatrixApp*)be_app)->SendMessage(metadataMsg); + + // Grab the room timeline and add it for (mtx::events::collections::TimelineEvents &ev : room.timeline.events) if (auto event = std::get_if>(&ev); event != nullptr) @@ -283,6 +303,7 @@ room_sync(mtx::responses::Rooms rooms) BMessage msg(IM_MESSAGE); msg.AddInt32("im_what", IM_MESSAGE_RECEIVED); msg.AddString("body", event->content.body.c_str()); + msg.AddInt64("when", event->origin_server_ts / 1000); msg.AddString("chat_id", chat_id); msg.AddString("user_id", event->sender.c_str()); app->SendMessage(msg);