コード例 #1
0
        async Task IReadModifyWriteObject.Refresh()
        {
            Channel = await Server.GetChannelState(Channel.id);

            LinkedChannels.Clear();
            foreach (var chan in Channel.links)
            {
                LinkedChannels.Add(new ChannelShim(Server, chan));
            }
        }
コード例 #2
0
ファイル: ServerCallback.cs プロジェクト: EHVAG/fancyauth
        public override async Task ChannelRemoved(Murmur.Channel chan)
        {
            using (var context = await FancyContext.Connect())
            {
                var channel = await context.Channels.Where(x => x.ServerId == chan.id).SingleAsync();

                channel.ServerId = null;

                context.ChannelInfoChanges.Add(new Channel.InfoChange
                {
                    Channel     = channel,
                    Name        = null,
                    Description = null,
                    When        = DateTimeOffset.Now,
                });

                await context.SaveChangesAsync();
            }
        }
コード例 #3
0
ファイル: ServerCallback.cs プロジェクト: EHVAG/fancyauth
        public override async Task ChannelStateChanged(Murmur.Channel chan)
        {
            using (var context = await FancyContext.Connect())
            {
                var query = from channel in context.Channels
                            where channel.ServerId == chan.id
                            join ichange in context.ChannelInfoChanges on channel.Id equals ichange.Channel.Id into infoChanges
                            select new
                {
                    channel,
                    parentId = channel.Parent.ServerId,
                    name     = infoChanges.OrderByDescending(x => x.When).Select(x => x.Name).Where(x => x != null).FirstOrDefault(),
                    desc     = infoChanges.OrderByDescending(x => x.When).Select(x => x.Description).Where(x => x != null).FirstOrDefault(),
                };
                var res = await query.SingleAsync();

                var infoChange = new Channel.InfoChange
                {
                    Channel     = res.channel,
                    Name        = chan.name == res.name ? null : chan.name,
                    Description = chan.description == res.desc ? null : chan.description,
                    When        = DateTimeOffset.Now,
                };

                if (res.parentId != chan.parent)
                {
                    res.channel.Parent = await context.Channels.Where(x => x.ServerId == chan.parent).SingleAsync();
                }

                if (infoChange.Name != null || infoChange.Description != null)
                {
                    context.ChannelInfoChanges.Add(infoChange);
                }

                await context.SaveChangesAsync();
            }
        }
コード例 #4
0
ファイル: ServerCallback.cs プロジェクト: EHVAG/fancyauth
        public override async Task ChannelCreated(Murmur.Channel chan)
        {
            using (var context = await FancyContext.Connect())
                using (var transact = context.Database.BeginTransaction())
                {
                    var dbchan = context.Channels.Add(new Channel
                    {
                        Temporary = chan.temporary,
                        Parent    = await context.Channels.Where(x => x.ServerId == chan.parent).SingleAsync(),
                        ServerId  = chan.id,
                    });
                    context.ChannelInfoChanges.Add(new Channel.InfoChange
                    {
                        Channel     = dbchan,
                        Name        = chan.name,
                        Description = chan.description,
                        When        = DateTimeOffset.Now
                    });

                    await context.SaveChangesAsync();

                    transact.Commit();
                }
        }
コード例 #5
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public static void write(IceInternal.BasicStream os__,
     _System.Collections.Generic.Dictionary<int, Murmur.Channel> v__)
 {
     if(v__ == null)
     {
         os__.writeSize(0);
     }
     else
     {
         os__.writeSize(v__.Count);
         foreach(_System.Collections.Generic.KeyValuePair<int, Murmur.Channel> e__ in v__)
         {
             os__.writeInt(e__.Key);
             if(e__.Value == null)
             {
                 Murmur.Channel tmp__ = new Murmur.Channel();
                 tmp__.write__(os__);
             }
             else
             {
                 e__.Value.write__(os__);
             }
         }
     }
 }
コード例 #6
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public static Murmur.Channel[] read(IceInternal.BasicStream is__)
 {
     Murmur.Channel[] v__;
     {
         int szx__ = is__.readSize();
         is__.startSeq(szx__, 16);
         v__ = new Murmur.Channel[szx__];
         for(int ix__ = 0; ix__ < szx__; ++ix__)
         {
             v__[ix__] = new Murmur.Channel();
             v__[ix__].read__(is__);
             is__.checkSeq();
             is__.endElement();
         }
         is__.endSeq(szx__);
     }
     return v__;
 }
コード例 #7
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public static _System.Collections.Generic.Dictionary<int, Murmur.Channel> read(IceInternal.BasicStream is__)
 {
     int sz__ = is__.readSize();
     _System.Collections.Generic.Dictionary<int, Murmur.Channel> r__ = new _System.Collections.Generic.Dictionary<int, Murmur.Channel>();
     for(int i__ = 0; i__ < sz__; ++i__)
     {
         int k__;
         k__ = is__.readInt();
         Murmur.Channel v__;
         v__ = null;
         if(v__ == null)
         {
             v__ = new Murmur.Channel();
         }
         v__.read__(is__);
         r__[k__] = v__;
     }
     return r__;
 }
コード例 #8
0
        public override Task ChannelCreated(Murmur.Channel chan)
        {
            var apiChannel = new ChannelWrapper(WServer, chan);

            return(Task.WhenAll(Plugins.Select(x => x.OnChannelCreated(apiChannel))));
        }
コード例 #9
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public override void write__(IceInternal.BasicStream os__)
 {
     os__.writeTypeId(ice_staticId());
     os__.startWriteSlice();
     if(c == null)
     {
         Murmur.Channel tmp__ = new Murmur.Channel();
         tmp__.write__(os__);
     }
     else
     {
         c.write__(os__);
     }
     if(children == null)
     {
         os__.writeSize(0);
     }
     else
     {
         os__.writeSize(children.Length);
         for(int ix__ = 0; ix__ < children.Length; ++ix__)
         {
             os__.writeObject(children[ix__]);
         }
     }
     if(users == null)
     {
         os__.writeSize(0);
     }
     else
     {
         os__.writeSize(users.Length);
         for(int ix__ = 0; ix__ < users.Length; ++ix__)
         {
             (users[ix__] == null ? new Murmur.User() : users[ix__]).write__(os__);
         }
     }
     os__.endWriteSlice();
     base.write__(os__);
 }
コード例 #10
0
 public override void getChannelState_async(Murmur.AMD_Server_getChannelState cb__, int channelid, Ice.Current current__)
 {
     Murmur.Channel ret__ = new Murmur.Channel();
     cb__.ice_response(ret__);
 }
コード例 #11
0
 public override void channelRemoved(Murmur.Channel state, Ice.Current current__)
 {
 }
コード例 #12
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public static Ice.DispatchStatus channelStateChanged___(ServerCallback obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     checkMode__(Ice.OperationMode.Idempotent, current__.mode);
     IceInternal.BasicStream is__ = inS__.istr();
     is__.startReadEncaps();
     Murmur.Channel state;
     state = null;
     if(state == null)
     {
         state = new Murmur.Channel();
     }
     state.read__(is__);
     is__.endReadEncaps();
     obj__.channelStateChanged(state, current__);
     return Ice.DispatchStatus.DispatchOK;
 }
コード例 #13
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public static Ice.DispatchStatus setChannelState___(Server obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     checkMode__(Ice.OperationMode.Idempotent, current__.mode);
     IceInternal.BasicStream is__ = inS__.istr();
     is__.startReadEncaps();
     Murmur.Channel state;
     state = null;
     if(state == null)
     {
         state = new Murmur.Channel();
     }
     state.read__(is__);
     is__.endReadEncaps();
     AMD_Server_setChannelState cb__ = new _AMD_Server_setChannelState(inS__);
     try
     {
         obj__.setChannelState_async(cb__, state, current__);
     }
     catch(_System.Exception ex__)
     {
         cb__.ice_exception(ex__);
     }
     return Ice.DispatchStatus.DispatchAsync;
 }
コード例 #14
0
ファイル: ServerCallback.cs プロジェクト: EHVAG/fancyauth
 public sealed override void channelStateChanged_async(Murmur.AMD_ServerCallback_channelStateChanged cb__, Murmur.Channel state, Ice.Current current__)
 {
     cb__.ice_response();
     AsyncCompleter(ChannelStateChanged(state));
 }
コード例 #15
0
 public Task SetChannelState(Murmur.Channel state)
 {
     return(FixIce.FromAsyncVoid(state, S.begin_setChannelState, S.end_setChannelState));
 }
コード例 #16
0
ファイル: ServerCallback.cs プロジェクト: EHVAG/fancyauth
 public virtual Task ChannelStateChanged(Murmur.Channel chan)
 {
     return(NullTask);
 }
コード例 #17
0
ファイル: ServerCallback.cs プロジェクト: EHVAG/fancyauth
 public virtual Task ChannelRemoved(Murmur.Channel chan)
 {
     return(NullTask);
 }
コード例 #18
0
ファイル: ServerCallback.cs プロジェクト: EHVAG/fancyauth
 public virtual Task ChannelCreated(Murmur.Channel chan)
 {
     return(NullTask);
 }
コード例 #19
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public void channelStateChanged(Murmur.Channel state, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("channelStateChanged", Ice.OperationMode.Idempotent, context__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.ostr();
             if(state == null)
             {
                 Murmur.Channel tmp__ = new Murmur.Channel();
                 tmp__.write__(os__);
             }
             else
             {
                 state.write__(os__);
             }
         }
         catch(Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         if(!og__.istr().isEmpty())
         {
             try
             {
                 if(!ok__)
                 {
                     try
                     {
                         og__.throwUserException();
                     }
                     catch(Ice.UserException ex__)
                     {
                         throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                     }
                 }
                 og__.istr().skipEmptyEncaps();
             }
             catch(Ice.LocalException ex__)
             {
                 throw new IceInternal.LocalExceptionWrapper(ex__, false);
             }
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
コード例 #20
0
ファイル: Murmur.cs プロジェクト: Vinhold/halcyon
 public static Murmur.Channel[] read(IceInternal.BasicStream is__)
 {
     Murmur.Channel[] v__;
     {
         int szx__ = is__.readAndCheckSeqSize(16);
         v__ = new Murmur.Channel[szx__];
         for(int ix__ = 0; ix__ < szx__; ++ix__)
         {
             v__[ix__] = new Murmur.Channel();
             v__[ix__].read__(is__);
         }
     }
     return v__;
 }
コード例 #21
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public Murmur.Channel getChannelState(int channelid, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("getChannelState", Ice.OperationMode.Idempotent, context__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.ostr();
             os__.writeInt(channelid);
         }
         catch(Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         try
         {
             if(!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch(Murmur.InvalidChannelException)
                 {
                     throw;
                 }
                 catch(Murmur.ServerBootedException)
                 {
                     throw;
                 }
                 catch(Ice.UserException ex__)
                 {
                     throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                 }
             }
             IceInternal.BasicStream is__ = og__.istr();
             is__.startReadEncaps();
             Murmur.Channel ret__;
             ret__ = null;
             if(ret__ == null)
             {
                 ret__ = new Murmur.Channel();
             }
             ret__.read__(is__);
             is__.endReadEncaps();
             return ret__;
         }
         catch(Ice.LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
コード例 #22
0
ファイル: Murmur.cs プロジェクト: Vinhold/halcyon
 public Murmur.Channel end_getChannelState(Ice.AsyncResult r__)
 {
     IceInternal.OutgoingAsync outAsync__ = (IceInternal.OutgoingAsync)r__;
     IceInternal.OutgoingAsync.check__(outAsync__, this, __getChannelState_name);
     if(!outAsync__.wait__())
     {
         try
         {
             outAsync__.throwUserException__();
         }
         catch(Murmur.InvalidChannelException)
         {
             throw;
         }
         catch(Murmur.InvalidSecretException)
         {
             throw;
         }
         catch(Murmur.ServerBootedException)
         {
             throw;
         }
         catch(Ice.UserException ex__)
         {
             throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
         }
     }
     Murmur.Channel ret__;
     IceInternal.BasicStream is__ = outAsync__.istr__;
     is__.startReadEncaps();
     ret__ = null;
     if(ret__ == null)
     {
         ret__ = new Murmur.Channel();
     }
     ret__.read__(is__);
     is__.endReadEncaps();
     return ret__;
 }
コード例 #23
0
 public override void setChannelState_async(Murmur.AMD_Server_setChannelState cb__, Murmur.Channel state, Ice.Current current__)
 {
     cb__.ice_response();
 }
コード例 #24
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public override void read__(IceInternal.BasicStream is__, bool rid__)
 {
     if(rid__)
     {
         /* string myId = */ is__.readTypeId();
     }
     is__.startReadSlice();
     if(c == null)
     {
         c = new Murmur.Channel();
     }
     c.read__(is__);
     {
         int szx__ = is__.readSize();
         is__.startSeq(szx__, 4);
         children = new Murmur.Tree[szx__];
         for(int ix__ = 0; ix__ < szx__; ++ix__)
         {
             IceInternal.ArrayPatcher<Murmur.Tree> spx = new IceInternal.ArrayPatcher<Murmur.Tree>("::Murmur::Tree", children, ix__);
             is__.readObject(spx);
             is__.checkSeq();
             is__.endElement();
         }
         is__.endSeq(szx__);
     }
     {
         int szx__ = is__.readSize();
         is__.startSeq(szx__, 42);
         users = new Murmur.User[szx__];
         for(int ix__ = 0; ix__ < szx__; ++ix__)
         {
             users[ix__] = new Murmur.User();
             users[ix__].read__(is__);
             is__.checkSeq();
             is__.endElement();
         }
         is__.endSeq(szx__);
     }
     is__.endReadSlice();
     base.read__(is__, true);
 }
コード例 #25
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public void ice_response(Murmur.Channel ret__)
 {
     if(validateResponse__(true))
     {
         try
         {
             IceInternal.BasicStream os__ = this.os__();
             if(ret__ == null)
             {
                 Murmur.Channel tmp__ = new Murmur.Channel();
                 tmp__.write__(os__);
             }
             else
             {
                 ret__.write__(os__);
             }
         }
         catch(Ice.LocalException ex__)
         {
             ice_exception(ex__);
         }
         response__(true);
     }
 }
コード例 #26
0
ファイル: Murmur.cs プロジェクト: Vinhold/halcyon
 private Ice.AsyncResult<Murmur.Callback_ServerCallback_channelStateChanged> begin_channelStateChanged(Murmur.Channel state, _System.Collections.Generic.Dictionary<string, string> ctx__, bool explicitContext__, Ice.AsyncCallback cb__, object cookie__)
 {
     IceInternal.OnewayOutgoingAsync<Murmur.Callback_ServerCallback_channelStateChanged> result__ = new IceInternal.OnewayOutgoingAsync<Murmur.Callback_ServerCallback_channelStateChanged>(this, __channelStateChanged_name, channelStateChanged_completed__, cookie__);
     if(cb__ != null)
     {
         result__.whenCompletedWithAsyncCallback(cb__);
     }
     try
     {
         result__.prepare__(__channelStateChanged_name, Ice.OperationMode.Idempotent, ctx__, explicitContext__);
         IceInternal.BasicStream os__ = result__.ostr__;
         if(state == null)
         {
             Murmur.Channel tmp__ = new Murmur.Channel();
             tmp__.write__(os__);
         }
         else
         {
             state.write__(os__);
         }
         os__.endWriteEncaps();
         result__.send__(true);
     }
     catch(Ice.LocalException ex__)
     {
         result__.exceptionAsync__(ex__);
     }
     return result__;
 }
コード例 #27
0
ファイル: Murmur.cs プロジェクト: nhede/whisper_server
 public Tree(Murmur.Channel c, Murmur.Tree[] children, Murmur.User[] users)
 {
     this.c = c;
     this.children = children;
     this.users = users;
 }
コード例 #28
0
 public ChannelWrapper(Wrapped.Server server, Murmur.Channel channel)
     : base(server, channel.id)
 {
     Channel        = channel;
     LinkedChannels = new HashSet <IChannelShim>(channel.links.Select(x => new ChannelShim(server, x)));
 }