quint16 t = 0; // Type
QString timestring;
textstream >> mesgID >> userID >> timestring >> t;
+ qDebug() << "Read line:";
+ qDebug() << "\tmesgID: "<< mesgID;
+ qDebug() << "\tuserID: "<< userID;
+ qDebug() << "\ttime : "<< timestring;
+ qDebug() << "\ttype : "<< t;
// Validate input
- QDateTime timestamp = QDateTime::fromString(timestring, "yyyy-MM-ddTHH-mm-ss.zzz");
+ QDateTime timestamp = QDateTime::fromString(timestring, "yyyy-MM-ddTHH:mm:ss.zzz");
if(mesgID == -1 || userID == -1 || !timestamp.isValid() ) {
qWarning() << "Received invalid message from server; discarding.";
continue;
action->mesgID = mesgID;
action->userID = userID;
action->timestamp = timestamp;
+ qDebug() << "Update: got UserJoin:" << username << "joined";
break;
}
case Action::UserPart:
}
case Action::DrawLine:
{
- /*
act = new DrawLineAction();
- action = static_cast<DrawLineAction*>(act);
+ DrawLineAction* action = static_cast<DrawLineAction*>(act);
int red = 0;
int green = 0;
int blue = 0;
continue;
}
do {
+ qreal x = 0;
+ qreal y = 0;
+ textstream >> x >> y;
+ action->points.append(QPointF(x,y));
// some stuff with the points
} while(textstream.status() == QTextStream::Ok);
action->color = QColor::fromRgb(red, green, blue);
action->mesgID = mesgID;
action->userID = userID;
action->timestamp = timestamp;
- */
break;
}
case Action::AddImage:
{
- /*
act = new AddImageAction();
AddImageAction* action = static_cast<AddImageAction*>(act);
- // do somethin with the top-left point
+ qreal x = 0;
+ qreal y = 0;
+ textstream >> x >> y;
+ action->topLeft = QPointF(x,y);
// handle reading image data as base64-encoded binary, bleah
+ QString im;
+ textstream >> im;
+ // im is a base64-encoded binary string.
+
+
+
action->mesgID = mesgID;
action->userID = userID;
action->timestamp = timestamp;
- */
break;
}
case Action::UserChat:
void ConnectionManager::onConnect() {
qDebug() << "connection established";
emit connected();
- (*textStream) << "0 0 0 2 " << username << endl;
+ (*textStream) << "0 0 0 1 " << username << endl;
qDebug() << "sent JoinAction";
}