bug: fix file sending

there was a bug in file sending (perhaps new toxcore have different filenumber behavior).
also added st-* functions and abstracted it a bit