(irc) Default room of #haiku for OFTC

This commit is contained in:
Jaidyn Ann 2021-08-18 23:05:57 -05:00
parent f486588c48
commit a9eeaa51fe
2 changed files with 16 additions and 14 deletions

View File

@ -22,6 +22,7 @@
#include <Cardie.h> #include <Cardie.h>
#include <ChatProtocolMessages.h> #include <ChatProtocolMessages.h>
#include <Flags.h> #include <Flags.h>
#include <Utils.h>
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
@ -876,6 +877,7 @@ IrcProtocol::_MakeReady(BString nick, BString ident)
_SendIrc("MOTD\n"); _SendIrc("MOTD\n");
_LoadContacts(); _LoadContacts();
_JoinDefaultRooms();
} }
@ -1241,25 +1243,25 @@ IrcProtocol::_RoleTitle(UserRole role)
const char* const char*
IrcProtocol::_CachePath() IrcProtocol::_ContactsCache()
{ {
BPath path; BPath path(AccountCachePath(fName));
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) path.Append("contact_list");
return NULL;
path.Append(APP_NAME "/Cache/Accounts");
path.Append(fName);
if (create_directory(path.Path(), 0755) != B_OK)
return NULL;
return path.Path(); return path.Path();
} }
const char* void
IrcProtocol::_ContactsCache() IrcProtocol::_JoinDefaultRooms()
{ {
BPath path(_CachePath()); // Hardcoded default room… I'm so awful, aren't I? ;-)
path.Append("contact_list"); if (fServer == "irc.oftc.net") {
return path.Path(); BFile room(RoomCachePath(fName, "#haiku"), B_READ_ONLY);
if (room.InitCheck() != B_OK) {
BString cmd("JOIN #haiku");
_SendIrc(cmd);
}
}
} }

View File

@ -102,8 +102,8 @@ private:
int32 _RolePerms(UserRole role); int32 _RolePerms(UserRole role);
const char* _RoleTitle(UserRole role); const char* _RoleTitle(UserRole role);
const char* _CachePath();
const char* _ContactsCache(); const char* _ContactsCache();
void _JoinDefaultRooms();
// Read a data stream until newline found; if data found past // Read a data stream until newline found; if data found past
// newline, append to given buffer for later use // newline, append to given buffer for later use