// handles updating topic/purpose and determining whether to further propagate update messages.
432237
func (b *Bslack) handleTopicOrPurpose(msg *config.Message, channelInfo *slack.Channel) (bool, error) {
	if msg.Event != config.EventTopicChange {
		return false, nil
	}

	if b.GetBool("SyncTopic") {
		return true, b.updateTopicOrPurpose(msg, channelInfo)
	}

	// Pass along to normal message handlers.
	if b.GetBool("ShowTopicChange") {
		return false, nil
	}

	// Swallow message as handled no-op.
	return true, nil
}
67442
func (fn UpdateTaskHandlerFunc) Handle(params UpdateTaskParams, principal interface{}) middleware.Responder {
	return fn(params, principal)
}
562205
func (eh userUpdateEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*UserUpdate); ok {
		eh(s, t)
	}
}
502338
func (s *ServicesService) Update(serviceID uint, service *Service) (*http.Response, error) {
	u := fmt.Sprintf("services/%d", serviceID)
	req, err := s.client.NewRequest("PUT", u, service)
	if err != nil {
		return nil, err
	}

	return s.client.Do(req, nil)
}
750063
func (c *Connect) IntentionUpdate(ixn *Intention, q *WriteOptions) (*WriteMeta, error) {
	r := c.c.newRequest("PUT", "/v1/connect/intentions/"+ixn.ID)
	r.setWriteOptions(q)
	r.obj = ixn
	rtt, resp, err := requireOK(c.c.doRequest(r))
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	wm := &WriteMeta{}
	wm.RequestTime = rtt
	return wm, nil
}
870578
func (_m *Client) Update(uid string, pu groveclient.PostUpdate, options groveclient.UpdateOptions) (*groveclient.PostItem, error) {
	ret := _m.Called(uid, pu, options)

	var r0 *groveclient.PostItem
	if rf, ok := ret.Get(0).(func(string, groveclient.PostUpdate, groveclient.UpdateOptions) *groveclient.PostItem); ok {
		r0 = rf(uid, pu, options)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*groveclient.PostItem)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string, groveclient.PostUpdate, groveclient.UpdateOptions) error); ok {
		r1 = rf(uid, pu, options)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
716214
func (bot *TgBot) ProcessMessages(messages []MessageWithUpdateID) {
	for _, msg := range messages {
		// if int64(msg.UpdateID) > bot.LastUpdateID {
		// 	// Add lock
		// 	bot.LastUpdateID = int64(msg.UpdateID)
		// }
		atomic.CompareAndSwapInt64(&bot.LastUpdateID, bot.LastUpdateID, int64(msg.UpdateID))
		if bot.MainListener != nil {
			bot.MainListener <- msg
		}
	}
}
201470
func (r *ReleasesService) Update(params interface{}) (release *Release, result *Result) {
	result = r.client.patch(r.URL, params, &release)
	return
}
1177502
func (r *sentReq) update(ev reqPeerEvent) {
	switch ev.event {
	case rpSent:
		r.lastReqQueued = false
		r.lastReqSentTo = ev.peer
	case rpSoftTimeout:
		r.lastReqSentTo = nil
		r.reqSrtoCount++
	case rpHardTimeout:
		r.reqSrtoCount--
	case rpDeliveredValid, rpDeliveredInvalid:
		if ev.peer == r.lastReqSentTo {
			r.lastReqSentTo = nil
		} else {
			r.reqSrtoCount--
		}
	}
}
1024797
func (t *ephemeralTracker) maybeUpdatePurgeInfo(ctx context.Context,
	convID chat1.ConversationID, uid gregor1.UID, purgeInfo *chat1.EphemeralPurgeInfo) (err Error) {
	defer t.Trace(ctx, func() error { return err }, "maybeUpdatePurgeInfo")()

	t.Lock()
	defer t.Unlock()

	if purgeInfo == nil {
		return nil
	}

	allPurgeInfo, err := t.dbGet(ctx, uid)
	if err != nil {
		return err
	}
	curPurgeInfo, ok := allPurgeInfo[convID.String()]
	t.Debug(ctx, "maybeUpdatePurgeInfo old: %v, ok: %v, new: %v", curPurgeInfo, ok, purgeInfo)
	if ok { // Throw away our update info if what we already have is more restrictive.
		if curPurgeInfo.IsActive {
			purgeInfo.IsActive = true
		}
		if purgeInfo.MinUnexplodedID == 0 || curPurgeInfo.MinUnexplodedID < purgeInfo.MinUnexplodedID {
			purgeInfo.MinUnexplodedID = curPurgeInfo.MinUnexplodedID
		}
		if purgeInfo.NextPurgeTime == 0 || (curPurgeInfo.NextPurgeTime != 0 && curPurgeInfo.NextPurgeTime < purgeInfo.NextPurgeTime) {
			purgeInfo.NextPurgeTime = curPurgeInfo.NextPurgeTime
		}
	}
	t.Debug(ctx, "maybeUpdatePurgeInfo setting info: %v", purgeInfo)
	allPurgeInfo[convID.String()] = *purgeInfo
	if err = t.dbSet(ctx, uid, allPurgeInfo); err == nil {
		// Let our background monitor know about the new info.
		if qerr := t.G().EphemeralPurger.Queue(ctx, *purgeInfo); qerr != nil {
			return NewInternalError(ctx, t.DebugLabeler, "purger.Queue error: %s", qerr.Error())
		}
	}
	return err
}
985422
func (h PfssoHandler) handleUpdate(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
	ctx := r.Context()
	defer statsd.NewStatsDTiming(ctx).Send("PfssoHandler.handleUpdate")

	info, timeout, err := h.parseSsoRequest(ctx, r.Body)
	if err != nil {
		http.Error(w, fmt.Sprint(err), http.StatusBadRequest)
		return
	}

	ctx = h.addInfoToContext(ctx, info)

	var shouldStart bool
	for _, firewall := range firewallsso.Firewalls.Structs {
		cacheKey := firewall.GetFirewallSSO(ctx).PfconfigHashNS + "|ip|" + info["ip"] + "|username|" + info["username"] + "|role|" + info["role"]
		// Check whether or not this firewall has cache updates
		// Then check if an entry in the cache exists
		//  If it does exist, we don't send a Start
		//  Otherwise, we add an entry in the cache
		// Note that this has a race condition between the cache.Get and the cache.Set but it is acceptable since worst case will be that 2 SSO will be sent if both requests came in at that same nanosecond
		if firewall.ShouldCacheUpdates(ctx) {
			if _, found := h.updateCache.Get(cacheKey); !found {

				var cacheTimeout int
				if firewall.GetFirewallSSO(ctx).GetCacheTimeout(ctx) != 0 {
					cacheTimeout = firewall.GetFirewallSSO(ctx).GetCacheTimeout(ctx)
				} else if timeout != 0 {
					cacheTimeout = timeout / 2
				} else {
					log.LoggerWContext(ctx).Error("Impossible to cache updates. There is no cache timeout in the firewall and no timeout defined in the request.")
				}

				if cacheTimeout != 0 {
					log.LoggerWContext(ctx).Debug(fmt.Sprintf("Caching SSO for %d seconds", cacheTimeout))
					h.updateCache.Set(cacheKey, 1, time.Duration(cacheTimeout)*time.Second)
				}

				shouldStart = true
			}
		} else {
			shouldStart = true
		}

		if shouldStart {
			//Creating a shallow copy here so the anonymous function has the right reference
			firewall := firewall
			h.spawnSso(ctx, firewall, info, func(info map[string]string) (bool, error) {
				return firewallsso.ExecuteStart(ctx, firewall, info, timeout)
			})
		} else {
			log.LoggerWContext(ctx).Debug("Determined that SSO start was not necessary for this update")
		}

	}

	w.WriteHeader(http.StatusAccepted)
}
483494
func (eh voiceServerUpdateEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*VoiceServerUpdate); ok {
		eh(s, t)
	}
}
878889
func (app *Application) Update() {
	ev := &eventAppUpdate{}
	ev.SetEventNow()
	if scr := app.screen; scr != nil {
		go func() { scr.PostEventWait(ev) }()
	}
}
875783
func (eh guildMemberUpdateEventHandler) Handle(s *Session, i interface{}) {
	if t, ok := i.(*GuildMemberUpdate); ok {
		eh(s, t)
	}
}
823477
func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
	return s.UpdateWithOptions(issue, nil)
}
1211067
func (s *NotificationsService) Update(k NotificationKey, n NotificationDTO) (*http.Response, error) {
	return s.client.put(k.URI(), n, nil)
}
399773
func Update(c *messagebird.Client, id string, req *UpdateRequest) (*Conversation, error) {
	conv := &Conversation{}
	if err := request(c, conv, http.MethodPatch, path+"/"+id, req); err != nil {
		return nil, err
	}

	return conv, nil
}