Resend correct gcode line when resend is requested
(manually cherry picked from commit c8875fd)
Be able to cope with M999 causing a Resend: 1
(cherry picked from commit 8b702db)
Reverted bbad030a9227db6ca2df42d393c38fb4db6817a4

Correct in devel branch, wrong in master branch (different counting).

Closes #166
Also send identity_changed event on passive login
(cherry picked from commit 695f3f3)
Added missing return statement that caused an exception
Yet another fix for the M999 resend issue

Should hopefully now be also fixed in case of a newly established connection with the printer, which was a regression due to the fix of the resending code.
Merge branch 'master' into devel

Conflicts:
octoprint/util/comm.py