Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/ncipollo/release…
Browse files Browse the repository at this point in the history
…-action-1.15.0
  • Loading branch information
pajlada authored Jan 19, 2025
2 parents 791d571 + 169daf8 commit 05e0ec4
Show file tree
Hide file tree
Showing 26 changed files with 928 additions and 179 deletions.
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
trailingComma: es5
endOfLine: auto
overrides:
- files: "*.ts"
options:
tabWidth: 4
- files: "*.md"
options:
proseWrap: preserve
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
- Bugfix: Fixed a crash relating to Lua HTTP. (#5800)
- Bugfix: Fixed a crash that could occur on Linux and macOS when clicking "Install" from the update prompt. (#5818)
- Bugfix: Fixed missing word wrap in update popup. (#5811)
- Bugfix: Fixed tabs not scaling to the default scale when changing the scale from a non-default value. (#5794)
- Bugfix: Closing a usercard will no longer cause stop-logging messages to be generated in channel logs. (#5828)
- Bugfix: Fixed tabs not scaling to the default scale when changing the scale from a non-default value. (#5794, #5833)
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
- Dev: Updated Conan dependencies. (#5776)
- Dev: Replaced usage of `parseTime` with `serverReceivedTime` for clearchat messages. (#5824)
- Dev: Support Boost 1.87. (#5832)

## 2.5.2
Expand Down
257 changes: 128 additions & 129 deletions docs/chatterino.d.ts
Original file line number Diff line number Diff line change
@@ -1,133 +1,132 @@
/** @noSelfInFile */

declare module c2 {
enum LogLevel {
Debug,
Info,
Warning,
Critical,
}
class CommandContext {
words: String[];
channel: Channel;
}

enum Platform {
Twitch,
}
enum ChannelType {
None,
Direct,
Twitch,
TwitchWhispers,
TwitchWatching,
TwitchMentions,
TwitchLive,
TwitchAutomod,
Irc,
Misc,
}

interface IWeakResource {
is_valid(): boolean;
}

interface ISharedResource {}

class RoomModes {
unique_chat: boolean;
subscriber_only: boolean;
emotes_only: boolean;
follower_only: null | number;
slow_mode: null | number;
}
class StreamStatus {
live: boolean;
viewer_count: number;
uptime: number;
title: string;
game_name: string;
game_id: string;
}

class Channel implements IWeakResource {
is_valid(): boolean;
get_name(): string;
get_type(): ChannelType;
get_display_name(): string;
send_message(message: string, execute_commands: boolean): void;
add_system_message(message: string): void;

is_twitch_channel(): boolean;

get_room_modes(): RoomModes;
get_stream_status(): StreamStatus;
get_twitch_id(): string;
is_broadcaster(): boolean;
is_mod(): boolean;
is_vip(): boolean;

static by_name(name: string, platform: Platform): null | Channel;
static by_twitch_id(id: string): null | Channel;
}

enum HTTPMethod {
Get,
Post,
Put,
Delete,
Patch,
}

class HTTPResponse implements ISharedResource {
data(): string;
status(): number | null;
error(): string;
}

type HTTPCallback = (res: HTTPResponse) => void;
class HTTPRequest implements ISharedResource {
on_success(callback: HTTPCallback): void;
on_error(callback: HTTPCallback): void;
finally(callback: () => void): void;

set_timeout(millis: number): void;
set_payload(data: string): void;
set_header(name: string, value: string): void;

execute(): void;

// might error
static create(method: HTTPMethod, url: string): HTTPRequest;
}

function log(level: LogLevel, ...data: any[]): void;
function register_command(
name: String,
handler: (ctx: CommandContext) => void
): boolean;

class CompletionEvent {
query: string;
full_text_content: string;
cursor_position: number;
is_first_word: boolean;
}

class CompletionList {
values: String[];
hide_others: boolean;
}

enum EventType {
CompletionRequested = "CompletionRequested",
}

type CbFuncCompletionsRequested = (ev: CompletionEvent) => CompletionList;
type CbFunc<T> = T extends EventType.CompletionRequested
? CbFuncCompletionsRequested
: never;

function register_callback<T>(type: T, func: CbFunc<T>): void;
function later(callback: () => void, msec: number): void;
enum LogLevel {
Debug,
Info,
Warning,
Critical,
}
class CommandContext {
words: string[];
channel: Channel;
}

enum ChannelType {
None,
Direct,
Twitch,
TwitchWhispers,
TwitchWatching,
TwitchMentions,
TwitchLive,
TwitchAutomod,
Misc,
}

interface IWeakResource {
is_valid(): boolean;
}

interface ISharedResource {}

class RoomModes {
unique_chat: boolean;
subscriber_only: boolean;
emotes_only: boolean;
follower_only: null | number;
slow_mode: null | number;
}
class StreamStatus {
live: boolean;
viewer_count: number;
uptime: number;
title: string;
game_name: string;
game_id: string;
}

class Channel implements IWeakResource {
is_valid(): boolean;
get_name(): string;
get_type(): ChannelType;
get_display_name(): string;

send_message(message: string, execute_commands: boolean): void;
send_message(message: string): void;

add_system_message(message: string): void;

is_twitch_channel(): boolean;

get_room_modes(): RoomModes;
get_stream_status(): StreamStatus;
get_twitch_id(): string;
is_broadcaster(): boolean;
is_mod(): boolean;
is_vip(): boolean;

static by_name(name: string): null | Channel;
static by_twitch_id(id: string): null | Channel;
}

enum HTTPMethod {
Get,
Post,
Put,
Delete,
Patch,
}

class HTTPResponse implements ISharedResource {
data(): string;
status(): number | null;
error(): string;
}

type HTTPCallback = (res: HTTPResponse) => void;
class HTTPRequest implements ISharedResource {
on_success(callback: HTTPCallback): void;
on_error(callback: HTTPCallback): void;
finally(callback: () => void): void;

set_timeout(millis: number): void;
set_payload(data: string): void;
set_header(name: string, value: string): void;

execute(): void;

// might error
static create(method: HTTPMethod, url: string): HTTPRequest;
}

function log(level: LogLevel, ...data: any[]): void;
function register_command(
name: string,
handler: (ctx: CommandContext) => void
): boolean;

class CompletionEvent {
query: string;
full_text_content: string;
cursor_position: number;
is_first_word: boolean;
}

class CompletionList {
values: string[];
hide_others: boolean;
}

enum EventType {
CompletionRequested = "CompletionRequested",
}

type CbFuncCompletionsRequested = (ev: CompletionEvent) => CompletionList;
type CbFunc<T> = T extends EventType.CompletionRequested
? CbFuncCompletionsRequested
: never;

function register_callback<T>(type: T, func: CbFunc<T>): void;
function later(callback: () => void, msec: number): void;
}
2 changes: 2 additions & 0 deletions docs/plugin-meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ c2.ChannelType = {
---@field subscriber_only boolean
---@field unique_chat boolean You might know this as r9kbeta or robot9000.
---@field emotes_only boolean Whether or not text is allowed in messages. Note that "emotes" here only means Twitch emotes, not Unicode emoji, nor 3rd party text-based emotes
---@field follower_only number? Time in minutes you need to follow to chat or nil.
---@field slow_mode number? Time in seconds you need to wait before sending messages or nil.

-- End src/providers/twitch/TwitchChannel.hpp

Expand Down
2 changes: 1 addition & 1 deletion lib/expected-lite
2 changes: 1 addition & 1 deletion lib/settings
7 changes: 4 additions & 3 deletions src/common/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Channel::Channel(const QString &name, Type type)
Channel::~Channel()
{
auto *app = tryGetApp();
if (app)
if (app && this->anythingLogged_)
{
app->getChatLogger()->closeChannel(this->name_, this->platform_);
}
Expand Down Expand Up @@ -106,6 +106,7 @@ void Channel::addMessage(MessagePtr message, MessageContext context,
getApp()->getChatLogger()->addMessage(this->name_, message,
this->platform_,
this->getCurrentStreamID());
this->anythingLogged_ = true;
}
}

Expand All @@ -123,7 +124,7 @@ void Channel::addSystemMessage(const QString &contents)
this->addMessage(msg, MessageContext::Original);
}

void Channel::addOrReplaceTimeout(MessagePtr message, QTime now)
void Channel::addOrReplaceTimeout(MessagePtr message, const QDateTime &now)
{
addOrReplaceChannelTimeout(
this->getMessageSnapshot(), std::move(message), now,
Expand All @@ -139,7 +140,7 @@ void Channel::addOrReplaceTimeout(MessagePtr message, QTime now)
// WindowManager::instance().repaintVisibleChatWidgets(this);
}

void Channel::addOrReplaceClearChat(MessagePtr message, QTime now)
void Channel::addOrReplaceClearChat(MessagePtr message, const QDateTime &now)
{
addOrReplaceChannelClear(
this->getMessageSnapshot(), std::move(message), now,
Expand Down
5 changes: 3 additions & 2 deletions src/common/Channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ class Channel : public std::enable_shared_from_this<Channel>, public MessageSink
/// Inserts the given messages in order by Message::serverReceivedTime.
void fillInMissingMessages(const std::vector<MessagePtr> &messages);

void addOrReplaceTimeout(MessagePtr message, QTime now) final;
void addOrReplaceClearChat(MessagePtr message, QTime now) final;
void addOrReplaceTimeout(MessagePtr message, const QDateTime &now) final;
void addOrReplaceClearChat(MessagePtr message, const QDateTime &now) final;
void disableAllMessages() final;
void replaceMessage(const MessagePtr &message,
const MessagePtr &replacement);
Expand Down Expand Up @@ -143,6 +143,7 @@ class Channel : public std::enable_shared_from_this<Channel>, public MessageSink
const QString name_;
LimitedQueue<MessagePtr> messages_;
Type type_;
bool anythingLogged_ = false;
QTimer clearCompletionModelTimer_;
};

Expand Down
Loading

0 comments on commit 05e0ec4

Please sign in to comment.