Skip to content

Commit

Permalink
less errors
Browse files Browse the repository at this point in the history
Lopging level changed and the namespace back to ai6bh as attalk fails .. WHY ?? No idea yet
  • Loading branch information
cconstab committed Jul 31, 2022
1 parent 05a7666 commit b8bb69c
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 30 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "at_talk",
"request": "launch",
"type": "dart",
"program": "bin/at_talk.dart",
"args": ["-a", "@acidrock2", "-t", "@iot_device03"]

}
]
}
42 changes: 29 additions & 13 deletions bin/at_talk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:at_talk/check_file_exists.dart';
void main(List<String> args) async {
//starting secondary in a zone
var logger = AtSignLogger('atTalk sender ');
logger.logger.level = Level.SHOUT;
runZonedGuarded(() async {
await atTalk(args);
}, (error, stackTrace) {
Expand All @@ -36,10 +37,16 @@ Future<void> atTalk(List<String> args) async {
var parser = ArgParser();
// Args
parser.addOption('key-file',
abbr: 'k', mandatory: false, help: 'Your @sign\'s atKeys file if not in ~/.atsign/keys/');
abbr: 'k',
mandatory: false,
help: 'Your @sign\'s atKeys file if not in ~/.atsign/keys/');
parser.addOption('atsign', abbr: 'a', mandatory: true, help: 'Your atSign');
parser.addOption('toatsign', abbr: 't', mandatory: true, help: 'Talk to this @sign');
parser.addOption('root-domain', abbr: 'd', mandatory: false, help: 'Root Domain (defaults to root.atsign.org)');
parser.addOption('toatsign',
abbr: 't', mandatory: true, help: 'Talk to this @sign');
parser.addOption('root-domain',
abbr: 'd',
mandatory: false,
help: 'Root Domain (defaults to root.atsign.org)');
parser.addFlag('verbose', abbr: 'v', help: 'More logging');

// Check the arguments
Expand All @@ -49,7 +56,7 @@ Future<void> atTalk(List<String> args) async {
String fromAtsign = 'unknown';
String toAtsign = 'unknown';
String? homeDirectory = getHomeDirectory();
String nameSpace = 'attalk';
String nameSpace = 'ai6bh';
String rootDomain = 'root.atsign.org';

try {
Expand Down Expand Up @@ -80,7 +87,7 @@ Future<void> atTalk(List<String> args) async {
}

// Now on to the @platform startup
AtSignLogger.root_level = 'SEVERE';
AtSignLogger.root_level = 'SHOUT';
if (results['verbose']) {
_logger.logger.level = Level.INFO;

Expand All @@ -99,7 +106,8 @@ Future<void> atTalk(List<String> args) async {
..rootDomain = rootDomain
..atKeysFilePath = atsignFile;

AtOnboardingService onboardingService = AtOnboardingServiceImpl(fromAtsign, atOnboardingConfig);
AtOnboardingService onboardingService =
AtOnboardingServiceImpl(fromAtsign, atOnboardingConfig);

await onboardingService.authenticate();

Expand Down Expand Up @@ -137,21 +145,27 @@ Future<void> atTalk(List<String> args) async {
}
});

notificationService.subscribe(regex: 'attalk.$nameSpace@', shouldDecrypt: true).listen(((notification) async {
notificationService
.subscribe(regex: 'attalk.$nameSpace@', shouldDecrypt: true)
.listen(((notification) async {
String keyAtsign = notification.key;
//Uint8List buffer;
keyAtsign = keyAtsign.replaceAll(notification.to + ':', '');
keyAtsign = keyAtsign.replaceAll('.' + nameSpace + notification.from, '');
if (keyAtsign == 'attalk') {
_logger.info('atTalk update received from ' + notification.from + ' notification id : ' + notification.id);
_logger.info('atTalk update received from ' +
notification.from +
' notification id : ' +
notification.id);
var talk = notification.value!;
print(chalk.brightGreen.bold('\r${notification.from}: ') + chalk.brightGreen(talk));
print(chalk.brightGreen.bold('\r${notification.from}: ') +
chalk.brightGreen(talk));

pipePrint('$fromAtsign: ');
}
}),
onError: (e) => _logger.severe('Notification Failed:' + e.toString()),
onDone: () => _logger.info('Notification listener stopped'));
onError: (e) => _logger.severe('Notification Failed:' + e.toString()),
onDone: () => _logger.info('Notification listener stopped'));
String input = "";
pipePrint('$fromAtsign: ');

Expand Down Expand Up @@ -182,13 +196,15 @@ Future<void> atTalk(List<String> args) async {
..key = 'attalk'
..sharedBy = fromAtsign
..sharedWith = toAtsign
..namespace = atClient?.getPreferences()?.namespace
..namespace = nameSpace
..metadata = metaData;
if (!(input == "")) {
try {
pendingSend++;

await notificationService.notify(NotificationParams.forUpdate(key, value: input), onSuccess: (notification) {
await notificationService
.notify(NotificationParams.forUpdate(key, value: input),
onSuccess: (notification) {
_logger.info('SUCCESS:' + notification.toString());
}, onError: (notification) {
_logger.info('ERROR:' + notification.toString());
Expand Down
22 changes: 10 additions & 12 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "42.0.0"
version: "43.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.0"
version: "4.3.1"
archive:
dependency: transitive
description:
Expand Down Expand Up @@ -53,19 +53,17 @@ packages:
at_client:
dependency: "direct main"
description:
path: at_client
ref: trunk
resolved-ref: "531cd25470409d9894fb4cd78ff60e07fbb60b4e"
url: "https://github.com/atsign-foundation/at_client_sdk.git"
source: git
version: "3.0.30"
name: at_client
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.32"
at_commons:
dependency: transitive
description:
name: at_commons
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.20"
version: "3.0.21"
at_lookup:
dependency: transitive
description:
Expand All @@ -79,14 +77,14 @@ packages:
name: at_onboarding_cli
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.1"
at_persistence_secondary_server:
dependency: transitive
description:
name: at_persistence_secondary_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.30"
version: "3.0.31"
at_persistence_spec:
dependency: transitive
description:
Expand Down Expand Up @@ -380,7 +378,7 @@ packages:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.3.2"
shelf_packages_handler:
dependency: transitive
description:
Expand Down
10 changes: 5 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ environment:
dependency_overrides:
# at_client:
# path: ../at_client_sdk/at_client
at_client:
git:
url: https://github.com/atsign-foundation/at_client_sdk.git
path: at_client
ref: trunk
# at_client:
# git:
# url: https://github.com/atsign-foundation/at_client_sdk.git
# path: at_client
# ref: trunk

dependencies:
at_client: ^3.0.30
Expand Down

0 comments on commit b8bb69c

Please sign in to comment.