Esempio n. 1
0
//MYSKYPE
void MySkype::OnMessage(const Message::Ref& message, const bool&, const Message::Ref&, const ConversationRef& conversation){

  while (message_event){ usleep(10000); }

  Message::TYPE messageType;
  message->GetPropType(messageType);

  if (messageType == Message::POSTED_TEXT)
  {
    SEIntList propIds;
    SEIntDict propValues;
    propIds.append(Message::P_AUTHOR);
    propIds.append(Message::P_BODY_XML);
    propValues = message->GetProps(propIds);

    if (propValues[0] != accountName.c_str())
    {
        std::string aux;
        aux = propValues[0] + ": " + propValues[1] + "\n";

        //log->SetDefaultStyle(wxTextAttr(*wxRED));
        //log->AppendText(wxString(aux.c_str(), wxConvUTF8));
        text_event = aux;
        colour_event = *wxRED;
        message_event = true;
    }
  }

}
Esempio n. 2
0
SEIntList SEIntList::split(const SEString& str, char sep, char esc)
{
        SEIntList ret;
        size_t from = 0;
        size_t cur = 0;
        size_t len = str.length();

        // skip trailing separators
        while (str[cur] == sep) {
                from++;
                cur++;
        }

        cur++;

        while (cur <= len) {
                // the case when we go out of bounds is when we have escaped separator
                // before end of the string
                if (cur == len) {
                        ret.append(str.substr(from, cur - 1).toInt());

                        break;
                }

                if (str[cur] == sep) {
                        // here we may go out of bounds (handled above)
                        if (esc && (str[cur - 1] == esc)) {
                                cur++;

                                continue;
                        }

                        ret.append(str.substr(from, cur - 1).toInt());

                        while ((str[cur] == sep) && (cur < len)) cur++;

                        if (cur >= (len - 1))
                                break;

                        from = cur++;

                        continue;
                }

                if (cur == (len - 1)) {
                        ret.append(str.substr(from, cur).toInt());

                        break;
                }

                cur++;
        }

        return ret;
}
SEIntList SEObjDict::keys() {
    SEIntList result;
    int d_size = size();
    if (d && d->quick_list) {
        for (int i = 0; i < d_size; i++) {
            result.append(d->quick_list[i]->key);
        }
    }
    return result;
}
Esempio n. 4
0
void UserConversation::OnMessage(const MessageRef& message){

    Message::TYPE messageType;
    message->GetPropType(messageType);
    if(messageType==Message::POSTED_TEXT){
        SEIntList propIds;
        SEIntDict propValues;
        propIds.append(Message::P_AUTHOR);
        propIds.append(Message::P_BODY_XML);
        propValues = message->GetProps(propIds);   
    
        if(propValues[0]!="yourusername"){
        
            cout<<"Conversation with:"<<propValues[0]<<endl;
            cout<<"Text: "<<propValues[1]<<endl;
            //Message::Ref reply;
            //this->PostText("Have a reply",reply, false);
        }
    }
}