Пример #1
0
        /// <summary>
        /// Sends a AddBookmarksMessage to store the given bookmark on the server.
        /// https://xmpp.org/extensions/xep-0402.html#adding-a-bookmark
        /// </summary>
        /// <param name="conferenceItem">The bookmark that should get stored on the server.</param>
        /// <param name="onMessage">The method that should get executed once the helper receives a new valid message (can be null).</param>
        /// <param name="onTimeout">The method that should get executed once the helper timeout gets triggered (can be null).</param>
        /// <returns>Returns a MessageResponseHelper listening for AddBookmarksMessage answers.</returns>
        public MessageResponseHelper <IQMessage> addBookmark_xep_0402(ConferenceItem conferenceItem, MessageResponseHelper <IQMessage> .OnMessageHandler onMessage, MessageResponseHelper <IQMessage> .OnTimeoutHandler onTimeout)
        {
            MessageResponseHelper <IQMessage> helper = new MessageResponseHelper <IQMessage>(CONNECTION, onMessage, onTimeout);
            AddBookmarkMessage msg = new AddBookmarkMessage(CONNECTION.account.getFullJid(), conferenceItem);

            helper.start(msg);
            return(helper);
        }
Пример #2
0
        /// <summary>
        /// Sends a AddBookmarksMessage for storing the given bookmark on the server.
        /// https://xmpp.org/extensions/xep-0402.html#adding-a-bookmark
        /// </summary>
        /// <param name="conferenceItem">The bookmark that should get stored on the server.</param>
        /// <param name="onMessage">The method that should get executed once the helper receives a new valid message (can be null).</param>
        /// <param name="onTimeout">The method that should get executed once the helper timeout gets triggered (can be null).</param>
        /// <returns>Returns a MessageResponseHelper listening for AddBookmarksMessage answers.</returns>
        public MessageResponseHelper <IQMessage> addBookmark_xep_0402(ConferenceItem conferenceItem, Func <IQMessage, bool> onMessage, Action onTimeout)
        {
            MessageResponseHelper <IQMessage> helper = new MessageResponseHelper <IQMessage>(CLIENT, onMessage, onTimeout);
            AddBookmarkMessage msg = new AddBookmarkMessage(CLIENT.getXMPPAccount().getIdDomainAndResource(), conferenceItem);

            helper.start(msg);
            return(helper);
        }
        public Task SaveConferenceItem(ConferenceItem conference)
        {
            var collection = Database().GetCollection <ConferenceItem>("Conference");

            if (conference.Id == ObjectId.Empty)
            {
                return(collection.InsertOneAsync(conference));
            }
            else
            {
                var filter = Builders <ConferenceItem> .Filter.Eq(s => s.Id, conference.Id);

                return(collection.ReplaceOneAsync(filter, conference));
            }
        }
        private void removeBookmark(ConferenceItem item)
        {
            XMPPClient c = account_asc.getSelectedAccount();

            if (c != null)
            {
                if (c.isConnected())
                {
                    noneFound_notification.Show("Can't remove bookmark - account not connected!");
                }
                else
                {
                }
                c.PUB_SUB_COMMAND_HELPER.setBookmars_xep_0048(bookmarks, null, null);
            }
        }
        public static Task Handle(AddConferenceEvent addConferenceEvent)
        {
            var dl   = new HandlerDataLayer();
            var item = new ConferenceItem
            {
                ConferenceId      = addConferenceEvent.Id,
                Name              = addConferenceEvent.Name,
                Start             = addConferenceEvent.Start,
                End               = addConferenceEvent.End,
                Description       = addConferenceEvent.Description,
                RegistrationStart = addConferenceEvent.RegistrationStart,
                RegistrationEnd   = addConferenceEvent.RegistrationEnd,
                Attendees         = new List <Attendee>()
            };

            return(dl.SaveConferenceItem(item));
        }
Пример #6
0
        public IActionResult Create(string section, [FromBody] InfoItem infoItem)
        {
            if (section == string.Empty)
            {
                ModelState.AddModelError("Section", "The Section field is required.");
            }
            if (section.Length > 5)
            {
                ModelState.AddModelError("Section",
                                         "The field Section must be a string with a maximum length of 5.");
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ConferenceItem item = _context.ConferenceItems.FirstOrDefault(t => t.Section == section);

            if (item != null)
            {
                item.Section = section;
                item.Info    = infoItem;
                _context.ConferenceItems.Update(item);
            }
            else
            {
                item = new ConferenceItem
                {
                    Section = section,
                    Info    = infoItem
                };
                _context.ConferenceItems.Add(item);
            }

            _context.SaveChanges();

            return(CreatedAtRoute("GetConference", new { item.Section }, item));
        }