From d7221c72277496d8f8d672275f677af4bc45eea9 Mon Sep 17 00:00:00 2001 From: winsped <248554933+snow32a@users.noreply.github.com> Date: Wed, 22 Jul 2026 00:36:56 +0300 Subject: [PATCH] Further iconized the channels, TRIED TO fix the broken attachement message height, the fix seems to be via just implementing them --- components/chatwnd.c | 7 ++++++- discordapi.h | 5 +++-- main.c | 29 ++++++++++++++++++++++------- rc/category.bmp | Bin 0 -> 822 bytes rc/forum.bmp | Bin 0 -> 822 bytes rc/res.h | 4 +++- rc/res.o | Bin 145020 -> 146752 bytes rc/res.rc | 4 +++- 8 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 rc/category.bmp create mode 100644 rc/forum.bmp diff --git a/components/chatwnd.c b/components/chatwnd.c index e6e3423..631c85e 100755 --- a/components/chatwnd.c +++ b/components/chatwnd.c @@ -234,11 +234,16 @@ LRESULT CALLBACK ChatWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, for (int i = 0; i < cwnd->uimsgcnt; i++) { RECT contr = {0, 0, clientRect.right - clientRect.left - 6 - 6 - 40, 0}; + if (strlen(cwnd->uimsgs[i].msg.content) == 0) { + msgdet[i].TextContentHeight = 0; + } + else{ DrawTextA(hdc, cwnd->uimsgs[i].msg.content, strlen(cwnd->uimsgs[i].msg.content), &contr, DT_CALCRECT | DT_WORDBREAK); - // printf("%i | %i\n", i, contr.bottom - contr.top); msgdet[i].TextContentHeight = contr.bottom - contr.top; + } + // printf("%i | %i\n", i, contr.bottom - contr.top); msgdet[i].StartMsg = IsStartMsg(cwnd, i); if (msgdet[i].StartMsg) { diff --git a/discordapi.h b/discordapi.h index a1e576b..4c60478 100755 --- a/discordapi.h +++ b/discordapi.h @@ -3,11 +3,12 @@ int DiscordSendMessage(const char *channelID, const char* content); int DiscordListGuildChannels(char* guildID, DiscordChannel** out); #define GUILD_TEXT 0 -#define DM_CHANNEL 1 +#define CHANNEL_DM 1 #define GUILD_VOICE 2 -#define GROUPCHAT_CHANNEL 3 +#define CHANNEL_GC 3 #define GUILD_CATEGORY 4 #define GUILD_ANNOUNCEMENT 5 +#define GUILD_FORUM 15 int DiscordGetChannelHistory(const char* channelID, unsigned int amount, DiscordMessage** msgs); char *DiscordFetchTmpPfp(char *userID, char *hash); char *DiscordFetchTmpGuildIcon(char *guildID, char *hash); diff --git a/main.c b/main.c index 10b79d9..16f1d43 100755 --- a/main.c +++ b/main.c @@ -72,9 +72,11 @@ int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, PSTR pCmdLine, InitSnowsControls(); hSidePfps = ImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 12, 1); hChannelImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 8, 1); + ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_CATEGORY)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_TC)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_VC)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_ANC)),RGB(255,0,255)); + ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_FORUM)),RGB(255,0,255)); hInstance = hinstance; // register the window claws const char CLASS_NAME[] = "BackcordMain"; @@ -391,7 +393,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, HTREEITEM hParent = TVI_ROOT; int pfpidx = 0; for (int i = 0; i < cnt; i++) { - if (dms[i].type == DM_CHANNEL) { + if (dms[i].type == CHANNEL_DM) { printf("%s\n", dms[i].receipents[0].Username); if (dms[i].receipents[0].avatar) { @@ -451,6 +453,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, DiscordChannel *Channels; int ChannelCount = DiscordListGuildChannels(guild->id, &Channels); + TreeView_SelectItem(hChTree, NULL); TreeView_DeleteAllItems(hChTree); //TreeView_SetImageList(hChTree, hChannelImgList, TVSIL_NORMAL); struct hashmap *ChannelUITable = @@ -480,13 +483,18 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, tvInsert.item.lParam = (LPARAM) & (Channels[i]); tvInsert.item.state = TVIS_EXPANDED; tvInsert.item.stateMask = TVIS_EXPANDED; - if(Channels[i].type==GUILD_VOICE){ - tvInsert.item.iImage=1; - }else if(Channels[i].type==GUILD_ANNOUNCEMENT){ - tvInsert.item.iImage=2; - }else{ + if(Channels[i].type==GUILD_CATEGORY){ tvInsert.item.iImage=0; } + else if(Channels[i].type==GUILD_VOICE){ + tvInsert.item.iImage=2; + }else if(Channels[i].type==GUILD_ANNOUNCEMENT){ + tvInsert.item.iImage=3; + }else if(Channels[i].type==GUILD_FORUM){ + tvInsert.item.iImage=4; + }else{ + tvInsert.item.iImage=1; + } HTREEITEM lres = (HTREEITEM)SendMessage( hChTree, TVM_INSERTITEM, 0, (LPARAM)&tvInsert); if (Channels[i].type == GUILD_CATEGORY) { @@ -503,9 +511,16 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, pnmv->itemNew.state & TVIS_SELECTED) { DiscordChannel *chnl = ((DiscordChannel *)pnmv->itemNew.lParam); if (chnl->type != GUILD_CATEGORY) { - char *title = malloc(13 + strlen(chnl->name)); + char *title = NULL; + if(chnl->type==CHANNEL_DM){ + title = malloc(12 + strlen(chnl->receipents[0].DisplayName)); + wsprintf(title, "Backcord - %s", chnl->receipents[0].DisplayName); + SetWindowTextA(hwnd, title); + }else{ + title = malloc(13 + strlen(chnl->name)); wsprintf(title, "Backcord - #%s", chnl->name); SetWindowTextA(hwnd, title); + } DiscordMessage *msgs; int msgcnt = DiscordGetChannelHistory(chnl->id, 50, &msgs); ClearChatControl(hMsgList); diff --git a/rc/category.bmp b/rc/category.bmp new file mode 100644 index 0000000000000000000000000000000000000000..aeb6ff9bd9a66477513da76bdfd78fbde589fbc0 GIT binary patch literal 822 zcmZ?rHDhJ~12YB&1`P%V1_3B$WRL)hGcYqS2ysI&M1XZ~2M!#7`21(?BzDFO*kNaBQOcW7w9kKn0-NL&6h{09I!mt@WW literal 0 HcmV?d00001 diff --git a/rc/res.h b/rc/res.h index e5da783..d63d211 100644 --- a/rc/res.h +++ b/rc/res.h @@ -2,4 +2,6 @@ #define IDI_BACKCORDBANNERIC 102 #define IDI_CHANNEL_TC 110 #define IDI_CHANNEL_VC 111 -#define IDI_CHANNEL_ANC 112 \ No newline at end of file +#define IDI_CHANNEL_ANC 112 +#define IDI_CHANNEL_FORUM 113 +#define IDI_CHANNEL_CATEGORY 114 \ No newline at end of file diff --git a/rc/res.o b/rc/res.o index 29e82c5e343f7f3a625de06b7eec427b2431e8ec..f11aee1cdf10dfaead3b1bccc4f18e7483b1a71a 100644 GIT binary patch delta 1797 zcmezKhU3654lW-?Mg|bjvYp5!CAh+diNS_}f#Hb_6G)JOeWIzd;|B(Y1~3m!urZ`D zFfb%AFf`;bFfddwFf`;dFfdGDU}z{{U|?9mz|c_0z`$^TfuW&@fq~)1WJX5miC07z z4JKX`XLJA&0U#m)L=;TCC|sY)z`(%4h;9ob11AduLjxlN!vsbKh8hQmLqU!ZaAIW8 zU9}mToB3`Jls*$7kHuYnHgsIHpek;k7Hy!<~se2Bco4MITQuQE-hX4POr5P9yf)FXJBqU`1Gl0y+ssK%pfq}uH z0UGfTDFz0H=_1aIq8@NAngWP8E)vr~ke4K=Yg#?Tc1*h<;7d||0-43d{GZ`JZ4xHLad^lBD4-t1!=oBKIEYC0 z$Ueqz@_&Z^^$-g{u0X>0wSl4q3FB7`F(0QItOWz8tV43mfddC{>IWApNR9z9@hd)X z-~inG{|xnn%O#MJU`)^*5R1WTK?E`Cq2UiwPDIo~ETAUI3J$>SD(;K|?`;*JMLau$ a0h|S^CD<7P;9?1IRso#VFg@0cNge>lq-%x% delta 315 zcmX@`i{sB54lW-?Mg|Z_Gn>dICHTXXiNS_}fx*O#2_(qCI?+_QeggwT1DFRVSQye6 z7#IQ=7#i{z7#K1b7#i{!z=|3Q7#J94fSGW`3=9m644fCeD<0GGJt2sBwVEg0yXLWMt4_2C*Rch6^LZ2?!HRE^uXJ za6u?%c;VK(k8%4xM#f{V+pqXC3cS~ZIgOnG<`{O6tHHY283dqu*%=h3E7~&20{{UR BCmjF) diff --git a/rc/res.rc b/rc/res.rc index 653de46..93f9f2c 100644 --- a/rc/res.rc +++ b/rc/res.rc @@ -2,6 +2,8 @@ IDI_BACKCORDIC RCDATA "backcord_icon.png" IDI_BACKCORDBANNERIC BITMAP "backcordbanner.bmp" +IDI_CHANNEL_CATEGORY BITMAP "category.bmp" IDI_CHANNEL_TC BITMAP "tc.bmp" IDI_CHANNEL_VC BITMAP "vc.bmp" -IDI_CHANNEL_ANC BITMAP "anc.bmp" \ No newline at end of file +IDI_CHANNEL_ANC BITMAP "anc.bmp" +IDI_CHANNEL_FORUM BITMAP "forum.bmp" \ No newline at end of file