Try to match messages with the ones we should
listen to.
19293
public function listen()
    {
        try {
            $isVerificationRequest = $this->verifyServices();

            if (! $isVerificationRequest) {
                $this->fireDriverEvents();

                if ($this->firedDriverEvents === false) {
                    $this->loadActiveConversation();

                    if ($this->loadedConversation === false) {
                        $this->callMatchingMessages();
                    }

                    /*
                     * If the driver has a  "messagesHandled" method, call it.
                     * This method can be used to trigger driver methods
                     * once the messages are handles.
                     */
                    if (method_exists($this->getDriver(), 'messagesHandled')) {
                        $this->getDriver()->messagesHandled();
                    }
                }

                $this->firedDriverEvents = false;
                $this->message = new IncomingMessage('', '', '');
            }
        } catch (\Throwable $e) {
            $this->exceptionHandler->handleException($e, $this);
        }
    }
202505
def run(self, message):
        """"""
        for value in message:
            self.update(value)
        return [self.low, self.high]
591591
def listen():
        """"""
        msg = MSG()
        ctypes.windll.user32.GetMessageA(ctypes.byref(msg), 0, 0, 0)
955078
def does_match?(msg, conditions)

      return true unless conditions

      conditions.each do |k, v|

        return false unless Array(v).find do |vv|

          # the Array(v) is for backward compatibility, although newer
          # track conditions are already stored as arrays.

          vv = Ruote.regex_or_s(vv)

          val = case k

            when 'class' then msg['error']['class']
            when 'message' then msg['error']['message']

            else Ruote.lookup(msg, k)
          end

          val && (vv.is_a?(Regexp) ? vv.match(val) : vv == val)
        end
      end

      true
    end
109229
def notify(self, message):
        
        for regex, handler in self.dispatch.items():
            match = re.search(regex, message)
            if match:
                handler = getattr(self, handler)
                return handler(match)
109220
def add_listener(self, listener, message_type, data=None, one_shot=False):
        """"""
        lst = self._one_shots if one_shot else self._listeners

        if message_type not in lst:
            lst[message_type] = []

        lst[message_type].append(Listener(listener, data))
84207
def run(self, messages):
        """"""
        statistics = {}
        statistics['time'] = str(datetime.now())
        statistics['time-utc'] = str(datetime.utcnow())
        statistics['unlock'] = self.args.unlock

        if self.args.question:
            statistics['question'] = [t.name for t in self.assignment.specified_tests]
            statistics['requested-questions'] = self.args.question

            if self.args.suite:
                statistics['requested-suite'] = self.args.suite
            if self.args.case:
                statistics['requested-case'] = self.args.case

        messages['analytics'] = statistics
        self.log_run(messages)
1104199
def matches_pattern(self, other):
        """"""
        if hasattr(other, 'messageType'):
            messageTypeIsEqual = False
            if self.messageType is None or other.messageType is None:
                messageTypeIsEqual = True
            else:
                messageTypeIsEqual = (self.messageType == other.messageType)
            extendedIsEqual = False
            if self.extended is None or other.extended is None:
                extendedIsEqual = True
            else:
                extendedIsEqual = (self.extended == other.extended)
            return messageTypeIsEqual and extendedIsEqual
        return False
140258
def matches(self, a, b, **config):
        
        submitter_a = a['msg']['override']['submitter']['name']
        submitter_b = b['msg']['override']['submitter']['name']
        if submitter_a != submitter_b:
            return False
        return True
2110
def on_message(msg, server):
    """"""
    text = msg.get("text", "")
    match = re.findall(r"!gif (.*)", text)
    if not match:
        return

    res = gif(match[0])
    if not res:
        return

    attachment = {
        "fallback": match[0],
        "title": match[0],
        "title_link": res,
        "image_url": res
    }
    server.slack.post_message(
        msg['channel'],
        '',
        as_user=server.slack.username,
        attachments=json.dumps([attachment]))
212080
def _handle_match(client, channel, nick, message, matches):
    
    generate_interrogative = _CHANNEL_GENERATE_REGEX.match(message)
    if generate_interrogative:
        return generate(_DEFAULT_TOPIC, _ADD_PUNCTUATION)
    current_topic = db.markovify.find_one({'topic': _DEFAULT_TOPIC})
    if current_topic:
        message = punctuate(current_topic['text'], message, _ADD_PUNCTUATION)
    try:
        ingest(_DEFAULT_TOPIC, message)
    except ValueError as e:
        # not good, but this is done every message so just move along
        print str(e)
1300
def get_callbacks_from_message(self, msg):
        """"""
        callbacks = []
        for key in self._find_matching_keys(msg):
            for callback in self[key]:
                callbacks.append(callback)
        return callbacks
1194128
def parse_band_set_name(self, message):
        """"""
        if message.get("name"):
            self._service_name = message["name"]
        else:
            self.log.warning(
                "Received broken record on set_name band\nMessage: %s", str(message)
            )
390297
def messageReceived(self, message):
        
        if len(message) == 2:
            # compatibility receiving of tag as first part
            # of multi-part message
            self.gotMessage(message[1], message[0])
        else:
            self.gotMessage(*reversed(message[0].split(b'\0', 1)))
392277
def warn(message)
      (m = filter(message, :warn)) && each {|l| l.warn(m)}
    end
1367004
def maybe_colored(msg, color, opt):
    """"""
    if opt.monochrome:
        return msg

    return colored(msg, color)
327330
def process_notifications(self, messages):
        """"""
        for object_id, object_size, metadata_size in messages:
            if object_size > 0 and object_id in self._waiting_dict:
                linked_list = self._waiting_dict[object_id]
                self._complete_future(linked_list)