Google wave robot inline reply

875 views Asked by At

I've been working on my first robot for google wave recently, a vital part of what it does is to insert inline replies into a blip. I can't for the life of me figure out how to do this!

The API docs have a function InsertInlineBlip which sounded promising, however calling that doesn't appear to do anything!

EDIT:: It seems that this is a known bug. However, the question still stands what is the correct way to insert an inline blip? I'm assuming something like this:

inline = blip.GetDocument().InsertInlineBlip(positionInText)
inline.GetDocument().SetText("some text")
3

There are 3 answers

0
Willi Ballenthin On BEST ANSWER

If you look at the sourcecode for OpBasedDocument.InsertInlineBlip() you will see the following:

 412 -  def InsertInlineBlip(self, position): 
 413      """Inserts an inline blip into this blip at a specific position. 
 414   
 415      Args: 
 416        position: Position to insert the blip at. 
 417   
 418      Returns: 
 419        The JSON data of the blip that was created. 
 420      """ 
 421      blip_data = self.__context.builder.DocumentInlineBlipInsert( 
 422          self._blip.waveId, 
 423          self._blip.waveletId, 
 424          self._blip.blipId, 
 425          position) 
 426      # TODO(davidbyttow): Add local blip element. 
 427      return self.__context.AddBlip(blip_data) 

I think the TODO comment suggests this feature is not yet active. The method should be callable and return correctly, however I suspect that the document operation is not applied to the global document.

The syntax you included in your post looks correct. As you can see above, InsertInlineBlip() returns the value of AddBlip(), which is ...dun, dun, dun... a blip.

 543 -  def AddBlip(self, blip_data): 
 544      """Adds a transient blip based on the data supplied. 
 545   
 546      Args: 
 547        blip_data: JSON data describing this blip. 
 548   
 549      Returns: 
 550        An OpBasedBlip that may have operations applied to it. 
 551      """ 
 552      blip = OpBasedBlip(blip_data, self) 
 553      self.blips[blip.GetId()] = blip 
 554      return blip 

EDIT: It is interesting to note that the method signature of the Insert method InsertInlineBlip(self, position) is significantly different from the Insert method InsertElement(self, position, element). InsertInlineBlip() doesn't take an element parameter to insert. It seems the current logic for InsertInlineBlip() is more like Blip.CreateChild(), which returns a new child blip with which to work. From this we can suspect that this API will change as the functionality is added.

1
Lee On

This appears to have previously been a bug, however, an update today has hopefully fixed it: http://code.google.com/p/google-wave-resources/wiki/WaveAPIsChangeLog

1
keyboardP On

It could be a possible bug.