Hi,

this module requires email notification or rules integration so that the players get a notification when it's their turn.

Comments

Leeteq’s picture

Priority: Normal » Major

Yes, this is a "must".

I think this module should first implement a simple notification option, but then move beoynd that scope:

We should look into receiving email replies back from normal (web/)email clients with the next draw, and have this module automatically post it on behalf of that person as a draw, trigging a notification about that.
In effect, we would have "correspondance chess" support out of the box.

Perhaps all that is needed is a syntax "scheme" and make use of the Mailhandler module.
Not sure if any "integration" or "support" is needed at all, if only the syntax and posting/receiving from there can be done in normal drupal "add new content" fashion.

(PS. I am about to test this module, so I have no clue as of how the draws are "posted" right now, so I dont know what that would involve yet.)

Another thought related to this:
Could such email notifications actually provide a graphical view of the chessboard (positions)?
Probably too complex if needing to generate and send a JPG or PNG image as attachment to such emails,
but could the module generate a link to just that position that could be fetched from the web site when the email is opened, to generate and fetch that graphic representation on-the-fly, so that attachments is not needed?
That would only work in online mode, obviously, but could be interesting.

drupalshrek’s picture

Hello,

There is in fact some rules integration, but the detail is not automatically set up, nor is it documented. See for example the following part of the code which handles the rule processing:
http://drupalcode.org/project/vchess.git/blob/f719b5b:/vchess.rules.inc
Somewhere else in the code (I would have to look more, but where a move is made), the trigger for these rules is called.

You need to add the following rules to the rules module configuration. The following is what is used on chesspos.com and I suppose if you substitute [site:name] for wherever chesspos.com is hardcoded, then it would be better for your installation:

{ "rules_send_mail_saying_challenge_accepted" : {
"LABEL" : "Send mail saying challenge accepted",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "php", "vchess" ],
"ON" : [ "vchess_challenge_accepted" ],
"DO" : [
{ "mail" : {
"to" : "[opponent:mail]",
"subject" : "[site:name] - [site:current-user:name] has accepted your challenge!",
"message" : "[site:current-user:name] has accepted your challenge!\r\n\r\nThe game has begun.\r\n\r\nSee [site:url]?q=\/vchess\/game\/\u003C?php print $gid; ?\u003E\r\n\r\nregards,\r\n\r\n\r\nchesspos.com",
"language" : [ "" ]
}
}
]
}
}

{ "rules_send_opponent_mail" : {
"LABEL" : "Send opponent mail saying player has moved",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "php", "rules", "vchess" ],
"ON" : [ "vchess_move_made" ],
"DO" : [
{ "mail" : {
"to" : [ "opponent:mail" ],
"subject" : "chesspos.com - [site:current-user] has made the move \u003C?php print $move; ?\u003E in your game",
"message" : "Hello [opponent:name],\r\n\r\n[site:current-user] has made the move \u003C?php print $move ?\u003E in your game.\r\n\r\nLogin and check your game at [site:url]vchess\/game\/\u003C?php print $gid; ?\u003E\r\n\r\nregards,\r\n\r\n\r\nchesspos.com\r\n\r\n",
"language" : [ "" ]
}
}
]
}
}

I suppose it is possible to build this adding of the rules into the vchess module, but I haven't yet done so. Hope this helps.

In summary, basic support for emailing moves is built in, but it's not well documented/automated yet. A later step would of course to email the complete board position in the email...