changeset 22:8df5d8ef2e27 tip

switch back to LibQTip-1.0 as LQTC is depreciated Fixed up the line resizing as LQT does this automatically now
author wobin
date Wed, 22 Jul 2009 23:16:42 +1000
parents e066473450c2
children
files .pkgmeta Libs/LibQTipClick-1.1/LibQTipClick-1.1.lua Libs/LibQTipClick-1.1/LibQTipClick-1.1.toc Libs/LibQTipClick-1.1/lib.xml Model.lua
diffstat 5 files changed, 25 insertions(+), 171 deletions(-) [+]
line wrap: on
line diff
--- a/.pkgmeta	Wed Jul 22 22:06:36 2009 +1000
+++ b/.pkgmeta	Wed Jul 22 23:16:42 2009 +1000
@@ -22,6 +22,3 @@
 	Libs/LibQTip-1.0:
 			url: svn://svn.wowace.com/wow/libqtip-1-0/mainline/trunk
 			tag: latest
-	Libs/LibQTipClick-1.0:
-			url: git://git.wowace.com/wow/libqtipclick-1-1/mainline.git
-			tag: latest
--- a/Libs/LibQTipClick-1.1/LibQTipClick-1.1.lua	Wed Jul 22 22:06:36 2009 +1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-local MAJOR = "LibQTipClick-1.1"
-local MINOR =  3
-assert(LibStub, MAJOR.." requires LibStub")
-
-local lib, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
-
-if not lib then return end -- No upgrade needed
-
-local QTip = LibStub:GetLibrary("LibQTip-1.0")
-assert(QTip, MAJOR.." requires LibQTip-1.0")
-
-local CBH = LibStub:GetLibrary("CallbackHandler-1.0")
-assert(CBH, MAJOR.." requires CallbackHandler-1.0")
-
--------------------------------------------------------------------------------
--- Local variables
--------------------------------------------------------------------------------
-lib.LabelProvider, lib.LabelPrototype, lib.BaseProvider = QTip:CreateCellProvider(QTip.LabelProvider)
-local cell_provider, cell_prototype, cell_base = lib.LabelProvider, lib.LabelPrototype, lib.BaseProvider
-
--------------------------------------------------------------------------------
--- Public library API
--------------------------------------------------------------------------------
-local highlighter = CreateFrame("Frame", nil, UIParent)
-highlighter:SetFrameStrata("TOOLTIP")
-highlighter:Hide()
-
-local cell_highlight = highlighter:CreateTexture(nil, "BACKGROUND")
-cell_highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
-cell_highlight:SetBlendMode("ADD")
-cell_highlight:SetAllPoints(highlighter)
-
-function lib.OnEnter(event, cell, arg)
-	highlighter:SetAllPoints(cell)
-	highlighter:SetFrameLevel(cell:GetFrameLevel())
-	highlighter:Show()
-end
-
-function lib.OnLeave(event, cell, arg)
-	highlighter:ClearAllPoints()
-	highlighter:Hide()
-end
-
-function lib.OnMouseDown(event, cell, arg, button) PlaySound("igMainMenuOpen") end
-function lib.OnMouseUp(event, cell, arg, button)  end
-
-local function Cell_OnEnter(cell) cell.callbacks:Fire("OnEnter", cell, cell.arg) end
-local function Cell_OnLeave(cell) cell.callbacks:Fire("OnLeave", cell, cell.arg) end
-local function Cell_OnMouseDown(cell, button) cell.callbacks:Fire("OnMouseDown", cell, cell.arg, button) end
-local function Cell_OnMouseUp(cell, button) cell.callbacks:Fire("OnMouseUp", cell, cell.arg, button) end
-
-function cell_prototype:InitializeCell() cell_base.InitializeCell(self) end
-
-function cell_prototype:SetupCell(tooltip, value, justification, font, arg, ...)
-	local width, height = cell_base.SetupCell(self, tooltip, value, justification, font, ...)
-	self:EnableMouse(true)
-	self.arg = arg
-	self.callbacks = tooltip.callbacks
-	self:SetScript("OnEnter", Cell_OnEnter)
-	self:SetScript("OnLeave", Cell_OnLeave)
-	self:SetScript("OnMouseDown", Cell_OnMouseDown)
-	self:SetScript("OnMouseUp", Cell_OnMouseUp)
-
-	return width, height
-end
-
-function cell_prototype:ReleaseCell()
-	self:EnableMouse(false)
-	self:SetScript("OnEnter", nil)
-	self:SetScript("OnLeave", nil)
-	self:SetScript("OnMouseDown", nil)
-	self:SetScript("OnMouseUp", nil)
-	self.arg = nil
-	self.callbacks = nil
-end
-
--------------------------------------------------------------------------------
--- LibQTip wrapper API
--------------------------------------------------------------------------------
-local function AddNormalLine(tooltip, ...)
-	local oldProvider = tooltip:GetDefaultProvider()
-	tooltip:SetDefaultProvider(QTip.LabelProvider)
-	local lineNum, colNum = tooltip:AddLine(...)
-	tooltip:SetDefaultProvider(oldProvider)
-	return lineNum, colNum
-end
-
-local function AddNormalHeader(tooltip, ...)
-	local oldProvider = tooltip:GetDefaultProvider()
-	tooltip:SetDefaultProvider(QTip.LabelProvider)
-	local lineNum, colNum = tooltip:AddHeader(...)
-	tooltip:SetDefaultProvider(oldProvider)
-	return lineNum, colNum
-end
-
-local function SetNormalCell(tooltip, ...)
-	local oldProvider = tooltip:GetDefaultProvider()
-	tooltip:SetDefaultProvider(QTip.LabelProvider)
-	local lineNum, colNum = tooltip:SetCell(...)
-	tooltip:SetDefaultProvider(oldProvider)
-	return lineNum, colNum
-end
-
-function lib:Acquire(key, ...)
-	local tooltip = QTip:Acquire(key, ...)
-	tooltip:EnableMouse(true)
-
-	tooltip.callbacks = CBH:New(tooltip, "SetCallback", "UnSetCallback", "UnSetAllCallbacks" or false)
-	tooltip:SetCallback("OnEnter", self.OnEnter)
-	tooltip:SetCallback("OnLeave", self.OnLeave)
-	tooltip:SetCallback("OnMouseDown", self.OnMouseDown)
-	tooltip:SetCallback("OnMouseUp", self.OnMouseUp)
-
-	tooltip.AddNormalLine = AddNormalLine
-	tooltip.AddNormalHeader = AddNormalHeader
-	tooltip.SetNormalCell = SetNormalCell
-	tooltip:SetDefaultProvider(cell_provider)
-	return tooltip
-end
-
-function lib:IsAcquired(key) return QTip:IsAcquired(key) end
-
-function lib:Release(tooltip)
-	if not tooltip then return end
-	tooltip:EnableMouse(false)
-	tooltip:UnSetAllCallbacks(tooltip)
-	tooltip.callbacks = nil
-	tooltip["SetCallback"] = nil
-	tooltip["UnSetCallback"] = nil
-	tooltip["UnSetAllCallbacks"] = nil
-	QTip:Release(tooltip)
-end
-
-function lib:IterateTooltips() return QTip:IterateTooltips() end
-function lib:CreateCellProvider(baseProvider) return QTip:CreateCellProvider(baseProvider) end
--- a/Libs/LibQTipClick-1.1/LibQTipClick-1.1.toc	Wed Jul 22 22:06:36 2009 +1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-## Interface: 30100
-## Title: Lib: QTipClick-1.1
-## Notes: Library providing mouse-click support for LibQTip-1.0.
-## Author: Torhal
-## Version: r8 
-## X-Date: 2009-05-31T22:22:40Z
-## X-Category: Library, Tooltip
-## X-License: Ace3 BSD-like license
-## OptionalDeps: LibQTip-1.0
-## X-Curse-Packaged-Version: r8
-## X-Curse-Project-Name: LibQTipClick-1.1
-## X-Curse-Project-ID: libqtipclick-1-1
-## X-Curse-Repository-ID: wow/libqtipclick-1-1/mainline
-
-LibStub\LibStub.lua
-CallbackHandler-1.0\CallbackHandler-1.0.lua
-lib.xml
\ No newline at end of file
--- a/Libs/LibQTipClick-1.1/lib.xml	Wed Jul 22 22:06:36 2009 +1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
-..\FrameXML\UI.xsd">
-	<Script file="LibQTipClick-1.1.lua"/>
-</Ui>
\ No newline at end of file
--- a/Model.lua	Wed Jul 22 22:06:36 2009 +1000
+++ b/Model.lua	Wed Jul 22 23:16:42 2009 +1000
@@ -12,6 +12,7 @@
 -- * Message (140 characters)
 -- * ReplyTo (Name)
 -- * Related (Names)
+-- * Trends (Term)
 --
 -- Each User will have the following lists:
 -- * Follower
@@ -28,7 +29,7 @@
 -- - Followee is added to Settings.Requested 
 -- - Followee receives 'follow request' -> (their) Settings.Pending
 -- - Followee acts on request -> (their) Settings.Pending cleared
---  1) Follwer is online
+--  1) Follower is online
 --		- Follower receives 'request accepted' -> Added to Settings.Following and
 --		cleared from Settings.Requested
 --  2) Follower is offline
@@ -36,12 +37,22 @@
 --		is a Settings.Requested for that name, and if so assume they have approved
 --		and clear/add records appropriately.
 --
---		For updating, there can be a few methods.
+--For updating, there can be a few methods.
 --
 --		Guild open: you're not private, you broadcast to the guild your last X
 --		squawks on login
 --
---		followers:
+--		Followers: If you login and are following people, you send a request to them
+--		directly upon login (after a brief pause to load everything) to get the last 
+--		5 tweets from them. You also broadcast your last 5 tweets to them.
+--
+--		Problems inherent in the system:
+--			- Number of transmissions if Follow group is large.
+--			- Guild transmissions in large guilds, how do we get the information of 
+--			  people who have already logged on previously without being spammed? We 
+--			  send a request for a guild listing of people using the addon and then 
+--			  go through that list requesting the last 5 of each user one by one.
+--			- Transmission must be able to be delayed if sender is in combat.
 --]]
 Model.Squawks = {}
 local Squawks = Model.Squawks
@@ -62,23 +73,11 @@
 ["WARRIOR"] = "C79C6E",
 }
 	
-local function wrap(str, limit)
-  limit = limit or 72
-	local here = 1
-  return str:gsub("|c%x-|H.-|h(.-)|h|r", "%1"):gsub("(%s+)()(%S+)()",
-                          function(sp, st, word, fi)
-                            if fi-here > limit then
-                              here = st 
-                              return "\n"..word
-                            end
-                          end)
-end
-
 function Squawks:new(Message, Owner, Class, ReplyStamp)
 	View:Print("New: "..ReplyStamp)
 	local o = {}
 	o.Owner = Owner or UnitName("player")
-	o.Message = wrap(Message)
+	o.Message = Message
 	o.Time = time()
 	local reply, to = strsplit("@", ((strsplit(" ", Message))))
 	if reply == "" then
@@ -97,6 +96,16 @@
 	if #o.Related == 0 then
 		o.Related = nil
 	end
+	
+	o.Trends = {}
+
+	for word in string.gmatch(Message, "#(%S+)") do
+		table.insert(o.Trends, word)
+	end
+	
+	if #o.Trends == 0 then
+		o.Trends = nil
+	end
 
 	table.insert(self.Main, o)