Patch for modern versions of Trunk

12 views
Skip to first unread message

Doug

unread,
Oct 5, 2010, 8:43:00 AM10/5/10
to mythdroid-dev
Hi,

Modern versions of Trunk require a Token in addition to the protocol
version for the MYTH_PROTO_VERSION message. Here is a patch to
support this.

Thanks!
Doug


Index: src/org/mythdroid/backend/BackendManager.java
===================================================================
--- src/org/mythdroid/backend/BackendManager.java (revision 171)
+++ src/org/mythdroid/backend/BackendManager.java (working copy)
@@ -286,8 +286,14 @@

// Cope with odd protoVer resulting from mythtv r25366
int protoVer = MythDroid.beVersion * 1000 +
MythDroid.protoVersion;
+ String protoToken = getToken(protoVer);

- cmgr.sendString("MYTH_PROTO_VERSION " + protoVer); //$NON-
NLS-1$
+ // prefix a space for the actual request
+ if (protoToken.length() > 0) {
+ protoToken = " " + protoToken; //$NON-NLS-1$
+ }
+
+ cmgr.sendString("MYTH_PROTO_VERSION " + protoVer +
protoToken); //$NON-NLS-1$

if (!cmgr.readStringList()[0].equals("ACCEPT")) return
false; //$NON-NLS-1$

@@ -298,5 +304,24 @@
return true;

}
+
+ /**
+ * Returns the protocol token for a given protocol version.
+ * Tokens are defined in the messages.properties as:
+ * ProtoToken.<protoVer>, so just update the messages.properties
+ * for newer versions.
+ *
+ * @param protoVer
+ * @return
+ */
+ private String getToken(int protoVer) {
+ String key = "ProtoToken." + protoVer; //$NON-NLS-1$
+ String token = Messages.getString(key);
+ if (token.equals("!" + key + "!")) { //$NON-NLS-1$ //$NON-NLS-2$
+ token = ""; //$NON-NLS-1$
+ }
+
+ return token.trim();
+ }

}
Index: src/org/mythdroid/resource/messages.properties
===================================================================
--- src/org/mythdroid/resource/messages.properties (revision 171)
+++ src/org/mythdroid/resource/messages.properties (working copy)
@@ -54,6 +54,8 @@
Program.32=Never record
Program.33=Offline
Program.34=Other showing
+ProtoToken.62=78B5631E
+ProtoToken.63=3875641D
RecordingDetail.0=Type:
RecordingDetail.1=Status:
RecordingEdit.0=Failed to add/update recording

foo bar

unread,
Oct 29, 2010, 6:11:33 PM10/29/10
to mythdr...@googlegroups.com, do...@fawnanddoug.com
Hi Doug,

On 5 October 2010 13:43, Doug <do...@fawnanddoug.com> wrote:
> Modern versions of Trunk require a Token in addition to the protocol
> version for the MYTH_PROTO_VERSION message.  Here is a patch to
> support this.

Many thanks and sorry for taking so long to get back to you. Patch applied.

Regards,

foobum

Reply all
Reply to author
Forward
0 new messages