|
| Author |
Message |
Siebe God Like

Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
    
|
Posted: Sat Apr 03, 2004 7:16 pm Post subject: |
|
|
Ok, so first let me explain how CE's are being send..
First you need to make the MSNObjects for the images (just like with DP's), but only with the type set to 2. Then, when you want to display the emoticons in a message you need to send it's shortcut (the code you use which must be repalced with the emoticon) and the MSNObject so MSN know's what to request from you.
Now, I was wondering, what do you think is the easiest way to implent this? I was thinking something like this:
The user calls a sub like $self->custom_emotes("path/to/emotes"); in which the path is a <*lazy*>directory*lazy*>. The script then reads all files from the directory (if they are PNG's of course), and stores them in a hash.
Then, when someone wants to sends a message with custom emoticons he can feed it with null characters. So for example:
| Code: | | This -> \0:D\0 is a CE |
The script will split the message on the null character and check if the strings are shortcuts. If so, it will load the msn object and send it in a special message. Of course it will also take out the null characters, so it would end up as
| Quote: | This -> is a CE |
The MSNobjects have to be send in a specially crafted message send <*lazy*>before*lazy*> the normal message. It can contain only 5 different emoticons at max. IMHO, this is by far the easiest way.. If you know something better please let me know.. |
|
| Back to top |
|
 |
eric256 The Keymaker

Joined: 03 May 2006 Posts: 2292 Location: Colorado
     
|
Posted: Sun Apr 04, 2004 3:55 pm Post subject: |
|
|
A bit slow but here is my input. Instead of registering the whole directory let the person do more like.
| Code: | | $msn->addEmoticon(":-)", "smile.png"); |
Then if they want \0 \0 around it they just do it there
| Code: | | $msn->addEmoticon("\0:-)\0", "smile.png"); |
Then the sendmsg just goes threw the hash that has " " => "smile.png" and does the required replacement and sends the required emoticon on first. It could count how many it has done and automaticaly stop at 5. BTW is it five occurences? or can you have the same emoticon a bunch of times but only have five different ones in a message? _________________ Eric256
Proud previous owner and current admin of Bot-depot.com |
|
| Back to top |
|
 |
Siebe God Like

Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
    
|
Posted: Sun Apr 04, 2004 4:07 pm Post subject: |
|
|
You can have more than 5 occurences (try it in MSN, you'll see that you can send 5 different ones at max, but you CAN send those 5 multiple times).
Hmm, ok, I hadn't thought of if that way  Anyways, so if the user sends something, MSN.pm will do this: (don't mind the syntax )
for all hash elements { if(message contains element) { load emoticon } } |
|
| Back to top |
|
 |
eric256 The Keymaker

Joined: 03 May 2006 Posts: 2292 Location: Colorado
     
|
Posted: Sun Apr 04, 2004 4:11 pm Post subject: |
|
|
Yep exactly what i was thinking. _________________ Eric256
Proud previous owner and current admin of Bot-depot.com |
|
| Back to top |
|
 |
Siebe God Like

Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
    
|
Posted: Sun Apr 04, 2004 4:12 pm Post subject: |
|
|
| Okay, I'll mess with it a bit after dinner (-: |
|
| Back to top |
|
 |
Siebe God Like

Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
    
|
Posted: Tue Apr 06, 2004 1:26 pm Post subject: |
|
|
Okay, here goes (-: I've added custom emoticon support, and it works 
People can add custom emoticons like Eric said, but then with add_emoticon(, , );. A little screen shot:

And below is the new attached MSN.pm. Let me know if there are problems so I can fix them  |
|
| Back to top |
|
 |
eric256 The Keymaker

Joined: 03 May 2006 Posts: 2292 Location: Colorado
     
|
Posted: Tue Apr 06, 2004 2:29 pm Post subject: |
|
|
Whats the socket add for? _________________ Eric256
Proud previous owner and current admin of Bot-depot.com |
|
| Back to top |
|
 |
Siebe God Like

Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
    
|
Posted: Tue Apr 06, 2004 2:39 pm Post subject: |
|
|
$self->add_emoticon invokes this.
The user can call it as add_emoticon(, , ) or $self->(, );  |
|
| Back to top |
|
 |
eric256 The Keymaker

Joined: 03 May 2006 Posts: 2292 Location: Colorado
     
|
Posted: Tue Apr 06, 2004 2:43 pm Post subject: |
|
|
I don't understand why you are adding emoticons to an individual socket. _________________ Eric256
Proud previous owner and current admin of Bot-depot.com |
|
| Back to top |
|
 |
Siebe God Like

Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
    
|
Posted: Tue Apr 06, 2004 2:46 pm Post subject: |
|
|
| You aren't, the $self will later on refer to the Master, not to individual sockets. |
|
| Back to top |
|
 |
eric256 The Keymaker

Joined: 03 May 2006 Posts: 2292 Location: Colorado
     
|
Posted: Tue Apr 06, 2004 2:48 pm Post subject: |
|
|
Ahh okay. _________________ Eric256
Proud previous owner and current admin of Bot-depot.com |
|
| Back to top |
|
 |
Siebe God Like

Joined: 06 Jan 2004 Posts: 562 Location: Netherlands
    
|
Posted: Tue Apr 06, 2004 2:51 pm Post subject: |
|
|
Yeah sorry for the confusion, but I'm not "used" to using $self-> constructs, I'd rather call a function by placing the variables in the () .. Like the socket thing  |
|
| Back to top |
|
 |
eric256 The Keymaker

Joined: 03 May 2006 Posts: 2292 Location: Colorado
     
|
Posted: Tue Apr 06, 2004 3:15 pm Post subject: |
|
|
There are advantages to the $self->add_emoticon("name","file") way though. For instance the MSN module doens't have to export any of its functions because the $self part is a ref to MSN so it knows to pretend that $self->add_emoticon is realy MSN::add_emoticon($self,"name","file");. Besides we are working with objects and thats the standard notation for objects. _________________ Eric256
Proud previous owner and current admin of Bot-depot.com |
|
| Back to top |
|
 |
hacklen Newbie

Joined: 26 Feb 2006 Posts: 1
  
|
Posted: Mon Feb 27, 2006 10:32 am Post subject: HELP ME ERIC! |
|
|
 |
|
| Back to top |
|
 |
|