rendered paste bodyhttp://www.speech.kth.se/snack/man/snack2.2/tcl-man.html#SOUND%20COMMAND
[18:28:01] <snifikino> Vivia says:
no, i mean, after it finishes recording and before it finishes sending
no, you won't need snack there.. when you stop recording, you get the data, you encode it, you write it to a file and you destroy your snack object... that's it...
for now what you'll do is record, write to file (skip the encoding part but put a #TODO there so we can find it easily later)
[18:28:09] <snifikino> and destroy the sound object
[18:06:08] <snifikino> snack:: sound snd
snd record
... blablabla
snd stop
snd data -start 0 -end ...
or
snd write $file
[18:06:13] <snifikino> really easy :)
[18:15:17] <snifikino> bind <Button1-Press> "start_record"
bind <Button2-Press> "stop_record"
[18:15:22] <Vivia® (*)> ok, no need for blocking stuff then
[18:15:26] <Vivia® (*)> or Button1-Release?
[18:15:56] <snifikino> button1-release, sorry :P
[18:21:41] <Vivia® (*)> soundName info
Returns a list with information about the sound.
[18:20:02] <Vivia® (*)> soundName destroy <-- i will need that
Index: C:/Projects/amsn/config.tcl
===================================================================
--- C:/Projects/amsn/config.tcl (revision 7268)
+++ C:/Projects/amsn/config.tcl (working copy)
@@ -659,6 +659,7 @@
::MSN::setClientCap msnc4
::MSN::setClientCap inkgif
::MSN::setClientCap multip
+ ::MSN::setClientCap voice
# Load up the personal states
LoadStateList
Index: C:/Projects/amsn/msnp2p.tcl
===================================================================
--- C:/Projects/amsn/msnp2p.tcl (revision 7268)
+++ C:/Projects/amsn/msnp2p.tcl (working copy)
@@ -344,7 +344,21 @@
}
}
+ proc SendVoiceClip {chatid file } {
+ set sbn [::MSN::SBFor $chatid]
+ set msnobj [create_msnobj [::config::getKey login] 11 $file]
+
+ set msg "MIME-Version: 1.0\r\nContent-Type: text/x-msnmsgr-datacast\r\n\r\nID: 3\r\nData: $msnobj\r\n\r\n"
+ set msg_len [string length $msg]
+
+ #Send the packet
+ ::MSN::WriteSBNoNL $sbn "MSG" "U $msg_len\r\n$msg"
+ # Let the magic do the rest... (the INVITE will be sent by the other client requesting the msnobj
+ # created with [create_msnobj] which also links the msnobj to the filename which will be automatically sent)
+ }
+
+
#//////////////////////////////////////////////////////////////////////////////
# ReadData ( data chatid )
# This is the handler for all received MSNP2P packets
@@ -894,6 +908,15 @@
}
}
+ } elseif { [lindex [SessionList get $cSid] 7] == "voice" } {
+ set file [file join $HOME voiceclips ${filename}.wav]
+ if { $file != "" && [file exists $file]} {
+ #play_sound $file
+ status_log "VOICE: file <$file> should be decoded and played..." red
+ } else {
+ status_log "VOICE: file <$file> does not exist" red
+ }
+
} elseif { [lindex [SessionList get $cSid] 7] == "filetransfer" } {
# Display message that file transfer is finished...
status_log "MSNP2P | $cSid -> File transfer finished!\n"
@@ -918,12 +941,18 @@
#set filename2 [::MSNP2P::GetFilenameFromMSNOBJ [::abook::getVolatileData $user_login msnobj]]
set filename2 [::abook::getContactData $user_login displaypicfile ""]
#status_log "MSNP2P | $sid $user_login -> opening file $filename for writing with $filename2 as user msnobj\n\n" blue
- if { $filename == $filename2 } {
- create_dir [file join $HOME displaypic cache]
- set fd [open "[file join $HOME displaypic cache ${filename}.png]" w]
- } else {
- create_dir [file join $HOME smileys cache]
- set fd [open "[file join $HOME smileys cache ${filename}.png]" w]
+ set type [lindex [SessionList get $cSid] 7]
+ if {$type == "bicon" } {
+ if { $filename == $filename2 } {
+ create_dir [file join $HOME displaypic cache]
+ set fd [open "[file join $HOME displaypic cache ${filename}.png]" w]
+ } else {
+ create_dir [file join $HOME smileys cache]
+ set fd [open "[file join $HOME smileys cache ${filename}.png]" w]
+ }
+ } elseif {$type == "voice" } {
+ create_dir [file join $HOME voiceclips]
+ set fd [open "[file join $HOME voiceclips ${filename}.wav]" w]
}
fconfigure $fd -translation {binary binary}
@@ -1029,15 +1058,18 @@
# chatid : Chatid from which we will request the object
# dest : The email of the user that will receive our request
# msnobject : The object we want to request (has to be url decoded)
- # filename: the file where data should be saved to
proc RequestObject { chatid dest msnobject} {
+ RequestObjectEx $chatid $dest $msnobject "bicon"
+ }
+
+ proc RequestObjectEx { chatid dest msnobject type} {
# Let's create a new session
set sid [expr {int([expr rand() * 1000000000])%125000000 + 4 } ]
# Generate BranchID and CallID
set branchid "[format %X [myRand 4369 65450]][format %X [myRand 4369 65450]]-[format %X [myRand 4369 65450]]-[format %X [myRand 4369 65450]]-[format %X [myRand 4369 65450]]-[format %X [myRand 4369 65450]][format %X [myRand 4369 65450]][format %X [myRand 4369 65450]]"
set callid "[format %X [myRand 4369 65450]][format %X [myRand 4369 65450]]-[format %X [myRand 4369 65450]]-[format %X [myRand 4369 65450]]-[format %X [myRand 4369 65450]]-[format %X [myRand 4369 65450]][format %X [myRand 4369 65450]][format %X [myRand 4369 65450]]"
- SessionList set $sid [list 0 0 0 $dest 0 $callid 0 "bicon" [::MSNP2P::GetFilenameFromMSNOBJ $msnobject] ""]
+ SessionList set $sid [list 0 0 0 $dest 0 $callid 0 "$type" [::MSNP2P::GetFilenameFromMSNOBJ $msnobject] ""]
# Create and send our packet
set slpdata [MakeMSNSLP "INVITE" $dest [::config::getKey login] $branchid 0 $callid 0 0 "A4268EEC-FEC5-49E5-95C3-F126696BDBF6" $sid 1 [string map { "\n" "" } [::base64::encode "$msnobject\x00"]]]
@@ -1045,7 +1077,6 @@
status_log "Sent an INVITE to $dest on chatid $chatid of object $msnobject\n" red
}
-
#//////////////////////////////////////////////////////////////////////////////
# MakePacket ( sid slpdata [nullsid] [MsgId] [TotalSize] [Offset] [Destination] )
# This function creates the appropriate MSNP2P packet with the given SLP info
Index: C:/Projects/amsn/protocol.tcl
===================================================================
--- C:/Projects/amsn/protocol.tcl (revision 7268)
+++ C:/Projects/amsn/protocol.tcl (working copy)
@@ -1269,8 +1269,17 @@
# paging Paging
# drctpg Direct-Paging
# webmsn WebMessenger
+ # tgw Connected via TGW
+ # space User has an MSN Spaces
+ # mce Connected using Win XP Media Center Edition
# direct DirectIM
# winks Winks
+ # search Client supports Shared search
+ # bot Is Bot
+ # voice Client supports Voice Clips
+ # secure Client supports secure channel chatting
+ # sip Client supports SIP based communiation
+ # shared Client supports Shared Folders
# msnc1 This is the value for MSNC1 (MSN Msgr 6.0)
# msnc2 This is the value for MSNC2 (MSN Msgr 6.1)
# msnc3 This is the value for MSNC3 (MSN Msgr 6.2)
@@ -1278,44 +1287,66 @@
# msnc5 This is the value for MSNC5 (MSN Msgr 7.5)
#
#switch==1 means turn on, 0 means turn off
+ #
+ # Reference : http://zoronax.spaces.live.com/?_c11_BlogPart_FullView=1&_c11_BlogPart_blogpart=blogview&_c=BlogPart&partqs=amonth%3d6%26ayear%3d2006
proc setClientCap { cap { switch 1 } } {
set clientid [::config::getKey clientid 0]
if $switch {
switch $cap {
- mobile { set clientid [expr {$clientid | 1} ] }
- inkgif { set clientid [expr {$clientid | 4} ] }
- inkisf { set clientid [expr {$clientid | 8} ] }
- webcam { set clientid [expr {$clientid | 16} ] }
- multip { set clientid [expr {$clientid | 32} ] }
- paging { set clientid [expr {$clientid | 64} ] }
- drctpg { set clientid [expr {$clientid | 128} ] }
- webmsn { set clientid [expr {$clientid | 512} ] }
- direct { set clientid [expr {$clientid | 16384} ] }
- winks { set clientid [expr {$clientid | 32768} ] }
- msnc1 { set clientid [expr {$clientid | 268435456} ] }
- msnc2 { set clientid [expr {$clientid | 536870912} ] }
- msnc3 { set clientid [expr {$clientid | 805306368} ] }
- msnc4 { set clientid [expr {$clientid | 1073741824} ] }
- msnc5 { set clientid [expr {$clientid | 1342177280} ] }
+ mobile { set clientid [expr {$clientid | 0x000001} ] }
+ inkgif { set clientid [expr {$clientid | 0x000004} ] }
+ inkisf { set clientid [expr {$clientid | 0x000008} ] }
+ webcam { set clientid [expr {$clientid | 0x000010} ] }
+ multip { set clientid [expr {$clientid | 0x000020} ] }
+ paging { set clientid [expr {$clientid | 0x000040} ] }
+ drctpg { set clientid [expr {$clientid | 0x000080} ] }
+ webmsn { set clientid [expr {$clientid | 0x000200} ] }
+ tgw { set clientid [expr {$clientid | 0x000800} ] }
+ space { set clientid [expr {$clientid | 0x001000} ] }
+ mce { set clientid [expr {$clientid | 0x002000} ] }
+ direct { set clientid [expr {$clientid | 0x004000} ] }
+ winks { set clientid [expr {$clientid | 0x008000} ] }
+ search { set clientid [expr {$clientid | 0x010000} ] }
+ bot { set clientid [expr {$clientid | 0x020000} ] }
+ voice { set clientid [expr {$clientid | 0x040000} ] }
+ secure { set clientid [expr {$clientid | 0x080000} ] }
+ sip { set clientid [expr {$clientid | 0x100000} ] }
+ shared { set clientid [expr {$clientid | 0x400000} ] }
+ msnc1 { set clientid [expr {$clientid | 0x10000000} ] }
+ msnc2 { set clientid [expr {$clientid | 0x20000000} ] }
+ msnc3 { set clientid [expr {$clientid | 0x30000000} ] }
+ msnc4 { set clientid [expr {$clientid | 0x40000000} ] }
+ msnc5 { set clientid [expr {$clientid | 0x50000000} ] }
+ msnc6 { set clientid [expr {$clientid | 0x60000000} ] }
}
} else {
switch $cap {
- mobile { set clientid [expr {$clientid & -2} ] }
- inkgif { set clientid [expr {$clientid & -5} ] }
- inkisf { set clientid [expr {$clientid & -9} ] }
- webcam { set clientid [expr {$clientid & -17} ] }
- multip { set clientid [expr {$clientid & -33} ] }
- paging { set clientid [expr {$clientid & -65} ] }
- drctpg { set clientid [expr {$clientid & -129} ] }
- webmsn { set clientid [expr {$clientid & -513} ] }
- direct { set clientid [expr {$clientid & -16385} ] }
- winks { set clientid [expr {$clientid & -32769} ] }
- msnc1 { set clientid [expr {$clientid & -268435457} ] }
- msnc2 { set clientid [expr {$clientid & -536870913} ] }
- msnc3 { set clientid [expr {$clientid & -805306369} ] }
- msnc4 { set clientid [expr {$clientid & -1073741825} ] }
- msnc5 { set clientid [expr {$clientid & -1342177281} ] }
+ mobile { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x000001)} ] }
+ inkgif { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x000004)} ] }
+ inkisf { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x000008)} ] }
+ webcam { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x000010)} ] }
+ multip { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x000020)} ] }
+ paging { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x000040)} ] }
+ drctpg { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x000080)} ] }
+ webmsn { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x000200)} ] }
+ tgw { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x000800)} ] }
+ space { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x001000)} ] }
+ mce { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x002000)} ] }
+ direct { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x004000)} ] }
+ winks { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x008000)} ] }
+ search { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x010000)} ] }
+ bot { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x020000)} ] }
+ voice { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x040000)} ] }
+ secure { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x080000)} ] }
+ sip { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x100000)} ] }
+ shared { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x400000)} ] }
+ msnc1 { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x10000000)} ] }
+ msnc2 { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x20000000)} ] }
+ msnc3 { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x30000000)} ] }
+ msnc4 { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x40000000)} ] }
+ msnc5 { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x50000000)} ] }
+ msnc6 { set clientid [expr {$clientid & (0xFFFFFFFF ^ 0x60000000)} ] }
}
}
::config::setKey clientid $clientid
@@ -4198,6 +4229,25 @@
::MSN::CloseSB $self
}
}
+ text/x-msnmsgr-datacast {
+ set body [$message getBody]
+ set lines [split $body "\r\n"]
+
+ foreach line $lines {
+ foreach {key value} [split $line ":"] break
+ if {$key == "ID"} {
+ set id $value
+ } elseif {$key == "Data"} {
+ set data $value
+ }
+ }
+ if { [info exists id] && [info exists data] } {
+ if {$id == "3" } {
+ ::MSNP2P::RequestObjectEx $chatid $typer $data "voice"
+ }
+ }
+
+ }
default {