Пример #1
0
 public ServerLogger(TeamTalk5Srv ttserver)
 {
     this.ttserver                 = ttserver;
     ttserver.OnUserConnected     += new TeamTalk5Srv.UserConnected(ttserver_OnUserConnected);
     ttserver.OnUserLoggedIn      += new TeamTalk5Srv.UserLoggedIn(ttserver_OnUserLoggedIn);
     ttserver.OnUserLoggedOut     += new TeamTalk5Srv.UserLoggedOut(ttserver_OnUserLoggedOut);
     ttserver.OnUserTimedout      += new TeamTalk5Srv.UserTimedout(ttserver_OnUserTimedout);
     ttserver.OnUserDisconnected  += new TeamTalk5Srv.UserDisconnected(ttserver_OnUserDisconnected);
     ttserver.OnUserKicked        += new TeamTalk5Srv.UserKicked(ttserver_OnUserKicked);
     ttserver.OnUserUnbanned      += new TeamTalk5Srv.UserUnbanned(ttserver_OnUserUnbanned);
     ttserver.OnUserBanned        += new TeamTalk5Srv.UserBanned(ttserver_OnUserBanned);
     ttserver.OnUserUpdated       += new TeamTalk5Srv.UserUpdated(ttserver_OnUserUpdated);
     ttserver.OnUserJoinedChannel += new TeamTalk5Srv.UserJoinedChannel(ttserver_OnUserJoinedChannel);
     ttserver.OnUserLeftChannel   += new TeamTalk5Srv.UserLeftChannel(ttserver_OnUserLeftChannel);
     ttserver.OnUserMoved         += new TeamTalk5Srv.UserMoved(ttserver_OnUserMoved);
     ttserver.OnUserTextMessage   += new TeamTalk5Srv.UserTextMessage(ttserver_OnUserTextMessage);
     ttserver.OnChannelCreated    += new TeamTalk5Srv.ChannelCreated(ttserver_OnChannelCreated);
     ttserver.OnChannelRemoved    += new TeamTalk5Srv.ChannelRemoved(ttserver_OnChannelRemoved);
     ttserver.OnChannelUpdated    += new TeamTalk5Srv.ChannelUpdated(ttserver_OnChannelUpdated);
     ttserver.OnFileDeleted       += new TeamTalk5Srv.FileDeleted(ttserver_OnFileDeleted);
     ttserver.OnFileDownloaded    += new TeamTalk5Srv.FileDownloaded(ttserver_OnFileDownloaded);
     ttserver.OnFileUploaded      += new TeamTalk5Srv.FileUploaded(ttserver_OnFileUploaded);
     ttserver.OnServerUpdated     += new TeamTalk5Srv.ServerUpdated(ttserver_OnServerUpdated);
     ttserver.OnSaveServerConfig  += new TeamTalk5Srv.SaveServerConfig(ttserver_OnSaveServerConfig);
 }
Пример #2
0
 public ServerLogger(TeamTalk5Srv ttserver)
 {
     this.ttserver = ttserver;
     ttserver.OnUserConnected += new TeamTalk5Srv.UserConnected(ttserver_OnUserConnected);
     ttserver.OnUserLoggedIn += new TeamTalk5Srv.UserLoggedIn(ttserver_OnUserLoggedIn);
     ttserver.OnUserLoggedOut += new TeamTalk5Srv.UserLoggedOut(ttserver_OnUserLoggedOut);
     ttserver.OnUserTimedout += new TeamTalk5Srv.UserTimedout(ttserver_OnUserTimedout);
     ttserver.OnUserDisconnected += new TeamTalk5Srv.UserDisconnected(ttserver_OnUserDisconnected);
     ttserver.OnUserKicked += new TeamTalk5Srv.UserKicked(ttserver_OnUserKicked);
     ttserver.OnUserUnbanned += new TeamTalk5Srv.UserUnbanned(ttserver_OnUserUnbanned);
     ttserver.OnUserBanned += new TeamTalk5Srv.UserBanned(ttserver_OnUserBanned);
     ttserver.OnUserUpdated += new TeamTalk5Srv.UserUpdated(ttserver_OnUserUpdated);
     ttserver.OnUserJoinedChannel += new TeamTalk5Srv.UserJoinedChannel(ttserver_OnUserJoinedChannel);
     ttserver.OnUserLeftChannel += new TeamTalk5Srv.UserLeftChannel(ttserver_OnUserLeftChannel);
     ttserver.OnUserMoved += new TeamTalk5Srv.UserMoved(ttserver_OnUserMoved);
     ttserver.OnUserTextMessage += new TeamTalk5Srv.UserTextMessage(ttserver_OnUserTextMessage);
     ttserver.OnChannelCreated += new TeamTalk5Srv.ChannelCreated(ttserver_OnChannelCreated);
     ttserver.OnChannelRemoved += new TeamTalk5Srv.ChannelRemoved(ttserver_OnChannelRemoved);
     ttserver.OnChannelUpdated += new TeamTalk5Srv.ChannelUpdated(ttserver_OnChannelUpdated);
     ttserver.OnFileDeleted += new TeamTalk5Srv.FileDeleted(ttserver_OnFileDeleted);
     ttserver.OnFileDownloaded += new TeamTalk5Srv.FileDownloaded(ttserver_OnFileDownloaded);
     ttserver.OnFileUploaded += new TeamTalk5Srv.FileUploaded(ttserver_OnFileUploaded);
     ttserver.OnServerUpdated += new TeamTalk5Srv.ServerUpdated(ttserver_OnServerUpdated);
     ttserver.OnSaveServerConfig += new TeamTalk5Srv.SaveServerConfig(ttserver_OnSaveServerConfig);
 }
Пример #3
0
 public ServerCallback(TeamTalk5Srv ttserver, List<UserAccount> useraccounts)
 {
     this.ttserver = ttserver;
     this.useraccounts = useraccounts;
     ttserver.OnUserLogin += new TeamTalk5Srv.UserLogin(ttserver_OnUserLogin);
     ttserver.OnUserCreateUserAccount += new TeamTalk5Srv.UserCreateUserAccount(ttserver_OnUserCreateUserAccount);
     ttserver.OnUserDeleteUserAccount += new TeamTalk5Srv.UserDeleteUserAccount(ttserver_OnUserDeleteUserAccount);
     ttserver.OnUserAddServerBan += new TeamTalk5Srv.UserAddServerBan(ttserver_OnUserAddServerBan);
     ttserver.OnUserAddServerBanIPAddress += new TeamTalk5Srv.UserAddServerBanIPAddress(ttserver_OnUserAddServerBanIPAddress);
     ttserver.OnUserDeleteServerBan += new TeamTalk5Srv.UserDeleteServerBan(ttserver_OnUserDeleteServerBan);
 }
Пример #4
0
 public ServerCallback(TeamTalk5Srv ttserver, List <UserAccount> useraccounts)
 {
     this.ttserver                         = ttserver;
     this.useraccounts                     = useraccounts;
     ttserver.OnUserLogin                 += new TeamTalk5Srv.UserLogin(ttserver_OnUserLogin);
     ttserver.OnUserCreateUserAccount     += new TeamTalk5Srv.UserCreateUserAccount(ttserver_OnUserCreateUserAccount);
     ttserver.OnUserDeleteUserAccount     += new TeamTalk5Srv.UserDeleteUserAccount(ttserver_OnUserDeleteUserAccount);
     ttserver.OnUserAddServerBan          += new TeamTalk5Srv.UserAddServerBan(ttserver_OnUserAddServerBan);
     ttserver.OnUserAddServerBanIPAddress += new TeamTalk5Srv.UserAddServerBanIPAddress(ttserver_OnUserAddServerBanIPAddress);
     ttserver.OnUserDeleteServerBan       += new TeamTalk5Srv.UserDeleteServerBan(ttserver_OnUserDeleteServerBan);
     ttserver.OnUserChangeNickname        += new TeamTalk5Srv.UserChangeNickname(ttserver_OnUserChangeNickname);
     ttserver.OnUserChangeStatus          += new TeamTalk5Srv.UserChangeStatus(ttserver_OnUserChangeStatus);
 }
Пример #5
0
        public TeamTalkServer()
        {
            // Instantiate server
            TeamTalk5Srv server = new TeamTalk5Srv();

            TeamTalk5Srv.SetEncryptionContext("", "");

            if (server.SetChannelFilesRoot(FILESTORAGE_FOLDER, MAX_DISKUSAGE, DEFAULT_CHANNEL_QUOTA) != ClientError.SUCCESS)
            {
                Console.WriteLine("Failed to setup file sharing");
            }
            // create administrator user account
            UserAccount useraccount = new UserAccount();

            useraccount.szUsername  = ADMIN_USERNAME;
            useraccount.szPassword  = ADMIN_PASSWORD;
            useraccount.uUserType   = UserType.USERTYPE_ADMIN;
            useraccount.szNote      = "An example administrator user account with all user-rights";
            useraccount.uUserRights = UserRight.USERRIGHT_ALL;
            useraccounts.Add(useraccount);
            // Make root channel
            Channel chan = new Channel();

            chan.nChannelID   = 1;
            chan.nParentID    = 0;
            chan.nMaxUsers    = 10;
            chan.szName       = "/";
            chan.uChannelType = ChannelType.CHANNEL_PERMANENT;
            chan.audiocodec   = new AudioCodec();
            chan.audiocfg     = new AudioConfig(true);
            // Subscribe Events
            ServerCallback serverCallback = new ServerCallback(server, useraccounts);
            ServerLogger   logger         = new ServerLogger(server);

            ServerProperties srv = new ServerProperties();

            srv.nUserTimeout = 200;
            srv.nMaxUsers    = 1000;
            //Update Serverproperties
            server.UpdateServer(srv);

            if (server.MakeChannel(chan) != ClientError.SUCCESS)
            {
                Console.WriteLine("Failed to create root channel");
            }

            // Start server
            if (!server.StartServer(IPADDR, TCPPORT, UDPPORT, ENCRYPTED))
            {
                Console.WriteLine("Failed to start server");
            }
            Console.Title = "TeamTalk Server v." + TeamTalk5Srv.GetVersion();
            Console.WriteLine("Started TeamTalk {0} Server v.{1}\nTCP port: {2}, UDP port: {3}",
                              (ENCRYPTED? "Encrypted" : "Non-Encrypted"), TeamTalk5Srv.GetVersion(),
                              TCPPORT, UDPPORT);
            //run server forever
            while (server.RunEventLoop(0))
            {
                ;
            }
        }