Skip to content

donaldlee2008/SharpTox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SharpTox Build Status

This project aims to provide a simple library that wraps all of the functions found in the Tox library. Tox is a free (as in freedom) Skype replacement.

Feel free to contribute!

Basic Usage

using System;
using SharpTox.Core;

class Program
{
    static Tox tox;

    static void Main(string[] args)
    {
        ToxOptions options = new ToxOptions(true, false);

        tox = new Tox(options);
        tox.OnFriendRequest += tox_OnFriendRequest;
        tox.OnFriendMessage += tox_OnFriendMessage;

        foreach (ToxNode node in Nodes)
            tox.BootstrapFromNode(node);

        tox.SetName("SharpTox");
        tox.SetStatusMessage("Testing SharpTox");

        tox.Start();

        string id = tox.GetAddress();
        Console.WriteLine("ID: {0}", id);

        Console.ReadKey();
        tox.Dispose();
    }

    //check https://wiki.tox.im/Nodes for an up-to-date list of nodes
    static ToxNode[] Nodes = new ToxNode[]
    {
        new ToxNode("192.254.75.98", 33445, new ToxKey(ToxKeyType.Public, "951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F")),
        new ToxNode("144.76.60.215", 33445, new ToxKey(ToxKeyType.Public, "04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F"))
    };

    static void tox_OnFriendMessage(int friendnumber, string message)
    {
        //get the name associated with the friendnumber
        string name = tox.GetName(friendnumber);

        //print the message to the console
        Console.WriteLine("<{0}> {1}", name, message);
    }

    static void tox_OnFriendRequest(string id, string message)
    {
        //automatically accept every friend request we receive
        tox.AddFriendNoRequest(id);
    }
}

Things you'll need

  • The libtox(core, av and dns) library, you should compile that yourself from the ProjectTox GitHub repo. Guidelines on how to do this can be found here. If you don't feel like compiling this yourself, you can find automatic builds for windows here: x86 or x64

  • Depending on how you compiled the core libraries, the names of those may differ from the defaults in SharpTox. Be sure to change the value of the const string dll in ToxFunctions.cs, ToxAvFunctions.cs and ToxDnsFunctions.cs accordingly.

Please note that at this time, this project hasn't been tested on any operating system other than Windows. You are of course, free to give it a try on the operating system of your choice.

Toxy

If you're considering using SharpTox for your project, you should definitely have a look at Toxy. Toxy is a metro-style Tox client for windows. It should have most of the functionality of Tox implemented.

Toxy is available here.

Contact

  • Join the official IRC channel #tox on freenode Official Tox IRC Channel
  • Send me an email: admin@impy.me

About

Wrapper library for Tox core, av and dns functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published