mozillahispano is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

mozillahispano / tuentifox http://mozilla-hispano.org/

A Firefox Add-on to communicate with Tuenti, the most famous Spanish social network.

Clone this repository (size: 4.7 MB): HTTPS / SSH
hg clone https://bitbucket.org/mozillahispano/tuentifox
hg clone ssh://hg@bitbucket.org/mozillahispano/tuentifox

Issues

#155 Ubiquity commands

Reported by David Bengoa

would be great to have ubiquity (http://labs.mozilla.com/projects/ubiquity/) commands to use Tuentifox actions, like send a message or change your status, then you can just type "tuenti-status the-new-status" to change your status. We need to think about the commands, because there are many actions you can do in tuenti (mp, comment, change your status...). i think the actions should be change your status, send a private message and send a comment. maybe hotlinks to upload a photo, open sidebar, etc too.

The name of the commands is another point to discuss

Status: resolved Responsible: nobody Type: proposal Priority: major
Milestone: none Component: none Version: none

Attachments

No attachments added for this issue yet.

Comments and changes

  1. #1 David Bengoa

    written

    por ejemplo el comando tuenti-msg:

    function stripAccents(text){
            text = text.toLowerCase().replace(/^\s*/,'').replace(/\s*$/,'');
            accents         = ['á','é','í','ó','ú','ü','ö'];
            no_accents      = ['a','e','i','o','u','u','o'];
            for (var letter in accents){
                    text = text.replace(new RegExp(accents[letter],"ig"),no_accents[letter]);
            }
            return " " + text.replace(/[^a-zñ ]/gm,'');
    }
    
    var tuenti_friend = {
      _name: "Amigo de tuenti",
      suggest: function( text, html ) {
        
        Components.utils.import("resource://tuenti/tuentiAPI.jsm");
        
       if(!TuentiProxy.isConnected()){
         return [];
       }
        
        
        var t = FriendsData.data;
        var res = [];
        if(text == "" || /^\s*$/.test(text)){
          for(var k in t){
              res.push(CmdUtils.makeSugg(t[k].name));
              if(res.length>=5)return res;
          }
          return res;
        }
        var f = stripAccents(text);
          for each(var k in t){
            if(k.namef.indexOf(f)>=0){
              res.push(CmdUtils.makeSugg(k.name));
              if(res.length>=5)return res;
            }
          }
              
              
        return res;
      }
    }
    
    
    
    CmdUtils.CreateCommand({
      name: "tuenti-msg",
      icon: "chrome://tuenti/content/img/icon.png",
      homepage: "http://www.mozilla-hispano.org/",
      author: { name: "YouWoTMA", email: "youwotma@hotmail.es"},
      license: "GPL",
      description: "Envia un mensaje privado a un amigo de tuenti",
      help: "Nesesitas tener Tuentifox y estar conectado a una cuenta de tuenti mediante Tuentifox para usarlo. Escribe 'tuenti-msg [el texto] to [mombre del destinatario]'",
      takes: {Texto:noun_arb_text},
      modifiers: {to:tuenti_friend},
      preview: function( pblock, input ,mods) {
        Components.utils.import("resource://tuenti/tuentiAPI.jsm");
       if(!TuentiProxy.isConnected()){
         pblock.innerHTML = "Nesesitas estar conectado a TuentiFox para usar este comando";
         return;
       }
        
        var html = "Envia <b>" + input.text + "</b>";
        
    if(mods.to && mods.to.text != "" && mods.to != {}){
          var r = FriendsData.findFriend2(mods.to.text);
          html += " a " + r[0].replace('|','<b>').replace('|','</b>');
        }
        
        html += " como mensaje privado en tuentii";
        pblock.innerHTML = html;
      },
      execute: function(input,mods) {
        Components.utils.import("resource://tuenti/tuentiAPI.jsm");
    
    
       if(!TuentiProxy.isConnected()){
         displayMessage("Nesesitas estas conectado a TuentiFox para usar este comando");
         return;
       }
    
        var f = FriendsData.getFriendByName(mods.to.text);
        if(!f)return;
        var r = TuentiProxy.sendPrivateMessage(f.id,input.text);
         if(r){
             displayMessage("El mensaje se ha enviado correctamente.");
         }else{
             displayMessage("Ocurrio un error al enviar el mensaje. El mensaje no se ha enviado")
         }
      }
    });
    
    
    

    Modo de uso: 'tuenti-msg [texto] To [destinatario]'

  2. #2 Nukeador

    written

    • Changed milestone from 0.2beta to 0.2final.

    Moviéndolo a 0.2 final ya que no es algo prioritario.

  3. #3 David Bengoa

    written

    He implementado cuatro comandos, que se instalan automáticamente si esta ubiquity instalado, y se des-instalan cuando se des-instala tuentifox.

    tuenti-msg
    tuenti-wall
    tuenti-profile
    tuenti-status
    

    El nombre es provisional, hasta que saquen ubiquity 0.5 y se puedan usar nombres de mas de una palabra

  4. #4 David Bengoa

    written

    • Changed status from new to resolved.

Add comment / attachment

Verification: Please write the text from the image in the box (letters only)

captcha

Is that you, Humanoid? Is this me?