Menu

WiPy Commands

Help
2004-10-09
2013-03-19
  • Jeremy Evans

    Jeremy Evans - 2004-10-09

    Since I haven't implemented all of py-wire's functionality into WiPy, you might have to use the RC button and call some functions directly.  Here's a printout from Python's help function, so you can see what functions are available:

    class wire
    |  Controls connection to a server implementing the Wired protocol

    |  See http://www.zankasoftware.com/wired/rfc2.txt for description of
    |  the Wired protocol.

    |  Methods defined here:

    |  __init__(self, config='', **kwargs)
    |      Initialize connection parameters
    |     
    |      See wire.conf for a list of keyword arguments you can provide.
    |      In addition to those listed in wire.conf, the following are also
    |      accepted:
    |     
    |      log (logging.Logger) = the python logger for the connection
    |      callbacks (dict) = contains callback functions, corresponding to codes
    |          returned from the wired server.  Keys should be 3 digit integers,
    |          values should be functions. For example, if you have a key of 400
    |          in callbacks, the corresponding function will be called whenever
    |          the wired server returns that code.  These functions are passed 3
    |          arguments: the wire object, a list containing the arguments, and a
    |          flag denoting whether there was a problem with the response
    |          (0 for no problem, 1 for problem).
    |         
    |          There are also some string keys that are recognized for various
    |          events that don't correspond with codes the server returns.  The
    |          first argument is always this instance of wire. :
    |          anymessage(wire, code, args, failure):
    |              Called in addition to any normal callback response.  Useful if
    |              you are handling all the callbacks in a similar way but don't
    |              want to define them all individually.
    |          controlconnectionclosed(wire):
    |              Called whenever the control connection to the server is closed.
    |              Useful for reconnecting.
    |          downloadfinished(wire, wiredownload, success):
    |              Called when a download has been finished. wiredownload is the
    |              download that just finished, and success is whether the
    |              transfer was successful or not (i.e. no socket errors occured).
    |          downloadqueueprocessed(wire):
    |              Called when the library has finished processing the download
    |              queue.  This doesn't mean there is nothing left, it just means
    |              that the function call to _get has finished.  This will always
    |              be called if the download queue has been modified.
    |          gotunrecognizedmessage(wire, servermessage):
    |              Called when the server sends a message that this module
    |              doesn't recognize. message is the message the server sent.
    |          ping(wire):
    |              Called after pinging the server (every 10 minutes).  Useful for
    |              doing something on a regular basis.
    |          uploadfinished(wire, wireupload, success):
    |              Same as downloadfinished, but for uploads.
    |          uploadqueueprocessed(wire):
    |              Same as downloadqueueprocessed, but for uploads.
    |             
    |      Note: Unicode can be used for most string arguments

    |  __str__(self)

    |  __unicode__(self)

    |  acquirelock(self)
    |      Acquire lock if lock is not currently possessed by the current thread

    |  actionchatmessage(self, chatid, message)
    |      Send an action message to a chat
    |     
    |      chat (int) - id of chat to which to send message
    |      message (str) - action chat message to send

    |  banuser(self, user, message)
    |      Ban a user temporarily
    |     
    |      user - user to ban
    |      message (str) - message to display when banning user

    |  broadcast(self, message)
    |      Send a message to all users
    |     
    |      message (str) - broadcast message to send

    |  changechattopic(self, chatid, topic)
    |      Set a new chat topic
    |     
    |      chatid (int) - id of chat for which to set topic
    |      topic (str) - new chat topic

    |  changeicon(self, icon, imagefile=None)
    |      Change icon
    |     
    |      icon (int) - icon number to which to change
    |      image (file, str) - optional filelike object or file location
    |          containing the client's custom image

    |  changenick(self, nick)
    |      Change nick
    |     
    |      nick (str) - nick to which to change

    |  changestatus(self, status)
    |      Change the status string for this connection
    |     
    |      status (str) - the new status

    |  chatmessage(self, chatid, message)
    |      Send a message to a chat
    |     
    |      chatid (int) - id of chat to which to send message
    |      message (str) - broadcast message to send

    |  cleardownloadqueue(self)
    |      Clear the download queue

    |  clearnews(self)
    |      Clear the news

    |  clearuploadqueue(self)
    |      Clear the upload queue

    |  connect(self)
    |      Connect to the Wired Server

    |  createaccount(self, name, password='', group='', privileges=None)
    |      Create a new user account
    |     
    |      name (str) - name of account
    |      password (str) - password for account
    |      group (str) - group in which the account should be
    |      privileges (wireprivileges) - privileges for account

    |  createfolder(self, path)
    |      Create a new folder
    |     
    |      path (str) - path at which to create folder

    |  creategroup(self, name, privileges=None)
    |      Create a new group
    |     
    |      name (str) - name of group
    |      privileges (wireprivileges) - privileges for group

    |  createprivatechat(self)
    |      Create a private chat

    |  declineprivatechat(self, chatid)
    |      Decline a private chat
    |     
    |      chatid (int) - id of chat to which to decline joining

    |  deleteaccount(self, name)
    |      Delete a user account
    |     
    |      name (str) - name of account to delete

    |  deletegroup(self, name)
    |      Delete a group
    |     
    |      name (str) - name of group to delete

    |  deletepath(self, path)
    |      Delete a file/folder
    |     
    |      path (str) - path to delete, all deletes are recursive

    |  disconnect(self)
    |      Disconnect from the Wired Server

    |  download(self, serverpath, hostpath)
    |      Add a file or folder to the upload queue
    |     
    |      serverpath (str) - remote path to download
    |      hostpath (str) - local path at which to store downloaded files

    |  editaccount(self, name)
    |      Edit a user account specification
    |     
    |      name - update the server using the information in this account

    |  editgroup(self, name)
    |      Edit a group account specification
    |     
    |      name - update the server using the information in this group account

    |  forgetpath(self, path, forget=['files', 'filelists'])
    |      Forget path and all subpaths
    |     
    |      path (str) - path to forget

    |  getaccounts(self)
    |      Get a list of user accounts

    |  getaccountspec(self, name)
    |      Get account specification for user
    |     
    |      name (str) - name of account for which to get specification

    |  getbanner(self)
    |      Get the server's banner

    |  getclientversionstring(self)
    |      Return client version string

    |  getfileinfo(self, path)
    |      Get info for file
    |     
    |      path (str) - path about which to get info

    |  getfilelist(self, path)
    |      Get filelist for path

    |  getgroups(self)
    |      Get a list of user groups

    |  getgroupspec(self, name)
    |      Get account specification for group
    |     
    |      name (str) - name of group account for which to get specification

    |  getnews(self)
    |      Get news

    |  getprivileges(self)
    |      Get privileges for this connection

    |  getuserinfo(self, user)
    |      Get info on a user
    |     
    |      user - user about which to get info

    |  getuserlist(self, chatid)
    |      Get userlist for chat
    |     
    |      chatid (int) - id of chat to which to get user list

    |  inviteuser(self, user, chatid)
    |      Inivite a user to a private chat
    |     
    |      user - user to invite
    |      chatid (int) - id of chat to which to invite user

    |  joinprivatechat(self, chatid)
    |      Join a private chat
    |     
    |      chatid (int) - id of chat to which to join

    |  kickuser(self, user, message)
    |      Kick a user
    |     
    |      user - user to kick
    |      message (str) - message to display when kicking user

    |  leavechat(self, chatid)
    |      Leave a chat
    |     
    |      chatid (int) - id of chat to which to leave

    |  loadconfig(self, config, **kwargs)
    |      Get configuration from file or keyword arguments
    |     
    |      config (str) - path to configuration file
    |      **kwargs - other keyword arguments that override the defaults and the
    |          values in config

    |  movepath(self, pathfrom, pathto)
    |      Move a file/folder
    |     
    |      pathfrom (str) - current location of path to move
    |      pathto (str) - location to which to move path

    |  normpaths(self, hostpath, serverpath)
    |      Normalize relative paths for uploads and downloads
    |     
    |      hostpath (str) - if relative path, make absolute path using default host
    |          directory
    |      serverpath (str) - if relative path, make absolute path using default server
    |          directory

    |  postnews(self, message)
    |      Post a new news article
    |     
    |      message (str) - message to post to the news

    |  privatemessage(self, user, message)
    |      Send a private message to a user
    |     
    |      user - user to which to send message
    |      message (str) - message to send to user

    |  processdownloadqueue(self)
    |      Process the download queue
    |     
    |      Since processing the queue can take a long time if all of the information
    |      is available, the main thread can spawn a new thread for this function,
    |      which takes care of the locking (after it is wrapped by a decorator).

    |  processuploadqueue(self)
    |      Process the upload queue (see docstring for processdownloadqueue)

    |  releaselock(self, release=True)
    |      Release the lock if the argument is True

    |  restorequeues(self, filename='', starttransfers=False)
    |      Restore the previously saved upload and download queues
    |     
    |      filename (str) - the name of the file where the queues and caches are
    |          stored
    |      starttrasnfers (bool) - whether to immediately start the transfers
    |          after restoring the queues
    |         
    |      Note: This requires overwriting the current upload and download
    |      queues

    |  savequeues(self, filename='')
    |      Save the upload and download queues so they can be restored later
    |     
    |      filename (str) - the name of the file where the queues and caches
    |          should be stored

    |  searchfiles(self, query)
    |      Search for files with names containing query
    |     
    |      query (str) - search query (server will return all files containing
    |          this query as a substring, I think)

    |  setcomment(self, path, comment)
    |      Set a comment on the file/folder
    |     
    |      path (str) - path on which to set comment
    |      comment (str) - comment for path

    |  settype(self, path, type)
    |      Set the type of a folder
    |     
    |      path (str) - path on which to set comment
    |      comment (str) - comment for path

    |  upload(self, hostpath, serverpath)
    |      Add a file or folder to the upload queue
    |     
    |      hostpath (str) - local path to upload
    |      serverpath (str) - remote path at which to store uploaded files

    |  userid(self, user)
    |      Return the userid for given object, if possible
    |     
    |      user - if integer, probably the userid itself, so return it
    |          if wireduser, return the id
    |          if string, see if there is anyone with that nick on the server,
    |              and return the nick for that person
    |          otherwise return None

    |  validchat(self, chatid)
    |      Return True if chatid in chats, otherwise return False

     
    • Jeremy Evans

      Jeremy Evans - 2004-10-09

      To run the commands, you click on RC, and you put the commands in, one per line, prefaced by wire., and not including the self argument.  For example:

      #To change some common settings
      wire.changenick('New Nick')
      wire.changestatus('Just Changed Nickname')
      wire.changeicon(1337)

      If you want to make some account modifications, Run the following commands:

      # Run this command to get the list of accounts
      wire.getaccounts()

      # After that completes, run this command to get an account spec for a specific account
      wire.getaccountspec('ExampleAccount')

      # After that completes, you can edit the account.
      # You should input the rest of these accounts at the same time
      account = wire.accounts['ExampleAccount']
      privs = account.privileges
      account.groupname = 'NewGroup'
      account.password = setpassword('NewPassword')
      privs['broadcast'] = True
      privs['createaccounts'] = False
      wire.editaccount('ExampleAccount')

      Here's a list of privileges for wired users:
      getuserinfo, broadcast, postnews, clearnews, download,
      upload, uploadanywhere, createfolders, alterfiles, deletefiles,
      viewdropboxes, createaccounts, editaccounts, deleteaccounts,
      elevateprivileges, kickusers, banusers, cannotbekicked,
      downloadspeed, uploadspeed, downloadlimit, uploadlimit, changetopic

      Please reply if you have any questions.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.