Feature #235

avatar

Smuxi Server Manager

Added by Mirco Bauer 5514 days ago. Updated 5460 days ago.

Status:Closed Start:11/16/2009
Priority:Normal Due date:
Assigned to:avatarClément Bourgeois % Done:

100%

Category:Server
Target version:0.7
Complexity:

Medium

Votes: 0

Description

Smuxi users should not need to touch the configuration files of Smuxi. In the case of the smuxi-server the user has to create a new user being edited the smuxi-engine.ini by hand which should NOT be needed. The smuxi-server binary should provide some command line options to add, change and delete users.


Related issues

related to Smuxi - Feature #265 Wizard to create user configuration for remote connecting to smuxi-server Closed 01/02/2010
blocks Smuxi - Task #284 Please make update-po Closed 01/08/2010

Associated revisions

Revision 32ed9a57f3411d05e2a040ff7bf6aa21f1cb759d
Added by Clément Bourgeois 5462 days ago

Implemented Feature #235 - Smuxi Server Manager (closes: #235)

Making use of NDesk.Options.cs for options parsing
Added a new classe in Engine "UserListController" that will help in the
future manage users of the engine.

MonoDevelop solutions and Makefiles modified
Modified POTFILES.in files to include new files were translatable strings are now present.

Revision 20659887ebab05613843fbba810e4e765d26687c
Added by Mirco Bauer 5460 days ago

Refactored option parsing and server manager (refs: #235)

UserListController:
- Renamed DelUser() to DeleteUser()

Main:
- Use exceptions for error handling
- Removed most option short cuts (spare them for common used ones)
- Fixed logger initialization
- Enhanced messages and parameter descriptions
- Updated copyright lines
- CS fixes

History

Updated by Mirco Bauer 5514 days ago

avatar
As inspiration, parameters like this might be good:
--add-user --user=meebey --password=foobar
--modify-user --user=meebey --password=barfoo
--delete-user --user=meebey

Updated by Mirco Bauer 5465 days ago

avatar
  • Complexity set to Medium

Updated by Clément Bourgeois 5465 days ago

avatar
  • Assigned to changed from Mirco Bauer to Clément Bourgeois

Updated by Clément Bourgeois 5463 days ago

avatar
  • % Done changed from 0 to 100

The following changes since commit a5cd8f7ffaf48143cc96258b372ab4a6306dda37:
Mirco Bauer (1):
Only wait for pending channel joins if there is actually one happening and not for failed attempts for example. (closes: #251)

are available in the git repository at:

git://moonpyk.ath.cx/smuxi.git feature/#235_Smuxi_Server_Manager

Clement Bourgeois (1):
Implemented Feature #235 - Smuxi Server Manager (closes: #235)

src/Common/Common.mdp                           |    5 +-
src/Common/Makefile.am | 1 +
src/Common/NDesk.Options.cs | 1100 +++++++++++++++++++++
src/Engine/Config/UserListController.cs | 99 ++
src/Engine/Engine.mdp | 1 +
src/Engine/Makefile.am | 1 +
src/Frontend-GNOME/Views/Chats/GroupChatView.cs | 2 +
src/Server/Main.cs | 185 ++-
8 files changed, 1368 insertions(+), 26 deletions(-)
create mode 100644 src/Common/NDesk.Options.cs
create mode 100644 src/Engine/Config/UserListController.cs

Updated by Mirco Bauer 5462 days ago

avatar

Here some comments regarding the changeset:

First, please follow the Coding Standards used in Smuxi, I know I haven't documented them (yet). So I will give examples which code is not following them:
+            if(addUser || modUser) {

Space is missing between if and (), as if is not method.
+            } catch(OptionException) {}

Space missing, see above (not a method).
+            } else if(delUser) {

See above
+        private static void _ManageUsers (bool addUser, bool delUser, bool modUser, string username, string password)

One space too much there, no extra spaces between method names and braces.

Ok, thats was all about Coding Standards. Now implementation comments:

+                    } catch(ArgumentException) {
+                        Console.WriteLine(
+                             "Error : Unable to add user \"$name\", it allready exists ! Did you mean -m|--modify-user ?" 
+                                   .Replace("$name", username)
+                        );

Don't make such assumptions when dealing with exception types. If you expect an error (like in this case) and want to handle it, let the layer below report what the issue was. For instance:
+ } catch (ArgumentException ex) {
+ Console.WriteLine("Unable to add user '{0}', error: {1}", username, ex.Message);

For all messages you need to use _() to mark it as translatable, if you need to combine it with variables use String.Format() around it.

In UserListController don't call for all operations Save(), the caller of that has to decide it if it's persistent or not. Simply call config.Save() at the end of _ManageUsers() if something was changed.

    GroupChatView.cs : fixed a unprotected _Logger call that lead to compile
    fail in release mode (#if LOG4NET missing)

No unrelated changes in topic-branches ;) strip that one from the branch.

Ok thats all for now, it looks pretty good!

Please address the issues from above and tell me when you pushed a new version.

Updated by Clément Bourgeois 5462 days ago

avatar

Please merge git://moonpyk.ath.cx/smuxi.git -> feature/#235_Smuxi_Server_Manager

It makes now use of Console.Writeline() format, fixes a missing _() of previous commit.

Updated by Clément Bourgeois 5462 days ago

avatar

I modified POTFILES.in too to include new files were translatable strings are now present.

Updated by Clément Bourgeois 5460 days ago

avatar
  • Status changed from New to Closed

Also available in: Atom PDF