silver version of bluemonkey
authorKevron Rees <tripzero.kev@gmail.com>
Thu, 6 Jun 2013 15:14:15 +0000 (08:14 -0700)
committerKevron Rees <tripzero.kev@gmail.com>
Thu, 6 Jun 2013 15:14:15 +0000 (08:14 -0700)
plugins/bluemonkey/bluemonkey.cpp
plugins/bluemonkey/bluemonkey.h
plugins/bluemonkey/irccoms.cpp

index e8cfb0a..05ea3ee 100644 (file)
@@ -91,12 +91,13 @@ BluemonkeySink::BluemonkeySink(AbstractRoutingEngine* e, map<string, string> con
                {
 
                        int i = codes.indexOf("authenticate");
-                       QString pin = codes.mid(i+10);
+                       QString pin = codes.mid(i+13);
                        pin = pin.trimmed();
 
 
                        if(!auth->authorize(prefix, pin))
                                irc->respond(sender,"failed");
+                       qDebug()<<sender;
 
                }
                else if(codes.startsWith("bluemonkey"))
@@ -106,6 +107,11 @@ BluemonkeySink::BluemonkeySink(AbstractRoutingEngine* e, map<string, string> con
                                irc->respond(sender, "denied");
                                return;
                        }
+
+                       QString bm("bluemonkey");
+
+                       codes = codes.mid(bm.length()+1);
+
                        irc->respond(sender, engine->evaluate(codes).toString());
                }
        });
@@ -211,3 +217,10 @@ void Property::setType(QString t)
 
        routingEngine->getPropertyAsync(request);
 }
+
+void Property::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid)
+{
+       mValue = value->copy();
+
+       changed(gvariantToQVariant(mValue->toVariant()));
+}
index 7ec155e..96b7297 100644 (file)
@@ -46,16 +46,7 @@ public:
        virtual PropertyList subscriptions() { PropertyList list; list.push_back(type().toStdString()); return list; }
        virtual void supportedChanged(PropertyList ){   }
 
-       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid)
-       {
-               mValue = value->copy();
-
-               QJsonDocument doc;
-
-               doc.fromJson(mValue->toString().c_str());
-
-               changed(doc.toVariant());
-       }
+       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid);
 
        virtual std::string uuid() { return amb::createUuid(); }
 
index 1cdb12e..75d7231 100644 (file)
@@ -39,10 +39,11 @@ void IrcCommunication::announce(QString s)
 
 void IrcCommunication::respond(QString target, QString s)
 {
-       IrcCommand command;
-       command.setType(IrcCommand::Message);
-       command.setParameters(QStringList()<<target<<s);
-       session->sendCommand(&command);
+       IrcCommand *command = IrcCommand::createMessage(target,s);
+       session->sendCommand(command);
+
+       delete command;
+
 }
 
 void IrcCommunication::messageReceived(IrcMessage *msg)
@@ -56,7 +57,7 @@ void IrcCommunication::messageReceived(IrcMessage *msg)
                        QString sender = msg->parameters().at(0);
                        QString m = msg->parameters().at(1);
 
-                       message(sender,msg->sender().prefix(),m);
+                       message(sender, msg->sender().prefix(), m);
                }
 
        }