diff --git a/discordapi.h b/discordapi.h index 891d021..a1e576b 100755 --- a/discordapi.h +++ b/discordapi.h @@ -3,9 +3,9 @@ int DiscordSendMessage(const char *channelID, const char* content); int DiscordListGuildChannels(char* guildID, DiscordChannel** out); #define GUILD_TEXT 0 -#define CHANNEL_TYPE_DM 1 +#define DM_CHANNEL 1 #define GUILD_VOICE 2 -#define GROUPCHAT 3 +#define GROUPCHAT_CHANNEL 3 #define GUILD_CATEGORY 4 #define GUILD_ANNOUNCEMENT 5 int DiscordGetChannelHistory(const char* channelID, unsigned int amount, DiscordMessage** msgs); diff --git a/main.c b/main.c index 72cd4c6..10b79d9 100755 --- a/main.c +++ b/main.c @@ -72,6 +72,7 @@ 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_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)); hInstance = hinstance; @@ -272,6 +273,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, TVS_LINESATROOT | TVS_HASBUTTONS, 90, 0, 128, rc.bottom - rc.top - 80, hwnd, (HMENU)103, hInstance, NULL); + TreeView_SetImageList(hChTree, hChannelImgList, 0); hDMsList = CreateWindowExA( WS_EX_CLIENTEDGE, WC_LISTVIEWA, NULL, WS_CHILD | WS_VISIBLE, 90, 0, 128, rc.bottom - rc.top - 80, hwnd, (HMENU)103, hInstance, NULL); @@ -389,7 +391,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 == CHANNEL_TYPE_DM) { + if (dms[i].type == DM_CHANNEL) { printf("%s\n", dms[i].receipents[0].Username); if (dms[i].receipents[0].avatar) { @@ -456,7 +458,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, channel_compare, NULL, NULL); for (int i = 0; i < ChannelCount; i++) { char *VisualName; - VisualName = malloc(strlen(Channels[i].name+1)); + VisualName = malloc(strlen(Channels[i].name)+1); strcpy(VisualName, Channels[i].name); TVINSERTSTRUCT tvInsert = {0}; HTREEITEM hParent = TVI_ROOT; @@ -473,12 +475,18 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, tvInsert.hParent = hParent; // Parent is the root item tvInsert.hInsertAfter = TVI_LAST; tvInsert.item.mask = - TVIF_TEXT | TVIF_PARAM | TVIF_STATE; + TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE; tvInsert.item.pszText = (VisualName); 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{ + tvInsert.item.iImage=0; + } HTREEITEM lres = (HTREEITEM)SendMessage( hChTree, TVM_INSERTITEM, 0, (LPARAM)&tvInsert); if (Channels[i].type == GUILD_CATEGORY) { diff --git a/rc/res.h b/rc/res.h index 4049a05..e5da783 100644 --- a/rc/res.h +++ b/rc/res.h @@ -1,4 +1,5 @@ #define IDI_BACKCORDIC 101 #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 diff --git a/rc/res.o b/rc/res.o index 3ee846f..29e82c5 100644 Binary files a/rc/res.o and b/rc/res.o differ diff --git a/rc/res.rc b/rc/res.rc index d4231b6..653de46 100644 --- a/rc/res.rc +++ b/rc/res.rc @@ -2,5 +2,6 @@ IDI_BACKCORDIC RCDATA "backcord_icon.png" IDI_BACKCORDBANNERIC BITMAP "backcordbanner.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 diff --git a/rc/tc.bmp b/rc/tc.bmp new file mode 100644 index 0000000..a58ccf4 Binary files /dev/null and b/rc/tc.bmp differ