Пример #1
0
		public static Item Create(ItemStub itemStub, Controller parent, int serverRequestIndex, bool fromGuestRefresh, int instance)
		{
			ItemType type = itemStub.type;
			Item item;
			
			if (type == ItemType.LoginAlert)
				item = new Login((AlertStub)itemStub, parent, serverRequestIndex);
			else if (type == ItemType.LogoutAlert)
				item = new Logout((AlertStub)itemStub, parent, serverRequestIndex);
			else if (type == ItemType.LaughAlert)
				item = new Laugh((LaughStub)itemStub, parent, serverRequestIndex);
			else if (type == ItemType.PrivateChatMessage)
				item = new Private((PrivateStub)itemStub, parent, serverRequestIndex);
			else if (type == ItemType.CommentChatMessage)
				item = new CommentMessage((CommentMessageStub)itemStub, parent, serverRequestIndex);
			else if (type == ItemType.PublicChatMessage)
				item = new Message((MessageStub)itemStub, parent, serverRequestIndex);
			else if (type == ItemType.PhotoAlert)
				item = new Photo((PhotoStub)itemStub, parent, serverRequestIndex);
			else if (type == ItemType.TopPhoto)
				item = new TopPhoto((TopPhotoStub)itemStub, parent);
			else
				item = new Item(itemStub, parent);

			item.Instance = instance;
			item.ServerRequestIndex = serverRequestIndex;
			item.FromGuestRefresh = fromGuestRefresh;

			return item;
		}
Пример #2
0
		public Item(ItemStub itemStub, Controller parent)
		{
			Parent = parent;
			Guid = itemStub.guid;
			Type = itemStub.type;
			DateTime = itemStub.dateTime;
			RoomGuid = itemStub.roomGuid;
			FromGuestRefresh = false;
		}
Пример #3
0
		public Html(ItemStub itemStub, Controller parent, int serverRequestIndex)
			: base(itemStub, parent)
		{
			elementsInitialised = false;
			ServerRequestIndex = serverRequestIndex;
		}
Пример #4
0
		public Newable(ItemStub itemStub, Controller parent, int serverRequestIndex)
			: base(itemStub, parent, serverRequestIndex)
		{
		}
Пример #5
0
		public static void SendJsonChatItem(ItemStub item, int[] addToRoomUsrKs)
		{
			try
			{
				Guid roomGuid = item.roomGuid.UnPackGuid();
				Chat.RoomSpec rs = Chat.RoomSpec.FromGuid(roomGuid);
				if (rs != null && rs.HasArchive)
					Caching.Instances.Main.Delete(Chat.RoomSpec.GetArchiveCacheKey(roomGuid));


				System.Web.Script.Serialization.JavaScriptSerializer d = new System.Web.Script.Serialization.JavaScriptSerializer();
				ChatLibrary.ChatServerInterface cs = (ChatLibrary.ChatServerInterface)Activator.GetObject(typeof(ChatLibrary.ChatServerInterface), Bobs.Vars.ChatServerAddress);
				cs.SendTo(roomGuid, d.Serialize(item), addToRoomUsrKs, item.guid.UnPackGuid());
			}
			catch (Exception ex)
			{

			}
		}
Пример #6
0
		public static void SendJsonChatItem(ItemStub item, UsrSet us)
		{
			List<int> usrKs = new List<int>();
			foreach (Usr u in us)
			{
				try
				{
					usrKs.Add(u.K);
				}
				catch { }
			}
			SendJsonChatItem(item, usrKs.ToArray());
		}
Пример #7
0
		public static void SendJsonChatItem(ItemStub item, int addToRoomUsrK)
		{
			SendJsonChatItem(item, new int[] { addToRoomUsrK });
		}
Пример #8
0
		public static void SendJsonChatItem(ItemStub item)
		{
			SendJsonChatItem(item, new int[] { });
		}
Пример #9
0
			internal SendChatItemToBuddiesJob(ItemStub item, int usrK)
				: this()
			{
				Item.Value = item;
				UsrK.Value = usrK;

			}
Пример #10
0
		/// <summary>
		/// Sends an item to the buddy stream of all the users logged in buddies
		/// </summary>
		public static void SendChatItemToBuddies(ItemStub item, int usrK)
		{
			SendChatItemToBuddiesJob job = new SendChatItemToBuddiesJob(item, usrK);
			job.ExecuteAsynchronously();
		}