Skip to content

Commit cf6228e

Browse files
committed
Add IRC auth, command, and stability improvements
Expand the chat and IRC flow with command handling, SASL support, alt nick fallback, and session persistence fixes. Also prevent the CodeQL workflow from failing on private repositories without GHAS.
1 parent d9a6716 commit cf6228e

17 files changed

+1244
-35
lines changed

.github/workflows/codeql.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,21 @@ on:
99
- cron: '0 3 * * 1'
1010

1111
jobs:
12+
codeql-disabled:
13+
name: CodeQL Disabled
14+
runs-on: ubuntu-latest
15+
if: ${{ github.event.repository.private && vars.ENABLE_PRIVATE_CODEQL != 'true' }}
16+
17+
steps:
18+
- name: Explain why CodeQL is skipped
19+
run: |
20+
echo "Skipping CodeQL because this repository is private and GitHub Advanced Security is not enabled."
21+
echo "Enable GitHub Advanced Security, then set the ENABLE_PRIVATE_CODEQL repository variable to true."
22+
1223
analyze:
1324
name: Analyze
1425
runs-on: ubuntu-latest
26+
if: ${{ github.event.repository.private == false || vars.ENABLE_PRIVATE_CODEQL == 'true' }}
1527

1628
permissions:
1729
actions: read

lib/core/models/chat_tab.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ class ChatTab {
1717
final bool hasActivity;
1818
final bool isEncrypted;
1919

20+
ChatTab copyWith({
21+
String? id,
22+
String? name,
23+
ChatTabType? type,
24+
String? networkId,
25+
bool? hasActivity,
26+
bool? isEncrypted,
27+
}) {
28+
return ChatTab(
29+
id: id ?? this.id,
30+
name: name ?? this.name,
31+
type: type ?? this.type,
32+
networkId: networkId ?? this.networkId,
33+
hasActivity: hasActivity ?? this.hasActivity,
34+
isEncrypted: isEncrypted ?? this.isEncrypted,
35+
);
36+
}
37+
2038
Map<String, Object?> toJson() {
2139
return {
2240
'id': id,

lib/core/models/network_config.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ class NetworkConfig {
55
required this.host,
66
required this.port,
77
required this.nickname,
8+
this.altNickname,
89
this.username = 'androidircx',
910
this.realName = 'AndroidIRCX',
1011
this.useTls = true,
1112
this.password,
13+
this.saslAccount,
14+
this.saslPassword,
1215
this.autoConnect = false,
1316
});
1417

@@ -17,10 +20,13 @@ class NetworkConfig {
1720
final String host;
1821
final int port;
1922
final String nickname;
23+
final String? altNickname;
2024
final String username;
2125
final String realName;
2226
final bool useTls;
2327
final String? password;
28+
final String? saslAccount;
29+
final String? saslPassword;
2430
final bool autoConnect;
2531

2632
NetworkConfig copyWith({
@@ -29,10 +35,13 @@ class NetworkConfig {
2935
String? host,
3036
int? port,
3137
String? nickname,
38+
String? altNickname,
3239
String? username,
3340
String? realName,
3441
bool? useTls,
3542
String? password,
43+
String? saslAccount,
44+
String? saslPassword,
3645
bool? autoConnect,
3746
}) {
3847
return NetworkConfig(
@@ -41,10 +50,13 @@ class NetworkConfig {
4150
host: host ?? this.host,
4251
port: port ?? this.port,
4352
nickname: nickname ?? this.nickname,
53+
altNickname: altNickname ?? this.altNickname,
4454
username: username ?? this.username,
4555
realName: realName ?? this.realName,
4656
useTls: useTls ?? this.useTls,
4757
password: password ?? this.password,
58+
saslAccount: saslAccount ?? this.saslAccount,
59+
saslPassword: saslPassword ?? this.saslPassword,
4860
autoConnect: autoConnect ?? this.autoConnect,
4961
);
5062
}
@@ -56,10 +68,13 @@ class NetworkConfig {
5668
'host': host,
5769
'port': port,
5870
'nickname': nickname,
71+
'altNickname': altNickname,
5972
'username': username,
6073
'realName': realName,
6174
'useTls': useTls,
6275
'password': password,
76+
'saslAccount': saslAccount,
77+
'saslPassword': saslPassword,
6378
'autoConnect': autoConnect,
6479
};
6580
}
@@ -71,10 +86,13 @@ class NetworkConfig {
7186
host: json['host']! as String,
7287
port: (json['port']! as num).toInt(),
7388
nickname: json['nickname']! as String,
89+
altNickname: json['altNickname'] as String?,
7490
username: (json['username'] as String?) ?? 'androidircx',
7591
realName: (json['realName'] as String?) ?? 'AndroidIRCX',
7692
useTls: (json['useTls'] as bool?) ?? true,
7793
password: json['password'] as String?,
94+
saslAccount: json['saslAccount'] as String?,
95+
saslPassword: json['saslPassword'] as String?,
7896
autoConnect: (json['autoConnect'] as bool?) ?? false,
7997
);
8098
}

lib/core/storage/in_memory_network_repository.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class InMemoryNetworkRepository implements NetworkRepository {
1515
host: 'irc.dbase.in.rs',
1616
port: 6697,
1717
nickname: 'AndroidIRCX',
18+
altNickname: 'AndroidIRCX_',
1819
useTls: true,
1920
),
2021
];

lib/core/storage/shared_prefs_network_repository.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class SharedPrefsNetworkRepository implements NetworkRepository {
5555
host: 'irc.dbase.in.rs',
5656
port: 6697,
5757
nickname: 'AndroidIRCX',
58+
altNickname: 'AndroidIRCX_',
5859
useTls: true,
5960
),
6061
];

0 commit comments

Comments
 (0)