diff options
| author | Philipp Andreas <github@smurfy.de> | 2014-07-11 22:25:56 +0200 |
|---|---|---|
| committer | Philipp Andreas <github@smurfy.de> | 2014-07-11 22:25:56 +0200 |
| commit | 64aec8ec9808de66dfc185dfb82fc9d6cd1f004c (patch) | |
| tree | b61029be7cb6a8ecd9cfa20c555ec0c97f7d799a /daemon/watchconnector.cpp | |
| parent | ca5dfb4d10067d98c10822a31d6081e093dfdf4b (diff) | |
Sending the string as it is even if empty, but always \0 terminate all strings.
Fixes empty string to get received. Also an empty subject does not occupy space on the pebble notification.
Diffstat (limited to 'daemon/watchconnector.cpp')
| -rw-r--r-- | daemon/watchconnector.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/daemon/watchconnector.cpp b/daemon/watchconnector.cpp index ff64a02..955ba13 100644 --- a/daemon/watchconnector.cpp +++ b/daemon/watchconnector.cpp @@ -214,8 +214,9 @@ void WatchConnector::buildData(QByteArray &res, QStringList data) for (QString d : data) { QByteArray tmp = d.left(0xF0).toUtf8(); - res.append(tmp.length() & 0xFF); + res.append((tmp.length() + 1) & 0xFF); res.append(tmp); + res.append('\0'); } } @@ -249,10 +250,10 @@ QString WatchConnector::timeStamp() void WatchConnector::sendNotification(unsigned int lead, QString sender, QString data, QString subject) { QStringList tmp; - tmp.append(sender.isEmpty() ? " " : sender); - tmp.append(data.isEmpty() ? " " : data); + tmp.append(sender); + tmp.append(data); tmp.append(timeStamp()); - if (lead == 0) tmp.append(subject.isEmpty() ? " " : subject); + if (lead == 0) tmp.append(subject); QByteArray res = buildMessageData(lead, tmp); |
